5
\$\begingroup\$

So, this might be a little random since I can't remember any specific examples but this question just popped into my head 30mins ago and wont leave me alone. I remember hearing about some big game with decently sized gameworld that would move everything around a Player instead of moving the Player around. Note that this wasn't an endless runner or some other title of this kind that just tries to create an illusion of movement. Again, sorry but I'm not able to provide an example.

Either way, what are some advantages of treating movement like this for a game where it might result in moving more gameobjects at the same time than if only the Player would be moved?

\$\endgroup\$
2
  • 3
    \$\begingroup\$ Floating point precision. \$\endgroup\$
    – Vaillancourt
    Commented Feb 9, 2022 at 19:18
  • \$\begingroup\$ Is it possible you're thinking of Kerbal Space Program's "floating origin" system used for orbital trajectories, where the space ship's local interactions are simulated in a coordinate system centered on the ship? \$\endgroup\$
    – DMGregory
    Commented Feb 10, 2022 at 0:53

1 Answer 1

8
\$\begingroup\$

For me, the prime example of this is Outer Wilds. However, it applies to other similar games. In the game, the player explores a solar system. This has the following implications:

  • We have a huge space to explore.
  • There are planets are moving all the time anyway.

Since everything is moving anyway, then moving everything instead of moving the player character is not really an extra cost.


And why would you want to move everything instead of moving the player character? Because floating point precision.

For a good example of the problems that floating point precision brings, let us see a game with huge worlds that does not do this: Minecraft. See THE TRUE END of the MINECRAFT WORLD!.

As you move away form the origin you will start to see problems.

This is because floating point numbers can represent more values near zero than away from zero.

In case you are not familiar with how floating point numbers work, first of all, here are a couple videos: Why Computers are Bad at Algebra | Infinite Series and Floating Point Numbers - Computerphile.

However, for the purposes of this answer, you can think of them as a scientific notation (with a mantissa and an exponent), or you can think of it as moving the decimal point (hence the name). These are the same idea: As the exponent becomes larger, you are moving the decimal point to the right, so that there are less digits after it.

Thus, the first symptom is that motion becomes jittery. This is because the difference between a floating point number value and the next becomes large enough that it is noticeable. Thanks to rounding, motion is still posible, but not smooth.

Eventually there there are no digits after the decimal point. And then you keep moving the decimal point (i.e. increasing the exponent), and the floating point numbers begin to skip integers altogether. When you reach those values we have another interesting behavior: a floating number value plus one is the same floating number value. Because the next integer cannot be represented as a floating point number, and is rounded down.

I remind you that the gap between values that can be represented becomes larger and larger. So for any gap you can think of, there will be a position where the gap between values that can be represented is larger… Well, eventually you reach the larger number that can be represented, and that is that.

What I'm going with this is this: eventually the distance that the player character would move is too small to make the gap between values that can be represented, and then the character can't keep moving.

And, of course, for any other system that depends on the position in your game (e.g. motion, models, lighting and shadows, world generation, etc) the progressive lose of precision as you move away from the origin will introduce weirder and weirder behavior.

To avoid all that you want to keep the player character near the origin. And that would mean to move the world.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .