Earlier quoted context omitted.
> The formula was probably `return new_maxhp * (old_hp / old_maxhp);` ... > Due to floating point rounding errors, convert_hp(1, 55, 55) equals 0.999999940395355224609375, which is less than 1, which means the unit dies. Ahh. The old "Multiplying and dividing is associative... for the set of reals, not for the subset that you can actually afford to compute with." So it should have been `(new_maxhp * old_hp) / old_max…
Could you explain to a noob why does this happen, exactly? Is it because 55/55 != 1, or 1*1 != 1? I understand float can't store certain integer/finite decimal precisely, but why would a/a not be 1 if both numerator and denominator are the same (imprecise) number?
Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
31–40 of 267 posts
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#32Earlier 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.
> Seems all that could have been avoided by using rationals in general It's 2023: I'm still surprised that so many new languages/platforms still only provide only basic integer and IEEE-754 types for numerics: Rust, C#, Java, Swift and others still lack built-in, runtime-provided, nor even standard-library-provided rational types, which I assume really should be the preferred type for most business/domain/application…
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#33Earlier quoted context omitted.
Paradox Interactive games, especially the Crusader Kings series also have some pretty entertaining change logs. E.g., from Crusader Kings II, Patch 2.4 [0]: - Handsome and lustful men now also populate the cabins in the wild for the pleasures of people who find them attractive. - Characters who love their spouses very much are now less likely to join holy orders. - Paranoid parents should no longer worry about potent…
Wow, the logic to model these kinds of social structures makes my head hurt. But you would have to do it. And I wonder about dead children. I remember one game where there could be no dead children.
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#34Earlier quoted context omitted.
Paradox Interactive games, especially the Crusader Kings series also have some pretty entertaining change logs. E.g., from Crusader Kings II, Patch 2.4 [0]: - Handsome and lustful men now also populate the cabins in the wild for the pleasures of people who find them attractive. - Characters who love their spouses very much are now less likely to join holy orders. - Paranoid parents should no longer worry about potent…
Wow, the logic to model these kinds of social structures makes my head hurt. But you would have to do it. And I wonder about dead children. I remember one game where there could be no dead children.
>And I wonder about dead children. I remember one game where there could be no dead children.
Probably Skyrim, though it's not rare. Crusader Kings somewhat encourages infanticide, as your brother's bastard could stop your character from inheriting a title.
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#35From the comments: "This was caused by a floating point rounding error. A unit switching jobs internally becomes a different unit (i.e. a monk with a relic becomes a monk without a relic), and when doing that, HP is scaled proportionally based on the old and new max HP using 32-bit floating point maths." And there are YouTube videos about this https://www.youtube.com/watch?v=MytWNbpnAVY
> The formula was probably `return new_maxhp * (old_hp / old_maxhp);` ... > Due to floating point rounding errors, convert_hp(1, 55, 55) equals 0.999999940395355224609375, which is less than 1, which means the unit dies. Ahh. The old "Multiplying and dividing is associative... for the set of reals, not for the subset that you can actually afford to compute with." So it should have been `(new_maxhp * old_hp) / old_max…
I don't see how that couldn't run into similar problems. I would use `clamp(old_hp * (new_maxhp / old_maxhp), 1, new_maxhp)` (assuming that old_hp >= 1).
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#36Earlier quoted context omitted.
Paradox Interactive games, especially the Crusader Kings series also have some pretty entertaining change logs. E.g., from Crusader Kings II, Patch 2.4 [0]: - Handsome and lustful men now also populate the cabins in the wild for the pleasures of people who find them attractive. - Characters who love their spouses very much are now less likely to join holy orders. - Paranoid parents should no longer worry about potent…
Wow, the logic to model these kinds of social structures makes my head hurt. But you would have to do it. And I wonder about dead children. I remember one game where there could be no dead children.
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#37Earlier quoted context omitted.
> The formula was probably `return new_maxhp * (old_hp / old_maxhp);` ... > Due to floating point rounding errors, convert_hp(1, 55, 55) equals 0.999999940395355224609375, which is less than 1, which means the unit dies. Ahh. The old "Multiplying and dividing is associative... for the set of reals, not for the subset that you can actually afford to compute with." So it should have been `(new_maxhp * old_hp) / old_max…
> So it should have been `(new_maxhp * old_hp) / old_maxhp`. I don't see how that couldn't run into similar problems. I would use `clamp(old_hp * (new_maxhp / old_maxhp), 1, new_maxhp)` (assuming that old_hp >= 1).
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#38Earlier quoted context omitted.
> The formula was probably `return new_maxhp * (old_hp / old_maxhp);` ... > Due to floating point rounding errors, convert_hp(1, 55, 55) equals 0.999999940395355224609375, which is less than 1, which means the unit dies. Ahh. The old "Multiplying and dividing is associative... for the set of reals, not for the subset that you can actually afford to compute with." So it should have been `(new_maxhp * old_hp) / old_max…
> So it should have been `(new_maxhp * old_hp) / old_maxhp`. I don't see how that couldn't run into similar problems. I would use `clamp(old_hp * (new_maxhp / old_maxhp), 1, new_maxhp)` (assuming that old_hp >= 1).
Otherwise you get loss from the division and then multiply that loss (by >1).
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#39Earlier quoted context omitted.
Note that the April 2023 patch is live, and perhaps one of the biggest changes to the meta ever. I don't think anyone really knows how the new meta will shake out. Build orders will absolutely change this patch. Though I guess that only matters if you were hoping to get to a competitive level. Definitive Edition does have a very good tutorial mode for people interested in online combat, and "Extreme" AI is 100% legit…
What’s new? Seems kind of crazy to introduce a meta changing past to an old game like this that has managed to stay popular.
Re: Aztec monks with 1/55 HP no longer die when picking up or dropping a relic
#40Blizzard 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 classic original. Then they immediately abandoned it and have released no updates or fixes since.