If your HP goes past 2^31-1 (32 bit integer max), it will stay capped at that number:
Description
Details
- Commits
- Restricted Diffusion Commit
Restricted Diffusion Commit
Restricted Diffusion Commit
Restricted Diffusion Commit - Task Type
- Bug
- Affected Gamemode(s)
- Single and Multi
- Reproducible
- Yes
- Last tested (version)
- 0.199.535
- Category
- Control Block System: Functional
- First occurrence (version)
- 0.19289
- OS-Specific
- No
- Hardware-Specific
- No
- Video Card Vendor
- uncertain
How to reproduce:
- modify SHP and AHP of a block to something very high
- spam that block on a ship to reach high values
AHP is working.
SHP isn't. It goes negative when crossing 2.147 billion
<replace this line with the file content>
<replace this line with the file content>
Status | Assigned | Task | ||
---|---|---|---|---|
Unknown Object (Maniphest Task) | ||||
Closed | lancake | T355 ship and armor HP is capped |
Event Timeline
Personally, this is only an issue because ArmorHpBlockMultiplier is being edited. I don't see this issue ever effecting anyone using the game, unless they're trying to break things. Basically, unless I'm mistaken, 2.15 billion HP would never be hit by a player.
You can hit the cap at 25.000.000 ship blocks, this is obviously in the reach of known builds, without modification of the multiplier, if someone wants to buff the armor, by doubling it, you only need 12.500.000 blocks to hit the cap.
So, this increased modifier is only a helper, and not a real "use case" ^^°
fixable but at the cost of a lot of bandwidth (replacing at least four 4-byte int with four 8-byte long) 2 of which update on every damage taken
Its not needed to extend the range. However I heard the entities hp malfunction when hittin g the limit
@schema
Another possible fix:
int #1 is the main armor HP
boolean states whether another int is needed (health is > 2^31-1)
int #2 is used only if the boolean is true
Second integer would be left-shifted to create a long.
With this method all ships would use 5 bytes per HP value, instead of the 8 bytes of just using a long. Massive ships would use 9 bytes though, which of course would be rare.
Not entirely sure if this is related, but it seems armor HP is not working properly.
the AHP is set to SHP. Every block you add, adds the shp of that block to the ahp pool. Changing <ArmorHpBlockMultiplier>1.0</ArmorHpBlockMultiplier> does nothing so I assume no armor value is checked and it just uses the shp one.
Crossing the 2^31 - 1 limit will set current and max AHP to 0/0. Removing blocks so you don't get passed that limit will bring its normal value back again, unless the ship received damage.
The SHP however is working fine though as far as I can tell. Managed to get 4 billion and the SHP mechanics still worked properly.