Live data from Hacker News

Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

reddit.com

81–90 of 267 posts

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#81
post #70
post #59

Earlier quoted context omitted.

You haven’t thought it through yet. In this case, HP _is_ an integer, and so is the MaxHP for the unit type. And yet the bug still occurs! Storing the HP as an integer does not prevent the problem from ever occurring, because fundamentally the user still expects HP to be proportional. That is, suppose a unit is sitting there at full health, and you research a tech that increases that unit’s max hp? Should the unit no…

>That is, suppose a unit is sitting there at full health, and you research a tech that increases that unit’s max hp? Should the unit now be at less than full health, as if it had been in combat? Users probably don’t like that. >Suppose it is at full health, and then it gets downgraded to a type with less maximum health. Does it stay at it’s current HP? Users probably won’t like being attacked with supercharged units…

Sure, if you fully predict all bugs in advance and compensate for them, nothing is complex, but that's not really feasible.

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#82

It’s great that Microsoft are still actively maintaining a ~24 year old game! Blizzard ought to take note. A few years back they announced “Warcraft 3 reforged” with great fanfare: a remastered version of the classic Warcraft 3, updated for modern systems with improved graphics etc. It looked/sounded fantastic! But despite it being a paid upgrade, what they released was a buggy mess that did little justice to the cla…

It's actually worse, they pulled the legacy version from the users and forced the (effectively) downgraded version to everyone. Even the owners of the legacy version were shafted as they forced a update which removed much of the functionality of the legacy version. To this date still the best version was the pre-patch one for everyone who has the original installers and the latest pre-upgrade patch

I'm surprised this isn't illegal.

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#83
post #53
post #51

Earlier quoted context omitted.

> and Java's lack of operator overloading makes this even more painful Why?

Because you can't make your own types that work better.

Of course you can. You just can't use operators for them.

Unless you go Haskell where anything can be an operator name, operators are just a minor convenience hack .

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#84

Earlier quoted context omitted.

Seems all that could have been avoided by using rationals in general and the condition for living being >0 instead of dying The more I write code, the more I notice how rarely one truly should want floats in most kinds of programs and how they almost always carry a whole bag of problems with them.

The trouble you have is that you really wanted reals and the rationals are not a much better substitute than the floats (which are mostly just one particularly specialised flavour of rational) It doesn't feel immediately like there ought to be a problem, but witness, mathematically almost all of the reals are Normal and unfortunately Normal doesn't mean "normal" it's a technical mathematical word, that for our purpos…

Algebraics plus pi avoid almost all the concern you mention, but still have the same problem for software. All those nasty reals are unreachable by your program.

The actual problems with irrationals is that it is extremely hard to measure their size without converting to rational approximation, so you are back to the original problem.

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#85

Earlier quoted context omitted.

Seems all that could have been avoided by using rationals in general and the condition for living being >0 instead of dying The more I write code, the more I notice how rarely one truly should want floats in most kinds of programs and how they almost always carry a whole bag of problems with them.

Rationals fail in their own spectacular ways. Take a simple approximate exponential decay: x ← (99/100) * x. In exact rational arithmetic, your program will happily calculate integers (99^k) and (100^k) for unboundedly large values of k (there's no reduction – they're all coprime), grinding the program to a halt until it runs out of memory. "Oh, the solution is obvious: you should simply round that to an approximate…

The difference is, that with rationals you do not lose any precision on the way. I doubt, that 99^k is part of AoE2 code. For the simple calculations in AoE2 regarding unit health, rationals will do a fine job. With rationals the rounding does not happen during the precise calculation. It happens explicitly, only once, at the end of the calculation, at the programmer's wish and conscious decision, thereby avoiding the kind of issue we see here.

Rationals might not be the solve all problems type, but here they seem very applicable.

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#86

It’s great that Microsoft are still actively maintaining a ~24 year old game! Blizzard ought to take note. A few years back they announced “Warcraft 3 reforged” with great fanfare: a remastered version of the classic Warcraft 3, updated for modern systems with improved graphics etc. It looked/sounded fantastic! But despite it being a paid upgrade, what they released was a buggy mess that did little justice to the cla…

It's actually worse, they pulled the legacy version from the users and forced the (effectively) downgraded version to everyone. Even the owners of the legacy version were shafted as they forced a update which removed much of the functionality of the legacy version. To this date still the best version was the pre-patch one for everyone who has the original installers and the latest pre-upgrade patch

This kind of crap is actually why I will not buy Diablo 4 (even though I kinda want to, to have a good hack'n'slash on my PS5) or put money into any Blizzard game anymore.

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#88

I don’t understand why they didn’t just use an integer. You can’t have half a HP in AoE and nothing has HP so high that it would overflow a 32 bit integer. Seems like it would avoid a lot of problems.

Afaiu there are compounding factors like 1.5 here and 1.5 there should result in 2.25 and so on

Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic

#90
post #70
post #59

Earlier quoted context omitted.

You haven’t thought it through yet. In this case, HP _is_ an integer, and so is the MaxHP for the unit type. And yet the bug still occurs! Storing the HP as an integer does not prevent the problem from ever occurring, because fundamentally the user still expects HP to be proportional. That is, suppose a unit is sitting there at full health, and you research a tech that increases that unit’s max hp? Should the unit no…

>That is, suppose a unit is sitting there at full health, and you research a tech that increases that unit’s max hp? Should the unit now be at less than full health, as if it had been in combat? Users probably don’t like that. >Suppose it is at full health, and then it gets downgraded to a type with less maximum health. Does it stay at it’s current HP? Users probably won’t like being attacked with supercharged units…

Not exactly complex, but you posted too quickly to have found the best solution.

A better solution is to kill the unit when it drops below zero HP, not when it drops below 1.0; scaling will never move the current HP past zero in either direction. Having 0.9999994 HP instead of 1.0 HP would not cause any problems then; the unit is still one hit away from death in either case.

The best solution is probably to store the current HP as a percentage of the max, because then you never have to rescale it in the first place.

Post reply on HN