Ok so i am bumping a sleepy thread.... But i spent some time on this in the weekend and decided to write it down for posterity.

Long story short, simulation of the larger bodies (planets, moons and stars) is a waste of time. Getting it to work well enough that planets don't get randomly ejected to plunged into the sun is hard for long term and tedious but more to the point, a total waste of time. Consider that parametric equations of motion would actually be more *accurate* that a PhD thesis of simulation code. It is why we use it for 99.9% of real multiyear mission probe navigation and star finders etc. It is just that good.

Now for a game you don't need the full accuracy and if you are only going for 2d you can't get the accuracy anyway (2nd order effects include orbital plane drift). So either have just planets with circular orbits (dead easy) or got the proper ellipse equation of motion, which is not much harder. Doing the calculations are just some multiplies and a few sqrts to look up the state of anything at any time. You still need to use a local coordinate system centered on whatever the thing is orbiting. But errors don't accumulate, so round off errors don't really matter.

For space craft etc, using a integrator is what i would do... BUT this means some fairly complicated controller so that it can get to where you want it to go. Again this is accurate since it only cares about where the large things are which is also accurate and stable due to parametric equations of motion. Large time steps could still work well and bobs your uncle it is all easy. Once a ship is in orbit, it is easy to calculate a new orbit with a "burn".

So at large scale you have stars. And shot scale you have planet systems. Since the scale factor between these is more than 100, they are effectively independent.

Oh and the other day, i did a chart of all the 1000 closest stars and made it into a 2d map where it tried to preserve the distance between all the stars to be the same as in the 3d case. Interesting. There is a lot of stars out there.

I have no special talents. I am only passionately curious.--Albert Einstein

Its a bit of both. It is a Hohmann transfer orbit for the most part. This is easy to calculate. This give a transfer with the least amount of propellant with the assumption that you very short burns.

Anything else is done just as Riven has said.

Cool example: The pioneer anomaly was caused by one side of the space craft being slightly hotter than the other. The photon pressure has pushed slightly more off course than was expected. Again too accurate for your case.

I have no special talents. I am only passionately curious.--Albert Einstein

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org