I'm just trying to figure out how to deal with randomly generated dungeons. |
I wouldn't start with that.
Start with a fixed dungeon first. Get the game more or less working with a fixed dungeon. Then work on randomly creating them.
I looked at the Moria source way back to see how it did this stuff. Other roguelikes probably do it a similar way....
Moria floods the map with solid rock, then cuts out "rooms" in it semi-randomly. It's like it splits the map into an 8x8 grid and puts at most 1 room in each "cell" of that grid. The total number of rooms on the map is within a certain range. Like 15-30 or something.
There are different kinds of rooms. Some are just rectangular. Some are two rectangles superimposed, some are shaped like a cross with a treasure in the center, some have more enemies and treasures placed in them, etc. Usually the normal rectangular rooms are the most common, and the other kinds of rooms get more common the deeper you go.
After that, each room spawns one or more "hallways" that shoot out in random directions. They pick a direction, move for X spaces (random), then pick a new direction, move for X more spaces, etc.
Hallways extend for a predetermined (possibly random) length, but have a higher chance to end prematurely if they run into another room, or another hallway (increasing the probabilty of a T intersection being formed).
But that's just one way to do it.