Rocket science

This was a small C# game exploring planetary mechanics and newtonian physics in 2D space with quite simple graphics. The goal was to provide a light-weight alternative to the Orbiter space sim however Kerbal Space Program fills this niche very well nowadays.

Some screenshots

in orbit

Stable Earth orbit. The white line predicts the ship’s path. It turns orange if the ship’s trajectory goes into the planet’s atmosphere.

moon trajectory

Earth-Moon predicted trajectory. The red circles describe the planet’s radius of influence, in which the planet is the major gravitational source (also indicated by the green line connecting the rocket with the center of the planet). As the ship’s trajectory enters Moon’s radius of influnce, the previously elliptical orbit gets deformed. In this case the rocket would crash into Moon’s surface almost vertically.

slingshot

A slingshot manoeuvre around the moon.

Trajectory Prediction

The selected rocket’s trajectory is predicted every frame. The physics integration runs for a predetermined number of steps with a fixed step size. At each step the rocket’s position is recorded and all planetary influences on this body are recalculated again. As long as the planets don’t move too far and no external forces (thrusters) are acting on the rocket, the predicted trajectory is valid. However, due to the nature of Newton integration, small errors build up over time and the prediction very far into the future are less accurate than the prediction for the near trajectory.

back »