Pages

Wednesday, October 16, 2019

RDG: Thoughts on Computer-Generated Sublevels

Alex Schroeder let me know in a comment on yesterday’s random dungeon post that he’s looking for additional dungeon generation algorithms for Text Mapper. The method I described in that post was really aimed at being simple and easy to remember for humans. What would I do if I were exploiting computer power instead? What does Text Mapper actually need?

The 5- and 7-room dungeon algorithms are already pretty good for mini-dungeons. One thing I noted, though, is that it rarely creates a Jaquayed dungeon, as Jason Alexander describes. The structure is almost always linear with maybe one or two dead-end branches, although I did get two 7-room dungeons with internal loops after several reloads. And since they are mini-dungeons, there’s an obvious underrepresented dungeon type: megadungeons, or at least sprawling underworlds. I did do a couple old posts about random dungeon generators and non-linear dungeon generation, although I think they are unusable for a computer algorithm in their current state. Still, there’s the seed of a couple ideas for new additions to Text Mapper: an underworld wilderness map, a ruined underworld city generator, and a themed dungeon sublevel generator used as part of the underworld city generator or by itself to generate a mid-sized dungeon.

Here are some hypothetical steps we could take for the third and most important generator:

  1. Start at the Top. Randomly select a theme and basic tunnel structure that includes loops and nodes.
  2. Each Node is a Substructure. Generate a more specific theme within a node and its own tunnel structure with loops and subnodes in the same way as Step 1.
  3. Each SubNode is Either a Room or a Room Cluster. Theme determines which (Mazes tend to be more tunnels and isolated rooms, Tombs are like Mazes but with tunnels connecting room clusters, Ruins have more room clusters, and Fortified Areas have shorter, fewer tunnels.)
  4. Generate a Room Shape and Exits.
  5. Select Room Theme. For example, Storeroom, Torture Chamber, Kitchen. Specific theme from Step 2 determines list of room themes to select from. Room Theme specifies general room contents, including containers present.
  6. Add Room Occupant, if any. Determine if occupant starts in a hidden state and what the trigger is (vermin can emerge from crates if disturbed. Spirits can be summoned by touching a holy/cursed object.)
  7. Add Container Contents, including possible treasure.
  8. Add Secrets, including secret exits or containers.
  9. Repeat Steps 4 to 6 for Each Room until SubNode is complete.
  10. Repeat Step 3 and following steps for next SubNode until all SubNodes in the Node are finished.
  11. Repeat Step 2 and following steps for the next Node until all Nodes are finished.

Creative Commons license

This work is licensed under a Creative Commons
Attribution-NonCommercial-ShareAlike 4.0
International

(CC BY-NC-SA 4.0) license.

6 comments:

  1. I've been thinking along the lines of Step 1 a lot lately. I keep thinking if you started with a bunch of Kanji letters and picked one or two for a dungeon level.

    The letters would be tunnels with each intersection being a node where you could plop rooms or groups of room. If you rotate the letters you could have a pretty wide variety of semi-Jaquayed blocks to work with. For bonus points your dungeon could actually spell out something for a Japanese audience.

    Anyway, its' just a half-formed idea at this point. Anyone that can make it work can run with it.

    ReplyDelete
    Replies
    1. > I've been thinking along the lines of Step 1 a lot lately. I keep thinking if you started with a bunch of Kanji letters and picked one or two for a dungeon level.

      Yep. I did that a bit with the Roman alphabet. There was a whole series on what I called "leximorphs", which I won't link to... but a more recent and relevant example would be this post from the Jaquayed dungeon series on "pre-loaded" non-linear dungeons:

      https://9and30kingdoms.blogspot.com/2017/04/pre-loading-random-non-linear-dungeons.html

      I mainly link to that one because it has some tables that might be useful.

      Delete
    2. I very much like the way the pre-loading-random-non-linear-dungeons.html work. Thanks for the link.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. A while ago I wrote a different megadungeon generator that produced output to seed a multi-level Gridmapper dungeon and wrote a blog post about it.
    It basically tries to assign probabilities for what could come next (there's images of my handwritten notes on the blog post). All I can say is that the maps created by the algorithm aren't great. I do like the bitmap previews, though. They really show the dungeon as it slowly grows with each iteration.
    https://alexschroeder.ch/wiki/2017-06-26_Megadungeon_Generator

    ReplyDelete
    Replies
    1. I vaguely remember seeing this post before. RDG algorithms that make good results are hard! I think a lot is going to depend on (1) random themes that alter the way a dungeon or section of dungeon looks, and (2) separate the generation stages for the shape of a room's outside from the contents of the room's inside, with the latter stage being basically a roll on a table of random room types that fit the dungeon theme decided in #1. So, if you are generating a tomb, the room types will be things like main burial chamber, servant burial chamber, chambers for grave goods of different kinds, corpse preparation chamber, mason's work chamber.

      Delete