Now that we can generate a Species and a Star Map, we need to populate the galaxy. This means giving each of the Species an Empire to call their own.
This is the first time that I’ve not yet already written the code to cover this, so the end result might be very different, but this is my plan.
The goal is to populate ~10% of the galaxy, but for each Empire to be a contiguous block. It is possible that empires are going to be generated close to each other, or there might be a significant gap between them. That is entirely down to the whims of the RNG. All of the examples in this article are based on the Galaxy being 100×100 ly in size, having 1,000,000 stars in it and having 10 Species populating it.
We want our galaxy to feel alive. And, as such, we need to be able to generate Species to live in it.
For now, a Species will consist of two pieces of information – a Name and a set of Traits. The Name is easy – it will be a Markov Chain generation as discussed before.
The Traits are a bit more fiddly. We want to have some way to determine the actions of the species, but also to determine other details about how the generation works. As such, I have determined a set of Traits from the list that Sid Meier’s Civilisation uses:
Each of these will be given a numeric value within a given range. In order to ensure everything is fair, I’m not going to just randomly assign each of these a random number and be done with it. Instead I am going to randomly shift a number of them by +1, and randomly shift a number of them by -1. The same trait can be shifted multiple times in both directions, and some traits might not be shifted at all.
This means that the overall sum of all traits should be 0, and that every species should be equal in terms of the traits that they have, just that the exact values of the traits is going to be different.
In the future there might well be more details to generate. In particular there will be racial descriptions – what the members of the race actually look like – to generate, but that can wait until much later.
The next thing that we want to generate is the structure of the galaxy as a whole. For this, we are splitting the galaxy into Sectors, where a sector is 1 light year x 1 light year.
Note that this means our galaxy is actually 2d and not 3d – this is a simplification for purposes of the game – everything is easier on 2d.
We then want to generate the number of stars in each sector. We don’t care about any more detail than that at this stage – just the density of each sector.
One of the things that I mentioned a few times on my list of content to be generated was Names. Be it the names of the Galaxy itself, of Species, of individual Stars, or whatever. Names are important, and they give a very strong feel for the thing being names. And this is even more important in a text based game.
My name generation is going to be based on Markov Chains. These are a very simple, yet powerful way to generate reasonable sounding language that is also very random. Essentially it works in two phases – building up of the initial data, and generating values from it.
The entire point of the game jam is “Procedural Generation”. So, I’m going to try and do this for as much as I reasonably can whilst still having a game that actually hangs together and is something approaching sane.