Procedural content generation: map construction via blind agent (a.k.a. building a Rogue-like map)

I guess this is a continuation of the previous post on procedural content generation. As before, I'm just following along and implementing the pseudocode from the Procedural Content in Games book (in chapter 3; link to the .pdf).

This time we're using an agent-based approach as opposed to the binary space partitioning (BSP) used last time. This implementation is a blind digger; it seems to generate more organic layouts, but it also more frequently generates nonsensical layouts relative to the BSP method. Maybe that would be good for a cave map or something of that sort.




I used Python again. Not having to implement a tree data structure this time around made it much faster to implement. The function that controls the overall flow is below, and you can find the entire script on my GitHub here. I'm pretty sure there are some bugs crawling around still, but it seems to work.


def generateAgentDiggerMap():
    mapHeight = 50
    mapWidth = 50
    digger = BlindDigger()
    
    diggingMap = DiggingMap(mapWidth, mapHeight)
    digger.initializeDig(diggingMap)
    
    while (diggingMap.percentAreaDug < 40):
        digger.performDigIteration(diggingMap)
    
    diggingMap.plotDiggingMap()

Both the Llama and I passed prelims! Click here for part 1.

Comments

Popular Posts