Advertisement

Can someone explain why studios making large space games are congratulated when they make their game capable of using double precision, allowing it to be very large?

Started by September 11, 2024 05:00 AM
13 comments, last by frob 3 hours, 49 minutes ago

Im not saying they shouldnt be congratulated but I, a noob, am just asking the question to gain a better understanding of the topic. If the studio makes their engine from scratch then it would be trivial implementing this (I assume); the only way I can see how it would be difficult to implement it is if they were to re-code/edit an existing engine, which is not designed to handle these large worlds, to then be able to handle it. Other than that, a popular engine to use is Unreal Engine 5, which has this built in natively where you can have very large worlds, which makes me think its easy to make space games with very large worlds. I'm obviously wrong so can someone tell me where I am wrong? I see how studios are finding it difficult to implement large worlds into their games, like star wars outlaws who had to make non-seamless landings to space (presumably because they don't have worlds large enough and need to switch levels (if theres another reason they had to do this and why its so difficult let me know)).

There are two options to handle large worlds:
1. Simply use double precision numbers. Downside is doubling costs on bandwidth and memory, and claculations.
2. Use single precision, but make sure the (floating) origin is close to the player, so precision is good enough. Avoids the extra costs extra complexity.

I would rather congratulate on doing the second option, not on the first. But ofc. it depends.

It's worth to mention GPUs can not do double precision fast enough to be practical, so the rendering must work with single precision anyway.

thethethethethe said:
Other than that, a popular engine to use is Unreal Engine 5, which has this built in natively where you can have very large worlds, which makes me think its easy to make space games with very large worlds.

Afaik, Unreal 5 has added some ‘world partition' system to handle open worlds better.
The partititions are simple cells of a regular 2D grid, which is used vertically to devide the the world into square cells, which are only streamed in in the player is close enough.

This example can handle large open worlds which are flat.
But it won't help much with a space game which is not flat.
It also does not help much for a spherical world, e.g. a full planet which is round.

So for that you might need to add something custom.

thethethethethe said:
I see how studios are finding it difficult to implement large worlds into their games, like star wars outlaws who had to make non-seamless landings to space

Idk, but if i would make such game, i would use regular planar landscapes for the planets, which the engien probably alredy supports. So there is no curvature from the planets sphere. Assuming the player spends most time on the surface, he'll never notive the missing curvature, nor will he notice the planar world has a boundary and does not cover the entire surface of a planet.

If we want a smooth transition to space, we could fake it by deforming the planar world (which at some distance will be just a heightmap of landscape) so it's a patch fitting a region of the sphere.
This way we could hide the visual discontinuity for the transition to space.

However, by doing so we can not land everywhere on the planet. We can only land where there is a patch of a detailed planar world. If we land somewhere else, there would be not enough details to make sense.
To add enough details everywhere, the only way is procedural content, like No Mans Sky does.

But such content does not match the quality of the manually designed planar patch where most of the action happens, so ther is probably no point to work on all those systems, since players won't go there because it's not really interesting to play.

Thus, for games like Outlaws or Starfield it's an obvious design decision to accept a non-seamless transition. The effort to make any place on round planets accessible simply isn't worth it, and the time is better spent elsewhere.

Advertisement

How large is large?

