Don’t Move Your Viewpoint–Move the Universe Instead

In my space simulator project I wanted to model the Solar System but sadly this led to a rather annoying limitation because of restrictions of single-precision floating point. Flying about near “Earth” and the moon seemed OK but flying to Jupiter proved another story. If I tried to place say Jupiter at a scaled-distance from my in-game “Sun”, flying my ship to the Jupiter region caused all sorts of floating point truncations which were very much visible in ship rotations – it all became quite “jumpy”.

After a bit of reading by posts from other devs in my predicament, it seemed that the best approach was not to move the in-game first-person camera based on ship motion but rather to always keep the camera at (0,0,0) and to move everything else instead! In other words – you don’t move, the Universe does. Reminds me of a Greg Bear novel. Winking smile

Also, it makes no sense at this stage to store everything in absolute coordinates when you are dealing with the very large.  I think that storing everything relative to it’s immediate stellar parent makes more sense.  e.g. planets to stars, moons to planets and so-on.  By using octrees I can partition objects relative to the node in which they live thus cutting down large values.  e.g. at least one of the Jupiter nodes should contain the planet and all its moons while other nodes just take into account the planet.

So with this in mind I:

  1. placed the scene origin (0,0,0)
  2. placed the sun at the origin
  3. distributed the planets and moons scaled down and relative to each octree node
  4. placed the camera at some nice location
  5. translate octree nodes based on the camera’s logical position (move the planets not the camera)
  6. when rendering, just draw those models in octree nodes that intersect with the view frustrum
  7. eventually this can lead to dynamic scene content streaming based on the contents of an octree node

Anyway here’s a video.  It’s a test video where the maximum viewable distance is shorter than normal hence the planets vanishing only to be replaced with “crosses” so as to indicate “not viewable”.  If an octree node is too far away it turns blue.

10 thoughts on “Don’t Move Your Viewpoint–Move the Universe Instead

    • hi buddy, yes i just started a bit more work last weekend after not working on it for ages. was a bit stuck with depth buffer problems. found some nice articles this week that might help me somewhat. stay tuned! 🙂

      Like

  1. That’s great news! I’ve started working on a space simulator myself and I’m running into all sorts of trouble, should of probably started off with simpler things as this is my first project using the xna framework, but oh well I’ll see how this goes.

    Like

  2. Hey Micky, know we’re eagerly waiting for more. Looks great so far!

    I read you don’t intend to release it commercially. Does that mean it will be freeware? In any case, I hope you have Windows in mind (not just Xbox 360).

    Great work and keep it up!

    Like

    • thanks john. its mainly a project for self learning. im not ruling out releasing one day as freeware. you’ll be happy to know that even though its XNA – im targeting windows-first rather than xbox 360 as the latter is a bit restrictive – i cant draw as many pretty stars compared to PC 😉

      thanks again

      Like

  3. It would be a pitty if you didn’t release it in some way (eventually). It looks great, and there is a serious lack of good space games.

    Anyway, I’ll keep an eye on this!

    Like

  4. Pingback: Autonomous Steering Update for Space Simulator « MickyD's Random Thoughts

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.