Limiting out of depth monsters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hajo
    Adept
    • Aug 2010
    • 142

    Limiting out of depth monsters

    I want to limit out of depth monsters, particularly on the early dungeon levels.

    I'm not quite sure if I found the right place, and also not quite sure if my new formula will work as intended. So I want to ask here. I'm Using the Angband 2.9.3 codebase, I hope a few of you will still remember that.

    In the file monster2.c there is a procedure get_mon_num() which calculates a monster number appropriate for the given depth. It has a block:
    Code:
    		/* Occasional "nasty" monster */
    		if (rand_int(NASTY_MON) == 0)
    		{
    			/* Pick a level bonus */
    			int d = level / 4 + 2;
    
    			/* Boost the level */
    			level += ((d < 5) ? d : 5);
    		}
    I have changed this to:

    Code:
    		/* Occasional "nasty" monster */
    		if (rand_int(NASTY_MON) == 0)
    		{
    			/* Pick a level bonus */
    			int d = level / 5;
    
    			/* Boost the level */
    			level += ((d < 5) ? d : 5);
    		}
    The new code should not generate out of depth monsters for the first 5 levels if I understood right. Also have a more shallow curve for generating OOD monsters later. Do you think this will work as intended?
    I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
  • Sirridan
    Knight
    • May 2009
    • 560

    #2
    At level 5 it should generate a one level ood monster, or a level 6.

    Comment

    • Hajo
      Adept
      • Aug 2010
      • 142

      #3
      Right. I started counting at 0, but that is town.

      Right now I wonder if I can diff&patch my changes to Angband 2.9.3 into Angband 3.1.2v2 ... the overall code structure looks similar but I guess a lot of things have changed in between.
      I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem

      Comment

      • RogerN
        Swordsman
        • Jul 2008
        • 308

        #4
        Note that the last line of code ensures that no monsters are ever generated more than 5 levels OOD (I don't think this applies to vaults, though). This means that the formula has no effect after level 25 using your formula (and it has no effect after level 12 using the original formula).

        Comment

        • Hajo
          Adept
          • Aug 2010
          • 142

          #5
          I'm not sure if I follow. The

          level += ((d < 5) ? d : 5);

          limits the level "boost" to at most 5 levels of the nasty monsters. But there can still be 5 level OOD monsters generated after 12 (or 25) levels?
          I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem

          Comment

          • Sirridan
            Knight
            • May 2009
            • 560

            #6
            Originally posted by Hajo
            I'm not sure if I follow. The

            level += ((d < 5) ? d : 5);

            limits the level "boost" to at most 5 levels of the nasty monsters. But there can still be 5 level OOD monsters generated after 12 (or 25) levels?
            No, at 12 you can have a max ood of 2. That line can be rewritten like this, if you find the ternary operator (?) confusing.

            Code:
            if(d < 5)
                level += d;
            else
                level += 5;
            EDIT:

            To be more precise, the level / 5 means that the max ood is one fifth the level, so a level 12 generates up to a 2 OOD monster, where level 25 generates a 5 ood. At level 60, level/5 is 12, but the line of code at the end limits it to 5.

            Comment

            • ekolis
              Knight
              • Apr 2007
              • 921

              #7
              Why not use MIN to be really clear?

              level += MIN(d, 5);
              You read the scroll labeled NOBIMUS UPSCOTI...
              You are surrounded by a stasis field!
              The tengu tries to teleport, but fails!

              Comment

              • Hajo
                Adept
                • Aug 2010
                • 142

                #8
                Originally posted by Sirridan
                To be more precise, the level / 5 means that the max ood is one fifth the level, so a level 12 generates up to a 2 OOD monster, where level 25 generates a 5 ood. At level 60, level/5 is 12, but the line of code at the end limits it to 5.
                Yes. That is quite what I wanted it to do. Sorry if my writing was not clear enough.
                I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem

                Comment

                • zaimoni
                  Knight
                  • Apr 2007
                  • 590

                  #9
                  Originally posted by RogerN
                  Note that the last line of code ensures that no monsters are ever generated more than 5 levels OOD (I don't think this applies to vaults, though). This means that the formula has no effect after level 25 using your formula (and it has no effect after level 12 using the original formula).
                  Actually, there are two level-boosting blocks to be modified; the maximum OOD level boost is the same at DL25 and lower [10].
                  Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
                  Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
                  Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

                  Comment

                  • Hajo
                    Adept
                    • Aug 2010
                    • 142

                    #10
                    In the original code there were two of such blocks directly behind each other, so the level boost could happen twice. Is this what you mean? Or is there a different location in the source that must be adapted too?
                    I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem

                    Comment

                    • zaimoni
                      Knight
                      • Apr 2007
                      • 590

                      #11
                      Originally posted by Hajo
                      In the original code there were two of such blocks directly behind each other, so the level boost could happen twice. Is this what you mean?
                      Yes. I just wanted to make it clear that there was no change in maximum level boost, for those who don't sourcedive.
                      Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
                      Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
                      Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

                      Comment

                      • Timo Pietilä
                        Prophet
                        • Apr 2007
                        • 4096

                        #12
                        Originally posted by RogerN
                        Note that the last line of code ensures that no monsters are ever generated more than 5 levels OOD
                        That can't be right. I just recently encountered AMHD at ~1500' in non-vault room. That's about 10 levels OoD. Something odd in OOD code? Bug? In that same game I got WoG before any other dungeon books. Twice.

                        Comment

                        • Hajo
                          Adept
                          • Aug 2010
                          • 142

                          #13
                          In Angband 2.9.3 there were two of these code blocks behind each other. So there was a small chance that a monster got two 5 level boosts, totaling 10 levels OOD.

                          I haven't checked the current Angband codebase yet to see if this still is this way.
                          I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem

                          Comment

                          • Timo Pietilä
                            Prophet
                            • Apr 2007
                            • 4096

                            #14
                            Originally posted by Hajo
                            In Angband 2.9.3 there were two of these code blocks behind each other. So there was a small chance that a monster got two 5 level boosts, totaling 10 levels OOD.

                            I haven't checked the current Angband codebase yet to see if this still is this way.
                            IMO hard limits for OOD monsters (and items) are not a good idea anyway. Just make it exponentially rarer the more OOD it is. Getting Ancient Red Dragon at 300' every now and then would give a nice spice to playing.

                            Comment

                            • Sirridan
                              Knight
                              • May 2009
                              • 560

                              #15
                              Originally posted by Timo Pietilä
                              IMO hard limits for OOD monsters (and items) are not a good idea anyway. Just make it exponentially rarer the more OOD it is. Getting Ancient Red Dragon at 300' every now and then would make you nice and spicy.
                              Fixed

                              But agreed

                              Comment

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