Floating Point Precision Issue affecting something like 35% of all games

I want to make a new thread about this to bring attention to this issue, since now I’m quite confident it is indeed a bug in the game implementation and not my misunderstanding of the spec.

Due to easy to fix floating point precision and comparison issues, some units that have been theoretically hit to 0 actually end up being hit to 0.0000…[something], or -0.0000…[something]. The latter case is <= 0 which is fine, but the former case is not <= 0 and so any units lucky enough to get that hp value survives. This means that sometimes units are surviving when they should not.

This only happens with games with encryptors. When the decay of 0.15/frame is introduced, 0.15 cannot be represented exactly in binary, and so any float or double representation of hp’s with 0.15 added or subtracted is only an approximation.

This is not a rare. This affects maybe 25-50% of all games that I’ve analysed. Just as an example, here’s a list of games from 1520000 to 1520100 that have these “zombie” units - units with HP < 0.001:

Game 1520004: round 7
Game 1520008: round 32
Game 1520013: round 8
Game 1520018: round 5
Game 1520020: round 5
Game 1520025: round 11, 17
Game 1520050: round 29
Game 1520051: round 20, 20, 20, 20, 20
Game 1520054: round 55
Game 1520056: round 19, 27, 33, 41
Game 1520057: round 20
Game 1520061: round 27, 31
Game 1520070: round 19, 22, 30
Game 1520072: round 8, 54, 67
Game 1520074: round 10
Game 1520075: round 33
Game 1520077: round 27, 27
Game 1520087: round 9

1 Like

Hmmm. This is unfortunate, as removing this bug would essentially be reducing the health of encrypted ping units by ~5% on average which will have ramifications on the value of pings/encryptors. I’ll talk to the team about how best to handle this. I am currently thinking we could increase encryption very slightly to compensate after fixing this, but this could also throw off some algos. Opinions welcome on this one.

Edit:
Actually, I misread this. It happens in many games, but only a small number of times. I am much less worried about it now.

1 Like

Maybe we can just… call it a “feature”? :stuck_out_tongue:

@yujinwunz
The problem isn’t as sever as I originally thought. For some reason I was thinking it was happening to a majority of pings, but looking at your data it is only happening a few times per game, usually once. A few pings surviving one less hit in some games is a change I think we should be ok with making. Still talking with team. If we do fix it i’ll try to hotfix it this weekend (today is our Christmas party) since I want things as stable as possible ASAP.

1 Like

Apologies for my overly-strong wording, I was just trying to point out that it wasn’t like 1 in a million.

No worries! A huge thanks for pointing it out.