When deciding how to create the galaxy, both to be fun and as realistic as we can make it there are a number of substantial challenges that need to be overcome. First and foremost of these is the simple technological issue of how to represent efficiently something the size and scope of the Milky Way.
400 billion stars – that's a large number; and they need to be generated on demand, quickly. And they need to look right. We start with a density map of the Milky Way spiral – something we try and match up to real life data as best we can, and this results in an approximate amount of mass in each sector. We then use a sector's address to seed the random star generator. Some stars are big and rare – too big and rare to be generated in a 10LY cube, so we need a hierarchy of sectors, 8 layers deep. But we got there – one Milky Way, sir, just like you imagined.
The second problem is the realism of what is generated. It is fairly simple to pluck random numbers from a seed, but these need to distribute in such a way as to make the galaxy genuinely representative of what's there in real life. Generating a properly distributed single value of nebula mass required some extensive research into modern thinking on Initial Mass Functions. This tells us the mass at which a star enters the main sequence and begins hydrogen fusion.
My task was to design a series of processes that would generate the properties of stars, which would present a realistic galaxy. There are physically understood relationships that link the original mass and composition of a star-birthing nebula, the mass of a star, its size, temperature, brightness, colour, lifetime, and what the fate of the star will be once it runs out of hydrogen in its core to fuse. It was challenging to design an efficient on-the-fly process to take a single input, an amount of nebula mass, and create values for every other parameter, but it was also enjoyable to dig through astrophysics textbooks and papers to refresh memories from University. It was satisfying to see the testing tool I created to examine the results of my random generation processes outputting scientifically sound distributions of the parameters mentioned above.
And it's not simply stars. There are many other interesting phenomena in the galaxy, all of which we want to account for. Bright nebulae left over after a super-nova event and the residual neutron star, black holes are just a few examples. This of course leads into the final challenge which is building the systems surrounding the star systems in the galaxy.
What I found interesting was the star system generation, as procedural generation has been a topic of interest to me for a while because I love the idea that I can create an algorithm and still be surprised by some of the results it produces. The most challenging part of this was researching the current theories on how the stars and planets form and then trying to translate those theories into a simple algorithm that can quickly generate realistic looking star systems.
Of equal importance to plausible looking systems was to arrange the algorithms so that they respect physical laws. A nice example of this is the Roche Limit or Radius... As a body approaches the Roche limit of its parent object (for example as a moon approaches a planet) it gradually loses its spherical shape, and suffers massive tidal heating. Once it passes inside that limit it disintegrates and instead of a planet or moon you end up with ring system(s). ”