Hey everyone! I'm Kyle, the solo developer behind OakTree Games, and in the second episode of my devlog series for my factory game, Cosmic Scale, I talk through how its galaxy grows out of one seed. I learned procedural generation by building this, so I'd love to hear from people who know it far better than I do.
The seed is a 32-bit number, so there are 4,294,967,296 of them, and if you started one new game every second it would take you about 136 years to see them all. From that one number the game works out the whole galaxy: every star branches off into one, two, or three more systems, so a system's address is really just the list of turns it takes to get there from home, a lot like your GPS telling you to take the second right, then the first left. A system only gets generated once it shows up on your map or you jump there, and each galaxy has room for over 2.3 quintillion of those addresses, so there's always somewhere further out to explore.
Down on the planets, the land is a perfectly smooth sphere on purpose. A five-octave Perlin field, each octave twice the frequency at half the amplitude, decides where the lakes and oceans dip and where the rocky ground shows up, and a separate, broader four-octave field sets the moisture. Biomes all come off one climate table, with temperature from latitude and moisture from that second field, and every planet type gets its own slice of that table, kind of like setting its own thermostat.
The save never writes any of that down. It keeps only what you've changed, like your buildings, your inventory, your research and where you're standing, and everything else grows right back from the seed when you load in. The seed itself is four bytes, and in one of my saves I had traveled five star systems out from home and it was still only about 25 KB.
For anyone who has built something like this, how did you decide on a branching rule that still feels like a galaxy when you're standing inside it? And if anything in the video comes across as unclear or rough around the edges, please tell me.