Should I use float, double, or decimal for stats, position, etc?
- by Ryan Peschel
The problem with float and double is that they are not exact. If you are to do something like store replays, the values would have to be exact.
The problems with decimal is that they are approximately 16x slower (confirmed by searching and personal testing) than floats and doubles.
Couldn't Vector2s be another problem because they use floats internally for all the components?
How do other games solve this problem? I'm sure they must use floats and doubles but aren't they not deterministic across platforms and different architecture?
The replay files for games like SC2 run in a linear fashion so you cannot skip ahead so how do they solve the determinism issue with floating point numbers?