Fun with Orbital Mechanics

Children of a Dead Earth uses an N-Body Simulation to simulate its orbital mechanics. Most other games which simulate orbits use the much less accurate Patched Conic Approximation, and I’ll go into the details of why in this post.

What is the Patched Conic Approximation, first of all? The Patched Conic Approximation treats all orbits as ellipses around a celestial body. Then, when actually making thruster burns, the current ellipse is swapped out for a new elliptical trajectory. When making an exit from one orbit into the parent body’s orbit, a new ellipse around the parent body is swapped in for the child body.

luna - periodic - bright.png
A perfectly elliptical orbit, although it rotates slightly with each period.

As you might expect, this is rather inaccurate. Indeed, when plotting actual spacecraft trajectories, NASA starts with the Patched Conic Approximation to get a “napkin estimate” of the trajectory, and then they switch to using an N-Body Simulation when they actually need to calculate it precisely.

Originally, Children of a Dead Earth was supposed to use Patched Conics. However, I discarded them when I wrote a simple N-Body Simulator to compare them against, and found the Patched Conics diverge very heavily from the N-Body Simulator. It was also the right choice: Switching to an N-Body Simulator allows a wealth of new orbital features, such as Orbital Perturbation and Lagrange Points.

So what is an N-Body Simulation? It’s simply a simulation which takes into account all gravitational forces in the entire system (in my case, the entire solar system) and applies them at each time step with a numerical integrator. Children of a Dead Earth uses a Fourth Order Symplectic Integrator by Forest and Ruth.

mercury - complex3 cropped.png
An orbit around Mercury perturbed significantly by the Sun.

Orbital Perturbation is a phenomenon that only shows up in an N-Body Simulator, and it makes a world of difference. Perturbation is simply the effects of gravity from more bodies than just the primary orbited body. Patched Conics do not simulate perturbation because they are only concerned with the gravity of one body at a time.

When orbits can be perturbed, they lose their perfectly elliptical shape and become at best distorted, and at worse, completely unpredictable, losing all periodicity.

mercury - simple cropped.png
Some orbits become perturbed so much that they become utterly unpredictable, and don’t seem to behave like orbits at all.

Why is this important? Consider the following story, which happened to one of my Alpha playtesters. He had spent a lot of delta-v injecting into orbit around Oberon in the Uranian system, and didn’t have enough delta-v to rendezvous with the destination space station around Oberon. His injection orbit was highly out-of-plane and succeeding seemed hopeless. But instead of giving up, he simply disabled stationkeeping, letting his spacecraft enter a free falling trajectory. Using the orbital perturbation of Uranus, he allowed the planet to perturb his out-of-plane orbit, gradually flattening it out into an orbit coplanar with the target space station. Eventually, by simply letting gravity do the work over several orbital periods, he had an orbit which could rendezvous with the target with minimal delta-v usage.

perturbed orbit.png
Using orbital perturbation in combat around Ganymede.

In combat, using orbital perturbation to your advantage is another effective but difficult technique to use. Dropping into a low orbit is often a useful tactical choice, as it forces your opponent to expend copious amounts of delta-v. However, it reduces orbital perturbation of nearby bodies.

On the other hand, entering very high orbits causes combat speeds to slow heavily, yet it costs much less delta-v, and it greatly enhances orbital perturbation. A perturbed orbit is much harder for the enemy to intercept because of its unpredictability, and the enemy will have to expend much more delta-v to reach you while you let gravity pull you along.

Furthermore, techniques like Orbit Phasing, which is a very effective way to intercept enemies, get thrown out the window when your target stops stationkeeping and enters free fall. Intercepting the enemy requires much more care than using simple maneuvers. After all, Orbit Phasing and Hohmann Transfers were developed for the Patched Conics Approximation, and are much harder to pull off in an N-Body Simulation.

l point 3.png
A propellant depot in a tight orbit around the Jupiter-Europa L4 Lagrange Point.

Lagrange Points are also simulated only through N-Body Simulations; Patched Conics fail to correctly simulate these. Lagrange Points are five or fewer points around each celestial body and its parent where an orbit that remains stable relative to both bodies. Children of a Dead Earth simulates all manner of Lagrange Point orbits, from simple circular ones to more exotic Tadpole Orbits.

l points 2.png
A figure 8 orbit around Mercury’s fourth Lagrange Point, Sun-Mercury L4. This orbit is a tadpole orbit that is twisted on itself.

That’s all for the N-Body Simulator! There is one additional aspect of Children of a Dead Earth’s orbital mechanics that is unique, and that is the way it handles multiple frames of reference, however, that will be another full post in and of itself.