SpaceAce: planetary gravity and solar system simmulation

Well, this is the first time I’ll be showing off some things of SpaceAce.

The first video shows my simulation of our solar system, each of the eight planets is recreated accurately by putting all the data from wikipedia about these planets in the constructors and working from there. The relative sizes, speeds and rotations, inclinations and ellipsiness of the orbits around the sun are all accurate. The simulation shows 1day as 1 minute (that’s why the earth rotates so hard, it has to rotate 365 times a minute, and in one minute orbit the sun). About that sun, I don’t have it visible yet :).

Oh the position between the planets is relatively correct, but it uses a different metric than planet size, else it would be almost impossible to be able to show more planet than one. (Those other planets are really far far away).

When I zoom out, and planets become smaller than their assigned icon, the planets stop being drawn and an icon appears in their place.

I’d really like to show the constructor of my planet class with you to show the complexity:

public Planet(GraphicsDevice device, SpriteBatch spriteBatch, ICamera camera, Effect effect, string technique, Texture2D texture, Model model,
            float equatorialDiamater, float orbitalRadius, float eccentricity, Vector3 focalPoint, float inclination, float rotationsPerMinute, float orbitsPerMinute, string name, Texture2D icon)
            : base(device, camera, effect, technique, icon)

And the video (sorry about the silly textures, their for debugging, btw best to watch it fullscreen in hq because youtube really made it hard to see).

An other video I created is to show off planetary gravity, (not implemented in the first video). It’s kinda fake, but this will allow the player to construct space stations and satellites that realistically orbit the planet. Satellites keep facing the planet as they orbit it. And the further away, the slower the orbit around the planet.

Oh well I think this video speaks for its self:

If anyone is interested I will make an article to show how I’ve done it. However the basics are storing a relative position (vector3) and updating the rotation from 0,0,0. Then setting the actual position to planet.position + relative.position :).

Edit: after watching the videos on youtube I see there is another old game called SpaceAce, although SpaceAce for me is a working title I just wanted to tell you and make sure that my game has nothing to do with that old Atari game :).

2 Responses to “SpaceAce: planetary gravity and solar system simmulation”

  1. RK says:

    Hey Roy – quite nice Simulation :) Im currently working on a 3-dimensional, more scientific approach to simulate our solar system by using physical forces and known values of of the objects in our solar system. Did you ever try to simulate it by using mass and gravitational forces?

    Greetings, RK

  2. Hey RK,

    No I haven’t actually. This was ‘good enough’ for what I needed. I’d still like to give it a try though as there are some interesting problems to solve/approximate. Especially the n-body problem: http://en.wikipedia.org/wiki/N-body_problem

Leave a Reply