Let's talk about System Generation, shall we? I'll take our Solar Systems as example. The celestial bodies in our Solar System tend to increase in density the closer you get to the sun. There are a few categorizable zones in our system, and after analyzing the composition of planets, the structure of our system is roughly as follows:
Star | Rocky | Terra | Gaseous | Asteroids (Outer Skirts)
- Rocky planets are usually lifeless planets, for example Mercury and Venus. An atmosphere is not always present, and the lack of vegetation makes these planets dry and rocky as they are.
- Terra planets are earth-like planets, being on the ideal distance to the sun that is thought to be responsible for life. Examples are the Earth herself and Mars (which can be made to sustain life, if it doesn't already!)
- Gaseous Types as you can probably guess are Jupiter, Saturn, Uranus and Neptune, all of which usually have a large number of moons orbiting them, and sometimes also rings consisting of debris, rock or... uh, let's call it "galactic diarrhea".
- All of this is surrounded by a large asteroid field - the Kuiper Belt - which also has a few larger objects, like Pluto or the other dwarf planets that have been discovered there.
Considering all of this, generation of a semi-realistic Star System for a game really can be a pain. That is, if you don't have a system for it!
Based upon the observations I've made above, I've programmed a Star System Generator using a very similar structure. Star systems are divided into "RegionDisks" that hold certain planet distribution chances. Think of them like multiple, non-overlapping DVD disks with different radiuses on which your little sister/brother poured sugar or salt (=planets) on . These RegionDisks can be given multiple useful functionalities:
- Say, a RegionDisk can be of type "Rocky" and all rocky planets (namely Types ROCKY, DESERT and BARREN) without atmosphere will usually be located in that zone.
- Instead of making individual planets move in an orbit, I can only make the RegionDisk rotate, which should save CPU performance for low end computers (don't worry - the movement is going to be so slow they won't be able to run away from you!).
- As player you will be able to roughly orientate without radar devices if you simply know what kind of RegionDisk and Solar System you are in.
- By varying the order of RegionDisks I can create any Solar System Configuration you can imagine without changing much on code
- it is technically possible to make the occurrence of items in a dynamic trade system dependant on the type of region disk.