Fixed-point object locations allow for worlds which are much more scale-able. Using a 64-bit integer (per dimension), and 0.1 millimeter precision, a world can be created which is 100% numerically stable, and 12,000 astronomical units across.
I have been looking all over the internet, and I can’t seem to find a physics engine which supports this.
Is there a 3D physics engine in existence, which uses fixed-point (i.e. Integer, hopefully int-64) values for entities’ positions?
It’s for a really ambitious sci-fi game I’m working on.
1
I’ve never heard of one.
And there are reasons why nobody does it that way.
First, numerically-intense computations moved to floating point decades ago because of the amount of headache involved in keeping track of the decimal point across multiplications, divisions, and exponentiations. The moment you hit transcendental functions (sin, cos, exp), you die horribly.
Second, one light-year is about 63000 AU, so your “universe” is 1/5 of a light-year across. Given that Alpha Centauri is 4.3 light-years from Sol, your Universe is limited to one (1) solar system. AT THE MOMENT, it is summer on Pluto, meaning that it is just inside Neptune’s orbit, and so the whole basic Solar system is 60 AU across (30 AU to Neptune’s orbit, x 2).
You’re proposing using 64 bits. It only takes about 55 bits to represent the basic Solar system, to your desired precision. Use another bit, and go out to 120 AU across.
Now, x86 extended precision (double) is 80 bits, with a sign bit, a 15-bit exponent, and a 64-bit mantissa. Your suggestion uses a 64-bit mantissa, with NO exponent. Bluntly, you aren’t saving yourself any trouble by writing your own fixed-point math package.
My suggestion to you is this: Develop a prototype of your game, using plain vanilla extended precision floating point, and see whether you encounter numerical instabilities.
9