A single light-year is 9,460,730,472,580.8 km ( https://en.wikipedia.org/wiki/Light-year ).

To reach the nearest star from our position, we need to travel (if we ignore our sun at 8 light minutes distance) 4.2465 ly ( https://en.wikipedia.org/wiki/List_of_nearest_stars ).

For simplicity, let's ignore all the fractions, and we get a distance of 4 * 9,460,730,472,580 * 1000 m. That, is 37842921890320000 m (17 decimal digits).

A double has 53 bits precision, which is about 15 decimal digits, and 11 bits exponent ( https://en.wikipedia.org/wiki/Double-precision_floating-point_format ). This means you can express a floating point number as “<53 bits> * 2**<11 bits>”.

While a double works in the binary number system, I'll illustrate what happens in the decimal number system, since that is likely more known to you. 53 bits is about 15 decimal digits, while 11 bits is about 4 decimal digits. So a decimal double can mostly express “<15 decimal-digits> * 10**<4 decimal-digits>” .

Since we have a 17 digits decimal number to the nearest star, the value doesn't fit in the precision field. It stores the 15 most significant digits, and then it multiples that value with 10**2 In other words, the decimal double stores the value as 378429218903200 * 10**2

Note that we lost 2 zeroes at the end of the number. This means that precision is now 100m. To illustrate, let's move from 37842921890320000 m to 37842921890320001 m (1 m more).

To store that new value in our decimal double, take the 15 most significant digits (378429218903200) and multiply by 100. It's again 378429218903200 * 10**2 , in other words, we've lost the information that we moved 1 m. Only when you move 100m or more, the precision field changes and records the movement.

This thus means, that with the distance from here to the nearest star is stored in a double, you know your position with 100m accuracy.

So far so good, a 100m accuracy doesn't look much of a problem at such a distance right?

Well, unfortunately it is. Let's build a space station near that star. It's always nice to sleep again in a normal bed after that much travel. Obviously you need to dock that station with your spacecraft. The docking space isn't that big, let's 50m long and 30m wide (and ignoring height). You switch a low speed, and update your position every second or so.

However, as shown above, any change in distance less than a 100m is not stored in the double position value. So you're not moving at all !!! If you go high speed, you may move, but then you move in multiples of 100m, and the space station isn't even that big !!

And that is thus the challenge with large distances. You need high accuracy throughout the galaxy (which is faaaar bigger than the nearest star) in order to be able to do precision maneuvers at a large distance. To make that possible you need to store a much larger number than the 15 digits precision of a double.

JoeJ said:

There are two options to handle large worlds:
1. Simply use double precision numbers. Downside is doubling costs on bandwidth and memory, and claculations.
2. Use single precision, but make sure the (floating) origin is close to the player, so precision is good enough. Avoids the extra costs extra complexity.

I would rather congratulate on doing the second option, not on the first. But ofc. it depends.

You're basically saying that things far away from the player don't have to be accurate. This may be true for some games, but the more you try to simulate the whole universe, the less true it becomes. And it's precisely the games that pretend to simulate a whole universe that are getting attention and praise.

(Of course it's all smoke and mirrors - no computer can actually simulate the quintillions of individual life forms found on a single planet, much less a galaxy of them - but it's the illusion that's getting praised, not the reality behind it.)

Alberth said:
For simplicity, let's ignore all the fractions

Worth to mention that we can not do this in practice. It's ok for the example, and such examples are often used to answer a question like: I want to model a solar system with details at centimeter scale - will double precision be good enough?
Then we can do the math and we might say: Yes, we can render our models with centimeter details. They will show up correctly even at the boundary of our solar system.
But this does not mean we can also do physics simulation on the objects, because then we need fractions to simulate movements at much smaller scales than centimeters. So our initial yes for visuals might turn into a no for physics.
So it does not only depend on how large our space is, but also on how large our smallest motions should be.

Alberth said:
And that is thus the challenge with large distances. You need high accuracy throughout the galaxy (which is faaaar bigger than the nearest star) in order to be able to do precision maneuvers at a large distance. To make that possible you need to store a much larger number than the 15 digits precision of a double.

The probable solution is:
Use double precision to model an entire solor system, which then is the ‘current world’ the player is in.
If the player leaves the sloar system and travels to another, we do a transition into iterstellar space, which is empty and thus we can do approximations / abstractions and don't need to worry about low precision.
Once the player reaches the next solar system, we do another transition into it's local space.
Solar systems do not overlap each other, so we get away with this trick without being caught.

Thus - even if we pay the price for double precision - we still need to do transition tricks, if we want a whole universe. Personally i conclude that double precision isn't worth it, since we always need to increase complexity to handle infinite worlds anyway. When i've heard that CryEngine was parted to double precision for Star Citizen, to me this sounded like taking the lazy and easy route. On one hand they bragg about fully utilizing the power of the PC platform to make enthusiasts happy, but on the other they increase computationl costs only to decrease their engineering effort.
So, no congrats from my side. But that just said from a distance - they may have their reasons.

a light breeze said:
You're basically saying that things far away from the player don't have to be accurate. This may be true for some games, but the more you try to simulate the whole universe, the less true it becomes. And it's precisely the games that pretend to simulate a whole universe that are getting attention and praise.

Yes, things at large distance from the player should be done at lower levels of accuracy, computationl costs, or simply said: detail.
Meaning, the player will collide agaisnt the interiors of his space ship.

At some distance, the NPC in another spaceship becoems just a point, and it does nto collide against anything. It does not even move.

If somebody makes the claim: We doll full simualtion at any distance! Our NPCs individual toe bodies do collide against each screw on the floor of his spaceship! We do it all, at full precision!
Well, to me that's stupid, and i would show no interest in the game. It's the opposite of optimization, and i won't buy enthusiast HW just to play inefficient crap.

To deserve the praise, we need to make things scalable, so detail can be reduced seamlessly as needed, without the player noticing. But this already begins with open world games, or if we want high details even at much smaller scales. We have this problem in any case, even if it's not a space game. That's often overlooked.

Advertisement

JoeJ said:
The probable solution is:

Use double precision to model an entire solor system, which then is the ‘current world’ the player is in. If the player leaves the sloar system and travels to another, we do a transition into iterstellar space, which is empty and thus we can do approximations / abstractions and don't need to worry about low precision. Once the player reaches the next solar system, we do another transition into it's local space.

Solar systems do not overlap each other, so we get away with this trick without being caught.

I can see that, basically you can use a global position in cubes in let's say 2**20 units, and within each cube a detailed position in units. Obviously you can add more layers to this system to “expand” the universe.

What I am wondering about, why do you want to accurately simulate these vast areas of nothing?

Wouldn't it be simpler to have 2 maps:

- one map with the various solar systems dotted around the map (and whatever other kinds of places you can visit), so you can point at the next solar system you want to go to, and

- one map for each solar system.

At some scale, it becomes useful to procedurally generate the latter eg from the x/Y position at the global map, but that's just reducing the amount of work / storage.

You can easily, eg limit the amount of food/water/fuel on board, so you can't fly outside the map of a solar system.

Jumping to another solar system is boring anyway, so you want to move quickly through that, eg with a special mode or hyper-engine whatever thing.

JoeJ said:

a light breeze said:
You're basically saying that things far away from the player don't have to be accurate. This may be true for some games, but the more you try to simulate the whole universe, the less true it becomes. And it's precisely the games that pretend to simulate a whole universe that are getting attention and praise.

Yes, things at large distance from the player should be done at lower levels of accuracy, computationl costs, or simply said: detail.
Meaning, the player will collide agaisnt the interiors of his space ship.

At some distance, the NPC in another spaceship becoems just a point, and it does nto collide against anything. It does not even move.

If somebody makes the claim: We doll full simualtion at any distance! Our NPCs individual toe bodies do collide against each screw on the floor of his spaceship! We do it all, at full precision!
Well, to me that's stupid, and i would show no interest in the game. It's the opposite of optimization, and i won't buy enthusiast HW just to play inefficient crap.

Counter-argument: we are in intergalactic space. There are no stars or planets nearby, there are just a handful of spaceships. One group of spaceships is engaged in combat with another group. The player is a long distance away, looking at the battle through a high-magnification telescope.

The number of objects is small enough that we don't need to optimize by simulating the world at a lower level of detail away from the player, and the player's telescope means that the player actually notices if the battle far away is simulated at less than full detail. Not your typical space game design, but a valid one.

Alberth said:
Jumping to another solar system is boring anyway, so you want to move quickly through that, eg with a special mode or hyper-engine whatever thing.

Yeah, i would like a space game without a speed of light limit. Travelling with infinite velocity we could have a transition from universe to galaxy to planet within seconds, which would be fun.

But it would also remove the sensation and mystery of an seemingly infinite universe.

a light breeze said:
Counter-argument: we are in intergalactic space. There are no stars or planets nearby, there are just a handful of spaceships. One group of spaceships is engaged in combat with another group. The player is a long distance away, looking at the battle through a high-magnification telescope. The number of objects is small enough that we don't need to optimize by simulating the world at a lower level of detail away from the player, and the player's telescope means that the player actually notices if the battle far away is simulated at less than full detail. Not your typical space game design, but a valid one.

That's not a counter argument to me. What you describe is equivalent to a top down game, where scale is constant and size is finite. In this case there is no need for levels of detail at all, so the arguments of how we should implement management of multiple scales and infinite size do not apply.
Thinking more about RTS than FPS, your example remains in this category even if you have a way to zoom in with the telescope.

But i have a similer example which does break my LOD philosophy: It's an FPS game, but you can put cameras everywhere, then from far away you can observe a video feed.
This does not work, sadly.
I guess that's why we rarely see such thing in modern open world games.

Advertisement