Jump to content

Precision - floating point


Kezzle

Recommended Posts

Anyone know why the location of a construct has to be known to the nearest 1/10th of a femtometer*? I can't think of a situation where that order of precision would have any effect whatsoever on the game. Even at 120FPS, zoomed in as far as you can on an 8k monitor, you wouldn't be able to detect the difference. Visual resolution comes out to what? 0.25m (a voxblock filling the screen, say) divided by 8k (pixels), so 10^-6m? So the game could drop the last 6 orders of magnitude and still have 4 leftover for catching pesky rounding errors.

 

Maybe I'm mistaken, but doesn't excess precision in calculation cause unnecessary overhead? Perhaps it's part of the "optimisation" process that such operations will get reduced in their precision once the game's general flow of operation is better understood (as it now may be). Surely handling such unnecessarily unwieldy numbers adds size to comms packets and storage requirements, even if it makes no difference (or rounding adds more overhead because of the native methods by which the calculations are performed) to the platforms doing the sums (all the client PCs, AIUI).

 

Insights, anyone?

 

* I'm taking this from the Infinity Corp LUA tutorial vid 

 where you can see the Altitude displayed to 16 d.p. (at the 10:10 mark) The vid is a couple of years out of date, so maybe this has changed**, but it still seems a strange choice to this layman.

 

** Yes, I can pop the LUA into a control chair and find out; I just haven't yet... Might update if the subject isn't done to death by the time I get around to it :)

Link to comment
Share on other sites

Floating point numbers are tricky. In your example, you only look at a very small area and assume, that the origin of the "universe" is very near. so you wonder, isn't that resolution overkill ? And in fact, for the sole purpose of rendering, when the origin is close by, single resolution floats are the optimal choice. Thats why all rendering piplines know to man are using 4 byte floats.

 

BUT:

 

Dual universe is a space game. And space is fu.ck.ing unbelievable huge.

 

Single resolution floats are just not good enough for that. A 4 byte floats value part has around 23 bits. Divide the size of the universe by that number. Those steps are huge. And you dont want your ship to jump around in 10000 meter steps. You want it to glide smoothly and express all positions with millimeter accuracy.

 

And thats the simple reason why you need double precision floats.

And even with these big numbers, you would typically create a position tree to avoid absolute positions as much as possible (one object's position is always described as relative to a parents position, like the next planet or star).

 

Just DU the math.

Edited by Ninator
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...