Home > SpaceSim > Don’t Move Your Viewpoint–Move the Universe Instead

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.

Categories: SpaceSim Tags: , ,
  1. 2011/08/24 at 5:21 pm

    Hi Micky, I was wondering if you are still working on this project, its amazing!


    • MickyD
      2011/08/24 at 5:45 pm

      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! 🙂


  2. 2011/08/26 at 6:57 pm

    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.


  3. John
    2011/10/11 at 1:22 am

    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!


    • MickyD
      2011/10/11 at 1:14 pm

      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


  4. John
    2011/10/11 at 10:59 pm

    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!


    • John
      2011/10/11 at 11:00 pm



  5. 2013/02/19 at 1:08 am

    This is how the Dark Matter Engine works in Futurama. http://futurama.wikia.com/wiki/Dark_Matter_Engine


    • MickyD
      2013/02/19 at 8:15 am



  1. 2012/11/09 at 5:38 am

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: