## Thursday, October 17, 2019

### RDG 2.0: Substructures and Superstructures

Continuing my thoughts on random dungeon algorithms: the first three steps on my list deal with nested structures. To explain this better, let’s start with a typical substructure generated on Step 2 and filled in on Step 3. This would be a network of intersecting tunnels. In earlier posts, I suggested using letters (“leximorphs”) to define the tunnel structure. I think this is possible as a computer algorithm, but it would be tricky. You’d have to define a two-dimensional array, where each array location is a list of one or more connections.

But a simpler algorithm might be better. Assume there are six main hypothetical tunnels in a structure:
• three aligned more-or-less North-South (left, center, right;)
• three aligned more-or-less East-West (top, middle, bottom.)
 hypothetical tunnel structure

This defines nine hypothetical four-way intersections. Rolling for each direction at every intersection would mean 36 rolls, a tedious task for a human… but nothing for a computer. Roll 2d6 on the following chart, keeping track of doubles:

2d6 This Direction Leads to a…
2 blocked or collapsed tunnel
3-4 door to tunnel (or room if double 2s rolled)
5-7 wall (secret door on double 3s, roll again)
8 tunnel continues (or room on double 4s)
9-12 stairs down (ladder on 5+ on 1d6) roll again
change direction to “up” on double 5s or 6s

Two of the results – secret doors and stairs/ladder – require a reroll to see where they lead. Stairs/ladder also require a 1d6 roll to determine which kind, with stairs being more likely.

Because of the way we start with a grid of interconnecting tunnels, there are loops built into the dungeon structure. The rolls close off some directions, but some areas of the dungeon will still have loops, allowing multiple routes to reach the same area. When we get to room generation, room exits can generate additional tunnels as well, which can further complicate the structure. This is good. This is a Jaquayed dungeon structure.

Now let’s back up to Step 1. We roll for structure here, too. This is more like a superstructure. It’s basically the same process, except the tunnels are assumed to be longer, and each “room” is actually a substructure, its own network of 36 potential intersections, with a tunnel from the superstructure connecting to one of the outside intersections. If Step 2 generates a dungeon, Step 1 generates a dungeon of dungeons. A megadungeon, if you will. The loops built into the superstructure will enable multiple routes to specific dungeons – call them sublevels, or dungeon nodes. If a route through a particular dungeon seems too dangerous, it may be possible for adventurers to get around the danger via one or more other dungeons.

And it gets more complicated, once we start talking about themes and room clusters. But I better reserve that for another post.