Re:Formatting floating point numbers
by Dylan16807 on Friday June 14, 2019 @09:55PM
(#20187987)
Though inside game logic you should probably default to double, which would easily avoid this problem.
If I'm going to use a 64 bit type for time I'd probably just use int64 microseconds, have over 250,000 years of uptime before overflowing, and not have to worry about the precision changing the longer the game is active.
Re:Formatting floating point numbers
by Dylan16807 on Saturday June 15, 2019 @03:18AM
(#20188811)
So using fixed point. You could do that, but you can't make every single time-using variable fixed point without a lot of unnecessary work. Without sufficient care you end up with less precision than floating point. If you don't want to spend a ton of upfront time on carefully optimizing every variable just to avoid wasting 10 exponent bits, default to double.
At 300fps, time will literally stop advancing after the game has been running for around 8 hours, and in-game things that depend on framerate can become noticably jittery well before then.