Making dungeon generation more interesting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nomad
    Knight
    • Sep 2010
    • 958

    Making dungeon generation more interesting

    So, v4 having finally given me the push to figure out how to compile on Windows and start doing some proper coding, this is one of the big things that I'm interested in.

    My current project is implementing loading of room layouts from an edit file, similar to the way vault.txt works, so that rooms of any irregular shape or design can be generated easily and new ones can be added without any coding required. So far I've got this functional but the rooms are a bit sparse; I'm working on ways to be able to add monsters/treasure/traps from the edit file without making the positions as rigidly fixed as in vaults.

    I'm trying to keep things as flexible as possible, to prevent the need for creating many very similar templates for basic variations on the same room. I've managed to implement random doors, and I'm thinking about adding optional walls that are generated 50% of the time, so that a single template would produce multiple possible room layouts, like this:

    Code:
     template                  possible results
    
    D:###1###      ###+###    #######    ###+###    #######
    D:#.....2      #.....#    #.....+    #.....#    #.....+
    D:#.....#      #.....#    #.....#    #.....#    #.....#
    D:#xxxxx#  =>  ####### OR ####### OR #.....# OR #.....#
    D:#.....#      #.....#    #.....#    #.....#    #.....#
    D:2.....#      #.....#    +.....#    #.....#    +.....#
    D:###1###      ###+###    #######    ###+###    #######
    If I can figure out how to duplicate the monster and treasure generation aspects, it should be possible to move all the fixed sized 'special rooms' (i.e., 2x2, checkerboard and other moated rooms) from generate.c to the edit file. Flexible sized rooms like the round ones would still have to be generated in the code though.

    I'm hoping that by the time I've got this done, I'll know enough about what I'm doing to do a similar thing with a layout file for pit designs, so monster pits could appear in different shapes and sizes, and perhaps have different layouts according to type. (e.g., cavern type rooms for animal nests, more structured fortifications for orcs pits, etc.)

    So what other stuff would people like to see done to make levels more interesting? Rooms with themed selections of monsters and/or treasure are certainly something else I'd like to do, but I suspect that's a bit beyond my grasp of the code at the moment...
  • Mikko Lehtinen
    Veteran
    • Sep 2010
    • 1246

    #2
    I've doing something new in the next version of FayAngband.

    Rooms that are adjacent to each other, with touching outer walls, are joined into one. This results in interestingly shaped giant halls.

    (This is even more cool in FayAngband, because I'm going to have themed rooms with furniture.)

    Comment

    • kaypy
      Swordsman
      • May 2009
      • 294

      #3
      Two thoughts:

      Can you make exterior doors use the usual system? Maybe mark appropriate edges as "suitable for external connections" and letting the normal corridor generator do its stuff?

      It might help add variety to have a "stretch this room by copying the previous row/column" mechanism.

      Comment

      • Nomad
        Knight
        • Sep 2010
        • 958

        #4
        Originally posted by kaypy
        Can you make exterior doors use the usual system? Maybe mark appropriate edges as "suitable for external connections" and letting the normal corridor generator do its stuff?
        That's what I've done - I used the same exterior wall symbol as the vault code, and the generator seems to hook up pretty happily, usually with corridors, occasionally with doors. For instance, loading from this template:

        Code:
        D:###############
        D:%.............#
        D:%.............#
        D:##########...##
        D:     ###...### 
        D:   ###...###   
        D: ###...###     
        D:##...##########
        D:#.............%
        D:#.............%
        D:###############
        Got this result:

        Code:
        [TT][BC=black][COLOR=white]
                                                                                        
        [COLOR="#00FFFF"]High-Elf      [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR][COLOR="#00FFFF"]Lord          [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR][COLOR="#00FFFF"]Warrior       [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR]LEVEL     [COLOR="#00FF00"]50  [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR]Exp [COLOR="#FFFF00"]72383137  [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR]AU   [COLOR="#00FF00"]1001986  [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR][COLOR="#606060"]\[/COLOR][COLOR="#804000"]}[/COLOR][COLOR="#008040"]=[/COLOR][COLOR="#00FFFF"]=[/COLOR][COLOR="#804000"]"[/COLOR][COLOR="#C08040"]~[/COLOR][COLOR="#808080"][ [/COLOR][COLOR="#C08040"])     [/COLOR][COLOR="#808080"]#                                                                 
        [/COLOR]Str!  [COLOR="#FFFF00"]18/130 [/COLOR][COLOR="#808080"]:#                                                                 
        [/COLOR]Int!  [COLOR="#FFFF00"]18/100  [/COLOR][COLOR="#808080"]#                %###%%#%%%##[/COLOR]########                             
        Wis!   [COLOR="#FFFF00"]18/20  [/COLOR][COLOR="#808080"]#########%%%##   #            [/COLOR]..[COLOR="#C0C0C0"]][/COLOR]...#                             
        Dex!  [COLOR="#FFFF00"]18/140               [/COLOR][COLOR="#808080"]%   # %%#%        [/COLOR].....#                             
        CON!  [COLOR="#00FF00"]18/130 [/COLOR][COLOR="#808080"]##########%##[/COLOR][COLOR="#FFFF00"]$[/COLOR][COLOR="#808080"]%#### #  #%#######[/COLOR]#@..#[COLOR="#808080"]#                             
        [/COLOR]CHR!  [COLOR="#00FF00"]18/140 [/COLOR][COLOR="#606060"]..[/COLOR][COLOR="#808080"]#         %       %       ###[/COLOR][COLOR="#606060"].[/COLOR]..###                              
                     [COLOR="#606060"]..[/COLOR][COLOR="#808080"]#         #######%%     ###[/COLOR][COLOR="#606060"]..[/COLOR].###                                
        Cur AC    [COLOR="#00FF00"]60 [/COLOR][COLOR="#606060"]..[/COLOR][COLOR="#808080"]#                     ###[/COLOR][COLOR="#606060"].[/COLOR][COLOR="#C08040"]][/COLOR][COLOR="#606060"].[/COLOR]#[COLOR="#808080"]##                                  
        [/COLOR]HP  [COLOR="#00FF00"]876[/COLOR]/ [COLOR="#00FF00"]876 [/COLOR][COLOR="#606060"]..[/COLOR][COLOR="#808080"]#                    ##[/COLOR][COLOR="#606060"]...[/COLOR][COLOR="#808080"]#############                          
                     ###                    #[/COLOR][COLOR="#606060"].............[/COLOR][COLOR="#C08040"]'[/COLOR][COLOR="#606060"]..[/COLOR][COLOR="#808080"]#                          
                                            #[/COLOR][COLOR="#606060"].............[/COLOR][COLOR="#808080"]##[/COLOR][COLOR="#606060"].[/COLOR][COLOR="#808080"]#                          
                                            ################[/COLOR][COLOR="#606060"].[/COLOR][COLOR="#808080"]#                          
                     ###            %##########            #[/COLOR][COLOR="#606060"].[/COLOR][COLOR="#808080"]#                          
                     [/COLOR][COLOR="#606060"]..[/COLOR][COLOR="#808080"]#            %[/COLOR][COLOR="#606060"].........[/COLOR][COLOR="#808080"]#            #[/COLOR][COLOR="#606060"].[/COLOR][COLOR="#808080"]#    ###                   
                     #[/COLOR][COLOR="#606060"].[/COLOR][COLOR="#808080"]#########   %#[/COLOR][COLOR="#606060"].........[/COLOR][COLOR="#808080"]##############[/COLOR][COLOR="#C08040"]'[/COLOR][COLOR="#808080"]###### #                   
        [/COLOR]2050' (L41)                                                                     
        [/COLOR][/BC][/TT]
        I don't really understand how the corridor generator works, and fear to poke it, but it seems to do its best to connect to one of the allowed squares, occasionally giving up and breaking a different wall if it really can't. (The fix would probably be to make every templated room a moated room, but that's a bit dull and limits the possible room size, so I've decided to consider occasional strange corridor placement more feature than bug. Hey, it adds variety.)

        Originally posted by kaypy
        It might help add variety to have a "stretch this room by copying the previous row/column" mechanism.
        That's a neat idea, but I'm not sure it would be workable with how the code translates text files into rooms. It starts with fixed dimensions specified in the edit file, defines that as a room, and then steps through individual squares one by one, so doubling on rows or columns would probably introduce more complexity than it's worth. (Plus the max sizes for rooms are defined by dungeon blocks to try and avoid parts of them being off-screen, so stretching them beyond the current 11x33 maximum could create issues.)

        One wild idea I did have, though, is the idea of creating randomised lesser vaults from these room layouts. It probably wouldn't be too hard to give each room a suitability rating (to define whether it should be used as a base for random vaults - open cavern type rooms like the zed room above shouldn't - and decide risk/reward level) and step through the squares adding monsters and a random chance of traps or treasure based on crunching those numbers for existing vaults. Not sure how successful that idea would be, but it might be an interesting thing to try out.

        Comment

        • d_m
          Angband Devteam member
          • Aug 2008
          • 1517

          #5
          So I have a bit of time to poke around at your code (and hopefully merge it to v4) but I thought I'd quickly clarify corridor generation.

          There are two different mechanisms for generating corridors.

          1. The original Angband corridor generator. I haven't really modified this code yet. It respects % versus #, tries to turn in interesting directions, and can sometimes accidentally connect rooms with itself.

          2. The code for ensuring dungeon connectedness. I wrote this to use with caverns, and have plugged it into the end of generation as a failsafe. It does not respect things like % versus # and doesn't really worry about "messing up" the way rooms look. It's goal is to connect all floor tiles, with a few exceptions to keep from messing up vaults.

          Hope this clarifies things a bit. I think there is room for improving #1 so it produces better (or at least different) kinds of hallways, and there is also probably room for improving #2 so that it pays a bit more attention to room types.
          linux->xterm->screen->pmacs

          Comment

          • Nomad
            Knight
            • Sep 2010
            • 958

            #6
            Originally posted by d_m
            2. The code for ensuring dungeon connectedness. I wrote this to use with caverns, and have plugged it into the end of generation as a failsafe. It does not respect things like % versus # and doesn't really worry about "messing up" the way rooms look. It's goal is to connect all floor tiles, with a few exceptions to keep from messing up vaults.
            Ah, that makes a lot of sense, thanks. I did wonder how the generation process was smart enough to scrap the rules when they weren't working.

            Comment

            Working...
            😀
            😂
            🥰
            😘
            🤢
            😎
            😞
            😡
            👍
            👎