Should I use float, double, or decimal for stats, position, etc?
Posted
by
Ryan Peschel
on Game Development
See other posts from Game Development
or by Ryan Peschel
Published on 2012-11-18T17:42:32Z
Indexed on
2012/11/18
23:34 UTC
Read the original article
Hit count: 243
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?
© Game Development or respective owner