4 ms·
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
by db48x 4y ago
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.
- InitialLastName 4y ago> 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. Doesn't this solution make the more common calculations more expensive, complicated, and error-prone to make one rare calculation easier? It seems like far more of the operations on the unit's current HP will be "gets damaged by X hp" or "gets healed by X hp", both of which would require the equivalent of the above conversion to establish a result.
- db48x 4y agoIf you’ve changed HP to a percentage, why wouldn’t you also change the damage and other related numbers (such as damage reduction and so on) to percentages as well? Nobody would be dumb enough to store them in different units and then convert every time they manipulate them.
- mlyle 4y ago> why wouldn’t you also change the damage and other related numbers (such as damage reduction and so on) to percentages as well? Because a sword might do 5HP of damage, not 10% of anyone's damage (whether they've got 50 or 5000HP). Otherwise, hit points are meaningless: 10 attacks with a 10%-damage weapon kills a lowly serf or a mighty dragon. And because damage reduction might reduce a fixed amount of damage from an attack. Etc.
- db48x 4y agoObviously a dragon doesn’t get damaged at all by a puny little sword. You can’t just say that hitting a dragon with a sword a thousand times would kill it, when none of the attacks can get through the dragon’s armored hide. On the other hand, it will die immediately if pierced by an arrow provided that arrow hits the one spot where the hide is missing a scale. The dragon has 100% DR, except in that one spot.
- account42 4y ago> Obviously a dragon doesn’t get damaged at all by a puny little sword. You can’t just say that hitting a dragon with a sword a thousand times would kill it, when none of the attacks can get through the dragon’s armored hide. https://www.youtube.com/watch?v=9VDvgL58h_Y https://www.youtube.com/watch?v=9VDvgL58h_Y
- db48x 4y ago:D
- mlyle 4y ago> A better solution is to kill the unit when it drops below zero HP Then you have the situation where units are displayed as having 0 HP but are still alive.
- db48x 4y agoSo what? The players already know that attacks deal fractional HP damage.
- mlyle 4y ago> The players already know that attacks deal fractional HP damage. Top-end players who analyze the engine enough do. Otherwise, they shrug and say "sometimes 1, sometimes 2 HP" And even so, we're used to seeing 0/50HP and it meaning "dead" across many games. Seeing 0/50HP and it meaning "just a small amount of HP left" isn't ideal. Not to mention that weird situations with 5.551115123125783e-17 HP remaining aren't great either (where a player may end up with effectively an "extra" hit point).
- db48x 4y agoAgain I say “so what?”. The unit is one hit away from death either way, and the player will know it.
- mlyle 4y agoAt this point, with your Smaug-related comment, etc-- I've become convinced you're trolling. But just to humor you: the desire is to have a system where floating point neither surprisingly kills nor gives characters extra hit points. There's a lot of subtlety in this. Schemes where all damage are percents don't preserve the essential pieces of RPG combat systems. Moving the threshold from 1 to 0 HP violates the conventions of the art and doesn't eliminate the problems (you can still end up with hit points epsilon away from 0, instead of 1).
- db48x 4y ago