(08-05-2018, 05:21 PM)megamarc Wrote: ...floating point suffers precision loss because of accumulative rounding errors, whereas fixed point is stable and deterministic. Unless the extended range of floating point is required (the ability to merge very large and very small numbers), I'd rather recommend fixed point arithmetic when performing incremental calculations.
Ah of course. I'm going to take that advice on board.
It seems like every time I post here and you reply, I learn something! I knew that about floating point, but I've never been in a situation where fixed point was the solution to a problem I had, so I never thought about it like that - but it makes sense when you put it that way.
The only situation I've been in where floating point inaccuracy was a problem, was when you travel too far away from 0,0,0. In my voxel game, when the player position was greater than around 10,000 in any direction, all the meshes would start to render with cracks between them, and I had no idea what was going on! I programmed them to line up perfectly, why was my math suddenly off? That day, I learned about how floating point inaccuracy affects mesh rendering when the position values are too large, and ALL open world games (Skyrim, GTA, etc. etc.) periodically move every mesh, and the player, back towards 0,0,0 when you go too far in any one direction, for this reason! I implemented a system like that in my game and it solved the problem!