Comments on themed level gen part 1 - interesting rooms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wobbly
    Prophet
    • May 2012
    • 2633

    Comments on themed level gen part 1 - interesting rooms

    You know when I look through vaults.txt I'm seeing a lot of this:

    min-depth:0
    max-depth:0

    but occasionally not. occasionally I see this:

    Code:
    name:Little eruption
    type:Interesting room
    rating:0
    rows:10
    columns:18
    min-depth:6
    max-depth:35
    D:   %%%%%%%%%%%%%%%
    D:%%%%*.:..u:.#...:%
    D:%:##.u.:.#.uu```.%
    D:%#`#:.u:```:`u..:%
    D:%`##.#*`````:u#:.%
    D:%%````````:`*..::%
    D: %u.:`u.*:#.`.:##%
    D: %%#.`..#:uu`...#%
    D:  %:`:::.#:..:%%%%
    D:  %%%%%%%%%%%%%   
    
    name:Little eruption+
    type:Interesting room
    rating:0
    rows:10
    columns:18
    min-depth:45
    max-depth:0
    D:   %%%%%%%%%%%%%%%
    D:%%%%*.:..U:.#...:%
    D:%:##...:.#..U```.%
    D:%#`#:.U:```:`U..:%
    D:%`##.#*`````:.#:.%
    D:%%````````:`*.U::%
    D: %U.:`U.*:#.`.:##%
    D: %%#.`..#:U.`U..#%
    D:  %:`:::.#:..:%%%%
    D:  %%%%%%%%%%%%%
    I'm sure people who are playing a lot recognize these 2 along with the rough level at which they appear. These have a slightly different aesthetic to a lot of the other V rooms & appear within specific level ranges. It is my feeling that this is an under-utilized trick for adding variety into the dungeon.
  • wobbly
    Prophet
    • May 2012
    • 2633

    #2
    Comments on themed level gen part 2 - multiple runs of monster placement

    Following is part of the level gen code in coffee-band. The actual numbers are not necessarily good yet, I'm just presenting the idea. For those familiar with the code you can probably see that a chunk of it is just a copy of the Moria-level gen.

    First it does a normal run placing monster. Then it does a 2nd run placing monsters to theme. In the following it uses the "Tolkienizer" which is set in (pits.txt). Finally it does a 3rd run placing to a 2nd theme, in this case the moria-themed level set.

    Code:
    /* Pick a base number of monsters */
        i = z_info->level_monster_min + randint1(8 + k);
    
    	/* Remove all monster restrictions. */
    	mon_restrict(NULL, c->depth, true);
    
        /* Put some monsters in the dungeon */
        for (; i > 0; i--)
    		pick_and_place_distant_monster(c, p, 0, true, c->depth);
    
        /* Extras - MC */
    	mon_restrict("Tolkienizer", c->depth, true);
    
         /* Pick a base number of monsters */
       	  i = MIN(((c->depth / 5) + 3), ((z_info->level_monster_min) - (player->state.skills[SKILL_STEALTH] / 3)));
    
        /* Put some monsters in the dungeon */
        for (; i > 0; i--)
    		pick_and_place_distant_monster(c, p, 0, true, c->depth);
    
    	/* Remove our restrictions. */
    	(void) mon_restrict(NULL, c->depth, false);
    
    /* Extras - MC */
    	mon_restrict("Moria dwellers", c->depth, true);
    
         /* Pick a base number of monsters */
       i = (c->depth / 5) + 2;
    
        /* Put some monsters in the dungeon */
        for (; i > 0; i--)
    		pick_and_place_distant_monster(c, p, 0, true, c->depth);
    
    	/* Remove our restrictions. */
    	(void) mon_restrict(NULL, c->depth, false);

    Comment

    • wobbly
      Prophet
      • May 2012
      • 2633

      #3
      So I'm not sure if anyone is interested in this stuff but perhaps I'll prattle a bit while I'm playing around, just in case.

      It would seem that in interesting rooms for monster placement I can do:

      Some no. - random monster by depth
      c - monster_restrict(centipede)

      but not:
      some symbol - monster_restrict(pitname)

      This seems a loss? I can see a centipede nest which could be a creepy crawler nest for instance.

      Item-wise I think(have to double check):
      ? - scroll works (maybe)
      " - amulet doesn't

      This is ruining a gag in my own variant where cpb quest rewards are floor items. For instance there's a bow in Ap room but the parser treats it as an empty square.

      So there's stuff here that just works & some stuff here that might be nice to have working.

      Comment

      • Nick
        Vanilla maintainer
        • Apr 2007
        • 9647

        #4
        Most of the credit for this goes to Leon Marrick and Bahman Rabii, the Oangband creators.

        Originally posted by wobbly
        It would seem that in interesting rooms for monster placement I can do:

        Some no. - random monster by depth
        c - monster_restrict(centipede)

        but not:
        some symbol - monster_restrict(pitname)

        This seems a loss? I can see a centipede nest which could be a creepy crawler nest for instance.

        Item-wise I think(have to double check):
        ? - scroll works (maybe)
        " - amulet doesn't

        This is ruining a gag in my own variant where cpb quest rewards are floor items. For instance there's a bow in Ap room but the parser treats it as an empty square.

        So there's stuff here that just works & some stuff here that might be nice to have working.
        If you look at the top of vault.txt there's a key for what you can use.
        One for the Dark Lord on his dark throne
        In the Land of Mordor where the Shadows lie.

        Comment

        • wobbly
          Prophet
          • May 2012
          • 2633

          #5
          True & it's quite useful. However if I wasn't on my phone I'd be a smart arse & quote you back at yourself. "code documentation is not up to date". Take a look at little eruption in the 1st post. Is lava in the key? What about 'u'. It's obvious that there are undocumented symbols that work. Which do & don't are unclear without looking at code underneath.

          Go down to room_template. This also has a key. Template rooms are 1,2 & 3 in dungeon_profile.txt. I can't work out from the key how they are differentiated.

          For reference I'm not complaining. It's a matter of if there are things that work not in the key and someone says "there's a key", I'm going to say "key's incomplete".

          Comment

          • Pete Mack
            Prophet
            • Apr 2007
            • 6883

            #6
            Q: in what file is the vault.txt parser/assembler defined?

            Comment

            • Nick
              Vanilla maintainer
              • Apr 2007
              • 9647

              #7
              Originally posted by wobbly
              True & it's quite useful. However if I wasn't on my phone I'd be a smart arse & quote you back at yourself. "code documentation is not up to date".
              Just as well you're on your phone, then

              Originally posted by wobbly
              Take a look at little eruption in the 1st post. Is lava in the key? What about 'u'. It's obvious that there are undocumented symbols that work. Which do & don't are unclear without looking at code underneath.
              Yes, correct - '`' is lava, and monsters (aside from mimics) can be placed using their glyph from monster_base.txt.

              Note that with monsters and specific objects, placement may fail if there's nothing of appropriate depth.

              Originally posted by wobbly
              Go down to room_template. This also has a key. Template rooms are 1,2 & 3 in dungeon_profile.txt. I can't work out from the key how they are differentiated.
              Yeah, IIRC Nomad suggested at one point having different types of template room, so we put facility for three in there, but currently they're all type 1.

              Originally posted by Pete Mack
              Q: in what file is the vault.txt parser/assembler defined?
              generate.c has the file parsing, but more informative is gen-room.c (build_room_template() and build_vault()) which turn the strings into actual vault contents.
              One for the Dark Lord on his dark throne
              In the Land of Mordor where the Shadows lie.

              Comment

              • Pete Mack
                Prophet
                • Apr 2007
                • 6883

                #8
                On the vault generation code, it looks like the amulet code is already there and is identical to the ring code, so I don't see why they won't get generated. BTW: here is another ugly if else stack, with the action taken identical except for a couple constants (the letter and the ovject type.) Just sayin'.

                Comment

                • wobbly
                  Prophet
                  • May 2012
                  • 2633

                  #9
                  Thanks to the both of you.

                  It looks like amulets are 1 in 4 chance, though I might just be misinterpreting that, I'll look at closer later. There's also stuff in that room that can pickup items, so there's a bunch of things that could of caused it not to be there.

                  The bow it seems can't be called directly. It's | (weapon) then 1 in 4 chance of bow. & I guess I now know , does food rather then mushroom patches.

                  Re: Ugly long if/thens - quite possibly, though from my perspective it's easier to read then a more compact format.

                  Comment

                  • Pete Mack
                    Prophet
                    • Apr 2007
                    • 6883

                    #10
                    In a more compact format, there would nust be an zero-terminated array of the objects and associated symbol that are valid. Then a bit of special purpose code for weapon/bow creation. It is standard object-oriented technique in non-OO languages, and it is a lot easier to read. Monster if-else statements are a pain to read. Array initialization is a lot easier to read quickly, and then you don't actually need to read the code at all to see what is happening.

                    Comment

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