Floating point origin

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

Post Reply
User avatar
Vincentz
Deadly
Deadly
Posts: 174
Joined: Sun Mar 22, 2015 11:26 pm

Floating point origin

Post 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 ;)
"There is a single light of science, and to brighten it anywhere is to brighten it everywhere." - Isaac Asimov
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Floating point origin

Post 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.
User avatar
Vincentz
Deadly
Deadly
Posts: 174
Joined: Sun Mar 22, 2015 11:26 pm

Re: Floating point origin

Post 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?
"There is a single light of science, and to brighten it anywhere is to brighten it everywhere." - Isaac Asimov
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16055
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Floating point origin

Post by Cody »

Vincentz wrote:
Wasnt there a rescaling project at one point to make ships smaller so the planets seemed bigger?
Yes... here!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Floating point origin

Post 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.
Post Reply