maximum treasure amount?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrfy
    Swordsman
    • Jul 2015
    • 328

    maximum treasure amount?

    I've seen this twice now in my several years of Angband dungeoning: "You have found 32767 gold pieces worth of adamantite."

    I'm assuming that 32767 is the maximum amount of treasure you can find at a time? That would make sense if the value is represented by a 16 bit integer.

    What are the odds of finding this amount of treasure?
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2986

    #2
    Originally posted by mrfy
    I've seen this twice now in my several years of Angband dungeoning: "You have found 32767 gold pieces worth of adamantite."

    I'm assuming that 32767 is the maximum amount of treasure you can find at a time? That would make sense if the value is represented by a 16 bit integer.

    What are the odds of finding this amount of treasure?
    Probably not that low if you find a hydra pit and kill them all in the same corner.
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

    Comment

    • hein
      Rookie
      • Jul 2015
      • 14

      #3
      Originally posted by PowerWyrm
      Probably not that low if you find a hydra pit and kill them all in the same corner.
      Ive seen this two times too - I´m pretty sure one of them was a drop from a baby dragon, and the other one just some random treasure on the floor - I think this might be an odd bug(?)

      Comment

      • takkaria
        Veteran
        • Apr 2007
        • 1951

        #4
        Originally posted by hein
        Ive seen this two times too - I´m pretty sure one of them was a drop from a baby dragon, and the other one just some random treasure on the floor - I think this might be an odd bug(?)
        It's intentional! In obj-make.c, make_gold():

        Code:
            /* Cap gold at max short (or alternatively make pvals s32b) */
            if (value > SHRT_MAX)
                value = SHRT_MAX;
        This is because the value stored in the savefile is a 16 bit value and is unchanged probably since Moria... it could safely be changed, I think.
        takkaria whispers something about options. -more-

        Comment

        • Derakon
          Prophet
          • Dec 2009
          • 9022

          #5
          Originally posted by takkaria
          It's intentional!
          It's intentional to cap max drop size at 32767, but is it intentional to generate piles that size? Without being in a situation like a hydra pit where multiple piles get combined, that is.

          I'm pretty sure gold drops can get "supercharged" potentially without limit, allowing unusually large gold drops from ordinary enemies, but unless the supercharging is really strongly exponential, you'd expect to see drop sizes in the 5k+, 10k+, and 20k+ range. Which you don't, really -- you just see normal-sized gold drops, and the exceptionally rare 32767 drop. I've seen exactly one of those, that I can recall, though I don't remember the context.

          Comment

          • Carnivean
            Knight
            • Sep 2013
            • 527

            #6
            I suspect that the adamantite multiplier boosts it to that level. I've gotten it a few times, and I'd be fairly sure it's adamantite each time.

            Comment

            • takkaria
              Veteran
              • Apr 2007
              • 1951

              #7
              Originally posted by Derakon
              It's intentional to cap max drop size at 32767, but is it intentional to generate piles that size? Without being in a situation like a hydra pit where multiple piles get combined, that is.

              I'm pretty sure gold drops can get "supercharged" potentially without limit, allowing unusually large gold drops from ordinary enemies, but unless the supercharging is really strongly exponential, you'd expect to see drop sizes in the 5k+, 10k+, and 20k+ range. Which you don't, really -- you just see normal-sized gold drops, and the exceptionally rare 32767 drop. I've seen exactly one of those, that I can recall, though I don't remember the context.
              Hm, yeah, I see your point. The supercharging has a 1% chance of happening (and if it happens, it has another 1% chance of happening etc) and it should limit itself so it never reaches MAX_SHORT. So I have no idea what's going on here.
              takkaria whispers something about options. -more-

              Comment

              • MattB
                Veteran
                • Mar 2013
                • 1214

                #8
                I'm pretty sure I've had exactly 32000 quite a few times. How does that work?
                (Or am I going stark raving mad??)

                Comment

                • Derakon
                  Prophet
                  • Dec 2009
                  • 9022

                  #9
                  Originally posted by Carnivean
                  I suspect that the adamantite multiplier boosts it to that level. I've gotten it a few times, and I'd be fairly sure it's adamantite each time.
                  If I recall correctly, the quantity of money determines the material used, not the other way around. In other words, the game decides to generate 583 money, then looks up the various ranges and determines that it should use "rubies" as the descriptor, say.

                  Comment

                  • Nick
                    Vanilla maintainer
                    • Apr 2007
                    • 9637

                    #10
                    Originally posted by Derakon
                    If I recall correctly, the quantity of money determines the material used, not the other way around. In other words, the game decides to generate 583 money, then looks up the various ranges and determines that it should use "rubies" as the descriptor, say.
                    Yeah, that's right. I'll file this as a bug.
                    One for the Dark Lord on his dark throne
                    In the Land of Mordor where the Shadows lie.

                    Comment

                    • old_school
                      Scout
                      • Nov 2010
                      • 26

                      #11
                      Ha!! Last Wed, 09/16/2016 I found 32,767 from a Cave troll drop no less.
                      I had already moved from south to north of where I'm standing to kill the Cave troll, therefore, the floor behind me, to the south was empty. When the troll died, Adamantite dropped south of me. It would have been nice earlier in the game, but it helped out none the less...
                      bja
                      Attached Files

                      Comment

                      • PowerWyrm
                        Prophet
                        • Apr 2008
                        • 2986

                        #12
                        This really sounds like a bug, probably an integer underflow (trying to generate negative gold?)
                        PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

                        Comment

                        • Pete Mack
                          Prophet
                          • Apr 2007
                          • 6883

                          #13
                          No, it is not a bug. Gold is u16b not s16b. There is a tiny chance of getting a maximum drop

                          Comment

                          • Nick
                            Vanilla maintainer
                            • Apr 2007
                            • 9637

                            #14
                            OK, I've decided this is probably not a bug. Calculation is:
                            Code:
                            Dungeon level is L
                            Average drop is A = (18 * L)/10 + 18
                            Pick a random value V where A - L - 10 <= V <= A + L + 10
                            Repeat
                              1 in a 100 times, if we haven't hit the maximum, [B]multiply by 10[/B]
                            until it fails
                            If no selling, multiply by the smaller of 5 and L
                            Reduce to the max if necessary
                            In the Cave Troll example below, L is 46, so A is 101 (near enough), and we are picking V between 45 and 157. So if it passes the 1 in 100 check twice, it's between 4500 and 15700, and you still get to multiply by 5 for no selling, which puts you over the maximum provided the original value was 70+. It's a 1 in 10000-ish event, but if you play enough you'll see those.

                            As for seeing exactly 32000 - round numbers are more likely for large values because you're multiplying by 5 and some 10s.
                            One for the Dark Lord on his dark throne
                            In the Land of Mordor where the Shadows lie.

                            Comment

                            • Derakon
                              Prophet
                              • Dec 2009
                              • 9022

                              #15
                              Originally posted by Nick
                              OK, I've decided this is probably not a bug. Calculation is:
                              Code:
                                1 in a 100 times, if we haven't hit the maximum, [B]multiply by 10[/B]
                              .
                              Wow, yeah, okay. I thought the supercharge was a mere doubling, but if it's a factor of 10 increase, then hitting the cap becomes an awful lot more common.

                              What d'you say to making cash drops be unsigned so the cap is higher?

                              Comment

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