Logo

A space themed grand strategy with emphasis on economy, society, and politics

16 June 2022

New Orbit System: Keplerian Orbits

by EhWhoAmI

Keplerian orbits have been added to the game.

Previously, though planets technically orbits, they were just a method to determine the static position of the planet. They existed on the x-y (according to OpenGL) axis, and did not move.

Now planets exist in 3 dimensions, and move according to (relatively) realistic orbital mechanics rules. The orbit style has modeled after Kerbal Space Program, where the orbit has a reference body, and bodies have a sphere of influence. This orbital system doesn’t include the more complex forms of movement you can see in a N-body simulation, like barycenters or Lagrange points, but since it is deterministic, it works well for us.

To simplify the game, we have removed the wider galaxy, and changed the game to focus on only 1 star system: the solar system.

Solar system image

Textures have been adjusted accordingly to properly represent the planets, thanks to Erik (#151).

Earth image

As we can see above, we can see Earth, with the Moon, with fully formed textures.

All the distances are represented as real distances in OpenGL, thanks to log shaders (#157).

The math is not super complicated, it’s just rocket science after all.

We use Keplerian orbits to represent our orbits.

The two documents that were relatively important to displaying the planets in orbit are converting Keplerian orbits to cartesian orbits, and the opposite. TheGreatFez also helped a lot with the math and the programming process, so a special thanks to his patience with helping me understanding all the math.

The orbits are not 100% well formed, because although we support planets leaving a sphere of influence, we do not support hyperbolic orbits, and entering sphere of influences. Hopefully that can be changed in the near future, but I am going to focus on economy for now.

There is also potential for the orbital system to get inaccurate over time, since double precision floating point numbers become less accurate at the multi-million kilometer range, but so far it works like a charm. We will think about it when we need precise orbital manuevers.

The future

Transitioning from a galaxy wide game to a solar system scale game is a relatively large transition in the game.

This transition allows us to distinguish ourself from the relatively saturated 4x/grand strategy genre, because there are very few grand strategy games set in the solar system. (Maybe Terra Invicta?)

The new restructured game will include interplanetary logistics, where you have to wait for the right launch window to launch to a planet. This should create interesting political and economic scenarios, so we can have interesting gameplay.

I will update the features page and the home page as I slowly get more and more ideas as to what direction I want to bring the game.


tags: dev-diary