Page 1 of 1

Floating point origin

Posted: Sat Aug 27, 2016 9:49 am
by Vincentz
Oolite really have some nice things going, but one of the biggest issues (imho) is the very limited space (there is a sun and a planet, but they are not even close to "realistic" sizes/distances), and adding new planets causes quite a few issues with both rendering and distances as well.

So, lately I started making my own Space-sim (well, started this week tbh, so nothing big out yet), and was using the Unity engine. But that too had the same issues with jittering when the floating point got too high. Wanting to find a solution I came across this one, which while written for Unity in C#, most likely can be converted to the oolite engine (which iirc is written in C).

http://wiki.unity3d.com/index.php?title=Floating_Origin

Basically it re-centers the origin(x,y,z) on the player if player travels x units away from the last origin.

anyway, just wanted to put it out there in case, as I thought of you guys when I found the solution ;)

Re: Floating point origin

Posted: Sat Aug 27, 2016 11:12 am
by Norby
Oolite's problems are gone when switched from float to double. In [wiki]FarPlanets[/wiki] I added our solar system's planets to realistic distances, including Sedna which is 19 times farther than Pluto. The common problem with docking computer still not appear at a that distance so double looks usable up to 100 billion kilometers.

Recentering can help for a while but not as much as extended precision. If you travel enough far then the coordinates rounded to the nearest large number, moving near objects to the same position which will looks bad when you arrive back or even unusable like when the orbiting station jump within the planet. Need more computing power if you multiply the precision with simulated double-quadruple-etc variables but a better way if you want galaxy-wide accurate calculations.

Re: Floating point origin

Posted: Sat Aug 27, 2016 11:47 am
by Vincentz
ah ok, thought there was a problem with scale in oolite. Wasnt there a rescaling project at one point to make ships smaller so the planets seemed bigger?

Re: Floating point origin

Posted: Sat Aug 27, 2016 11:48 am
by Cody
Vincentz wrote:
Wasnt there a rescaling project at one point to make ships smaller so the planets seemed bigger?
Yes... here!

Re: Floating point origin

Posted: Sat Aug 27, 2016 1:10 pm
by Norby
I mean no technical problems around additional planets. The core game still use the original small scales for playability what cim described here. Let's see:

1. Ship scale
The mentioned Re-scaling experiment do steps around this scale.

2. Planetary scale (100 times smaller than ship scale)
In FarPlanets I created realistic planets up to the size of Mars. Larger ones produced graphical problems with the current OpenGL engine.

3. Solar scale (25 times smaller than planetary scale)
To get 2,500 times bigger suns all planets must be moved much farther than now and probably cause other problems, for example at sunskimming so this is not planned by anyone yet.

4. Inter-planetary scale (1000 times smaller than planetary scale)
FarPlanets is the proof that real inter-planetary scale is usable if we also add enough fast travel methods to keep it playable. At least if we not count the effects of the small sun like it show as a star only at that far and no bright side of the far planets due to the low light.