something's wrong with The One Ring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sky
    Veteran
    • Oct 2016
    • 2321

    something's wrong with The One Ring

    i have noticed that The One Ring consistently generates very mild level feelings.
    I have just found it in a undead pit at DL98 with a LF 6-6.

    A Dragon Armour will generate a LF x-8 and a good RoP will be x-9.
    PDSM is LF x-9.

    Dragon Armours have a power of 500-700, The One Ring has a power of 1.4M; is this some sort of bit-wraparound problem?
    "i can take this dracolich"
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9637

    #2
    The object rating is a 32-bit integer, so that shouldn't be causing a wrap problem. Was it lying on the floor, or dropped by a monster?
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • PowerWyrm
      Prophet
      • Apr 2008
      • 2986

      #3
      Originally posted by Sky
      The One Ring has a power of 1.4M; is this some sort of bit-wraparound problem?
      I think that's normal because the One Ring has multiple sets of abilities (like all immunities or all abilities) that trigger some INHIBIT_POWER numbers which multiply themselves. There must be an integer overflow in the object feeling code instead.

      Edit: I checked my variant and the One Ring has a power of 20000 which is exactly INHIBIT_POWER, so indeed it's a bug in power calculation.
      Last edited by PowerWyrm; June 29, 2022, 08:47.
      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

      • Sky
        Veteran
        • Oct 2016
        • 2321

        #4
        Originally posted by Nick
        The object rating is a 32-bit integer, so that shouldn't be causing a wrap problem. Was it lying on the floor, or dropped by a monster?
        nope, on the ground. "in a pit".
        d) the Ring of Power 'The One Ring' (+15,+15) <+5>
        Found lying on the floor in a pit at 4900 feet (level 98)

        it wasn't just this once, i've found it 4 times since, well, my last visits, and every time i noticed it was a LF x-7, this time, it was LF 6-6 !

        You had mentioned that level feelings are just the amount of money (as in, value of the items) that's on the ground so i thought, maybe they are capped at 30k as in the shops. Maybe thats why a big vault full of random egos has a higher value.
        "i can take this dracolich"

        Comment

        • sffp
          Swordsman
          • Apr 2020
          • 434

          #5
          I have never found this ring

          Comment

          • Nick
            Vanilla maintainer
            • Apr 2007
            • 9637

            #6
            Originally posted by Nick
            The object rating is a 32-bit integer, so that shouldn't be causing a wrap problem.
            Well, that comment aged poorly. Luckily backwardsEric has done a fix, it will be in the dev builds soon.
            One for the Dark Lord on his dark throne
            In the Land of Mordor where the Shadows lie.

            Comment

            • backwardsEric
              Knight
              • Aug 2019
              • 527

              #7
              Originally posted by Nick
              Well, that comment aged poorly. Luckily backwardsEric has done a fix, it will be in the dev builds soon.
              That change probably isn't good enough. As PowerWyrm said, it's likely an issue in the object_value_real() calculation; its return value is an int, which will be a 16-bit type when compiling for win32, and that won't be enough to hold the value of the plain gold ring.

              Comment

              • backwardsEric
                Knight
                • Aug 2019
                • 527

                #8
                Originally posted by backwardsEric
                That change probably isn't good enough. As PowerWyrm said, it's likely an issue in the object_value_real() calculation; its return value is an int, which will be a 16-bit type when compiling for win32, and that won't be enough to hold the value of the plain gold ring.
                I take that back, int is a 32-bit type on win32; and object_value_real() for the plain gold ring returns 1682025150 when the Windows front end is run under Wine. I'm still a bit doubtful that the other floor objects would add enough to the rating to cause an overflow (the plain gold ring's contribution is capped at 25000 * 25000 = 625000000; would need ~6 times that from the other objects to overflow a uint32_t).

                Comment

                • PowerWyrm
                  Prophet
                  • Apr 2008
                  • 2986

                  #9
                  Originally posted by backwardsEric
                  object_value_real() for the plain gold ring returns 1682025150
                  In my variant which is based off V, when I put a debug breakpoint on object_value_real() for the One Ring, I get 400100000 from a base power of 20000. If like OP said the V power for the One Ring is 1400000, there will be an overflow in object_value_real() since you get value = a * power * power + b * power with a = 1 and b = 5 and power = 1400000 -> value = 1 960 007 000 000, which turns into 1 501 913 024 after fitting into an int32.

                  So the bug in indeed in object_power().
                  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

                  • Thraalbee
                    Knight
                    • Sep 2010
                    • 707

                    #10
                    Maybe you are looking at this the wrong way. Are you sure you are in control? Have you considered the option that if the ring finds @ unattractive it projects low value?

                    Comment

                    • backwardsEric
                      Knight
                      • Aug 2019
                      • 527

                      #11
                      Originally posted by PowerWyrm
                      In my variant which is based off V, when I put a debug breakpoint on object_value_real() for the One Ring, I get 400100000 from a base power of 20000. If like OP said the V power for the One Ring is 1400000, there will be an overflow in object_value_real() since you get value = a * power * power + b * power with a = 1 and b = 5 and power = 1400000 -> value = 1 960 007 000 000, which turns into 1 501 913 024 after fitting into an int32.

                      So the bug in indeed in object_power().
                      In 4.2.4, the object power for the plain gold ring is 41010 so the expression object_value_real() doesn't overflow. In any case, it should be modified to saturate at the maximum to protect against wraparound in case some other change inflates the values from object_power().

                      Comment

                      • Sky
                        Veteran
                        • Oct 2016
                        • 2321

                        #12
                        keep in mind, i'm just reading the power value from the artifact spoiler file. I dont actually know if that is correct.
                        "i can take this dracolich"

                        Comment

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