Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Vanilla (http://angband.oook.cz/forum/forumdisplay.php?f=3)
-   -   something's wrong with The One Ring (http://angband.oook.cz/forum/showthread.php?t=11268)

Sky June 28, 2022 22:58

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?

Nick June 29, 2022 00:35

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?

PowerWyrm June 29, 2022 08:42

Quote:

Originally Posted by Sky (Post 158871)
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.

Sky June 29, 2022 18:58

Quote:

Originally Posted by Nick (Post 158872)
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.

sffp June 29, 2022 22:54

I have never found this ring

Nick June 30, 2022 01:00

Quote:

Originally Posted by Nick (Post 158872)
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.

backwardsEric June 30, 2022 05:37

Quote:

Originally Posted by Nick (Post 158880)
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.

backwardsEric June 30, 2022 06:02

Quote:

Originally Posted by backwardsEric (Post 158881)
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).

PowerWyrm June 30, 2022 08:51

Quote:

Originally Posted by backwardsEric (Post 158882)
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().

Thraalbee June 30, 2022 11:30

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?


All times are GMT +1. The time now is 20:49.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.