How Geomorph Dungeon Works - CityGenerator/Megacosm-Generator GitHub Wiki

After a weekend of fighting and gnashing teeth, I was able to get the geomorph dungeon generator working. After discussions with others, I figure it's not a bad idea to document the process.

The map itself is constructed of anywhere from 1 to 50 tiles in various arrangements. In this example, we'll be using a 3x3 map. We'll be generating the map in three steps.

Generating the Grid

The first and easiest step is to generate a simple grid. For this we're simply creating a matrix-like datastructure of Tile objects, which will look something like this:

self.spaces = [ [ GeomorphDungeon.Tile(i,j) for i in range(self.width) ] for j in range(self.height) ]

# which produces something like this:

[
 [ Tile, Tile, Tile ],
 [ Tile, Tile, Tile ],
 [ Tile, Tile, Tile ]
]

The tiles are generated inside a set of nested for loops, and are passed in their coordinates.

Generating the Connections

Right now, none of the tiles are aware of each other.