Hi!
Hi!
When you're dealing with that much sparsely-populated space, and equations of that magnitude, its quite common to not deal with everything in a single space -- the numbers just start to break down unless you're willing to eat the cost of using math library with sufficiently-large precision, you won't get it out of floats or doubles. I'd probably have each planet be its own coordinate system, which itself orbits the sun's coordinate system. Likewise for moons as they relate to their planets. Then, based on the masses of the bodies involved, you'll be able to determine a radius within which that body is the one exerting the most force, and you can either switch over to just using that one, or you can also calculate for other bodies and interpolate the forces -- depends on how accurate you want to be.
Be aware that very few space-style games use actual real dimensions and scales, nor do they calculate actual physics for planetary bodies.
Think about what it means to have gravity and orbits around planetary bodies:
You've got the moon that orbits Earth in about a month. For a player looking at the Earth and their environment when rotating at that speed it will be indistinguishable from being stationary. You've got satellites that are geostationary, that is, relative to the Earth they don't move at all. You've also got smaller bodies in lower orbits, the ISS orbits the Earth every 90 minutes, there are satellites that orbit even faster than that.
In other words, if you are planning on orbiting the planet you can make it any animation you want. Zero relative is perfectly acceptable. High speed rotations are perfectly acceptable.
Since natural ranges include everything from stationary to high-speed motion, do whatever is easiest. Normally that means a static scene.
Then when it comes to things like interplanetary travel, you either better allow for some kind of jump system, or a loading screen style transition between areas. Figure that even if you allowed traveling at the speed of light it can still take 20 minutes to travel from Earth to Mars. If you want to have physics based travel you better have some really good music or something interesting for the player to do, because waiting around watching a space ship travel through the void is even more boring than level grinding.
If I'm going to play a space game it isn't going to be "Realistic Simulator of the Voyager Probe, Year 37", but something like EVE Online with active play and completely fake but very engaging physics rules.
If I'm going to play a space game it isn't going to be "Realistic Simulator of the Voyager Probe, Year 37", but something like EVE Online with active play and completely fake but very engaging physics rules.
OP never said it was a space game, maybe George does want to make an accurate solar system simulation (Orbiter-like, perhaps?) with possible time acceleration and faster than light camera movement (such as in Space Engine). In any case, fun game mechanics can also be designed around such simulations or at least a subset thereof, a space game doesn't *have* to have fake submarine physics and be action-based. But yes, modifying gameplay to have less need for such high accuracy is one available option.
Thanks for the help. I have solved it by using a coordinate system for each planet, and if the spacecraft is outside any of the planet's spheres of influence, I use the Sun. Just to clear it up, this isn't really for a game, it's for a project in which I need to simulate an interplanetary flight and then display the trajectory on screen. I figured that this is a common issue in space-related games though. Having the different coordinate systems makes it easier to display the results too.