Space games need space but designing all that takes a lot of time and memory. So I wanted to make sure that I could have "infinite" solar systems, and only take up a few kilobytes while doing it. My solution was to distill an entire solar system down to just a few data points.
So what do solar systems really need? Well, stars for starters, then some planets would be nice, and an asteroid belt or two. After some more simplification, it's easy to view everything larger than an asteroid as basically the same thing. Slap on a nice generic name, like celestial object, and you have the means to define an entire system.
But what exactly defines a celestial object? Just a few things it turns out
- Rotational period
- Axial tilt
- Does it have rings
- Which conveniently also handles asteroid belts for stars
- And finally, speaking of stars, is this thing a star?
With that, and a few more variables for my calculations, I have all I need to define any object in the sky.
Combining all of this, along with a few quick test models, some asteroid belt generation code I wrote a while back, and some low res custom-made sky boxes gets you this.
This was scaled down to all fit into the camera view, but since it's all just numbers the size and scale can be turned up to semi-real solar system values with just a few quick changes. All that remains is to get some planetary textures, get the asteroid belts to spin, and figure out a better solution to moon/space station code. Then I'll have fully explorable space systems that I can start dropping aliens into.
But for next time, it's onto the beginnings of weapon systems.