Post news RSS Normal Distribution Nation Building

Using math to build empires and other updates. Basically, Astral Clause is well on its way.

Posted by on

From the start, I've wanted my universe to be uniquely generated every time a new game is started (so you don't have the same old place every single time you decide to start a new game). However, randomly throwing stuff into the universe generally doesn't work well.

While solar systems and their objects ARE randomly generated, randomly assigning faction standings, creating completely randomized factions, and throwing their claims randomly across a map is really lame.

Defining Factions
Much to your disappointment, factions are not randomly generated every time a new universe is created. Instead predefined factions are used to build the universe. This allows me to define a more complex back story, and keeps the universe balanced. If I didn't do this, imagine the possible ways it could go wrong.

Being into modding, I'm designing the game to be as friendly to modders as reasonably possible. Factions are defined in a simple, readable, and documented plain text file (as with everything else in the game, by the way).

Placing Factions
To build believable looking nations, I have turned to the normal distribution. A home system is chosen, and the distance from the home system, and a spread value that acts as the standard deviation. I'll explain it in detail shortly, but take a look at this map (with solar system names hidden)

In this image you see my 3 test empires. All of them have the same spread, but their home planet location was randomly seeded on the map. Oh, and you can click that for a 1680x1050 image. And remember, that map will be different every time you create a new game!

The borders are pretty believably shaped, especially considering this is space and there are no geographic boundaries. Making them occupy more of the map is as simple as increasing the spread value in the faction definition file.

Note, this image is from Wikipedia because its high quality and public domain.

What you're looking at is a graph of normal distributions with varying standard deviations. As you increase the standard deviation, the curve becomes wider (and does so rapidly). The spread value in the faction file is a nicely named standard deviation (people editing the file might not know what a standard deviation is, but spread makes sense).

My game does something else with these curves. Since I want to work with numbers between 0 and 100 to represent probabilities, I want to have a uniform way of comparing curves of two different standard deviations. I wrote a function that scales the curve so that the value at 0 is always 100, and it brings everything around it up while preserving the shape of the curve. This way I can take the result of plugging the distance from the capital solar system into the probability function and treat is as a percent chance weighted the same as everyone else's percent chance.

It all works very well, and the resultant nations are more convincing looking than randomly distributing solar system ownership across the map.

Minor Factions
Later in the development of AS, I intend to add generated minor factions such as pirate clans that attempt to gain a foothold, or an upstart empire trying to get some power. These factions will be much easier to randomly generate.


My AI flown traders will trade now, isn't that great? They even factor in fuel costs when determining where to buy and sell. Obviously, they will refuse to trade with a faction that is hostile to them. Combine that with fuel costs, and the traders are reasonably spread across the map.

Other Minor Improvements
I've been doing a lot of small stuff actually.

  • Faction standings were created since my last news post.
  • The sensor readout now color codes based on faction standings. White is friendly or neutral, green is owned by you, and red is hostile.
  • The in-game command line, which is used to issue commands to your ships, can now be scrolled so you can read previous entries and output.
  • I fixed a bug in the command line where pushing massive amounts of text (>100 lines) into it at once could cause a crash.

Questions? Comments? Send me a message. Suggestions are very much welcome, and there is an open role for modeling and texturing space stations. Fly safe.


Well, I hate to comment useless comments but I see you still have 0 comments and I think it is nice to see that people are actually interested in your articles so ehm.. well, here's a comment ;) "Cool stuff" or something. Looks like you are making great progress, I am jealous lol.

Reply Good karma Bad karma+3 votes
masternerdguy Author

:) It's ok it's not a very interesting post. If it had a dozen picture of new spaceships ("tangible stuff") it would have more comments :P

Reply Good karma+1 vote

Every time I see a new news post for this game, I get closer to insanity due to wanting to play it. I can wait though, I just hope it doesn't end up being a dissapointment/you can't get something big to work. Great work so far and good luck!

Reply Good karma Bad karma+1 vote

really nice stuff :)

Reply Good karma Bad karma+1 vote

Quite interesting.

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.