• News

• Industries

• Learning & Support

• Community

• Marketplace

# Great but...please a double precison solution

Relying on wheter something is 4.669256687 or 4.669257164 isn’t the best idea.
Generally, the assumption that floating-point type represents exactly the number we want is dangerous.

I’m not sure why this thread went down into graphics land… he didn’t really explain what he is trying to do.
Maybe he is trying to do decimal operations in which case he could try to use this:

https://github.com/BrUnOXaVIeRLeiTE/MoneytalksUE4

I’ll save the trouble of this thread now - Epic are never going to invest time into this. It was also confirmed by a core engine member many years ago (I’m not digging up the thread).

Take if from me, it’s not as easy as just doing Find & Replace ‘float’ with ‘double’ - you also have to check every function accross the engine for .f and replace with .0, otherwise there are calculations still happening in float-precision all over the place and the doubles give you no benefit (I experienced exactly this when making my own space game). This is also why PhysX isn’t as easy as changing a single define either - many of it’s operations still natively work in floating point format.

I was working with solar-system scale numbers in Satellite Command and even I didn’t need doubles accross the whole engine to make that game. The loss of precision comes from performing many operations between large and small numbers (e.g, multiplying the mass of a planet in KG against delta time) - You keep 95% of the precision by performing all movement and physics operations in your own code, then at the last minute send those values back to UE4. That was plenty good enough for me.

This is really simple - You create a double-precision math library and ‘vector’ type (DMath and DVector in my case) - then do all your movement code with those. You can pretty much 1-for-1 copy the existing engine classes for this and just ensure everything is using doubles. You then convert to an FVector and send that to the engine at the last moment. It’s really simple.

I should also say - Even double-precision isn’t enough to reliably use a 3D coordinate system of Solar-System scale anyway. It’ll never be enough, Games like Kerbal etc. have layers of coordinate systems which work together, and you seamlessly move between them and change coordinate spaces. Once setup this is quite easy to maintain, but requires strict setup from the beginning.

If you’re making a game like this, you have zero choice other than to learn and use C++.

C++ not being “indie” enough is a moot point, you will have to be prepared to get your hands dirty from time-to-time if your making something more ambitious. It’s also really not that difficult to learn, and UE4 makes it easy for you. Blueprint is enough for “traditional” games and mechanics, it doesn’t cut the mustard for something more advanced.

Ah c’mon James, you know you want to help make the engine use doubles…:D… Of course I mean this James of course…

BTW:

Keep the player at 0,0,0
Move the world around it.

Problem solved.

• drops mic *
• makes gangsta pose *

And the COST of doing that in a scene with 10-30k actors / 3.4 million polygons?

Everything dynamic, level streaming

30k? OOP must die!

I don’t know if you saw it but Epic said there will be double float on Unreal Engine 5