Map Generator

The map generator for my roguelike is pretty simple:  I use a Dictionary as a blackboard, and read / assign values to it with a lit of Resources.  The Resources can be as granular as needed for each design, but are always reusable.


the "final result" of a map object in my preview scene

The simple Mystery Dungeon example generator I have is the following list:

  1. initialize: sets the map size
  2. BSP: runs the Binary Space Partition step to split up the whole map into some set of squares
    The Map's area split into rectangles
  3. Shrink Rects:  Takes the list of BSP Rects and shrinks them according to some properties
    The BSP Rects have been shrunk down to their room size.
  4. Connect Rects: Takes the shrunk rects and connects them. (I noticed this was not seeded properly while writing this post - woops!)
    The rooms are connected!
Each of these steps is individually configured, and can read any info from the previous steps.  At runtime, these steps are run with a specific seed, and I have a preview scene that allows me to preview the result (or each individual step - see above.
here's what the (serializable!) data looks like for this map generator
a list of resources in Godot's editor describing the map generated above.


Mastodon

This article was updated on