I described in an earlier post my algorithm for placing the
capital city in each of my countries, expanding on that I wanted to gather some
more information about the make up of each country so I can make more informed
descisions about further feature creation and placement.
One key metric is the population for the country as knowing
how many people live in each country is key in deciding not just how many
settlements to place but also how big they should be. Until this is known much of the rest of the
planetary infrastructure cannot be generated as so much of it is dependent upon
the needs of these conurbations and their residents.
World population density by country in 2012. (Image from Wikipedia) |
A completely naive solution would be to simply choose a
random number for each country but this would lead to future decisions that are
likely to be completely inappropriate for both the constitution of the
country's terrain and it's geographical location. A step up from completely random would be to
weight the random number by the country's area so the population was at least
proportional to the size of the country but again this ignores key factors such
as the terrain within the country - a mountainous or desert country for example
is likely to have a lower population density than lush lowlands.
To try to account for the constitution of the country's
physical terrain rather than just use the area I instead create a number of
sample points within the country's border and test each of these against the
terrain net. As mentioned in a previous
post, intersecting against the triangulated terrain net produces points with
weights for up to three types of terrain depending on the terrains present at
each corner of the triangle hit. By
summing the weights for each terrain type found on each sample point's
intersection I end up with a total weight for each type of terrain giving me a
picture of the terrain make across the entire country. I can tell for example that a country is 35%
desert, 45% mountains and 20% ocean.
This is of course just an estimate due to the nature of
sampling but the quality of the estimate can easily be controlled by varying
the distance between sample points at the expense of increased processing
time. Given a set number of samples
however the quality of the estimate can be maximised by ensuring the points
chosen are as evenly distributed across the country as possible.
The number of samples chosen for the country is calculated
by dividing it's area by a fixed global area-per-sample value to ensure the
sampling is as even across the planet's surface as possible - currently I'm using one sample per 2000 square kilometres. Once the number is known the area of each
triangle in the country's triangulation is used to see how many sample points
should be placed within that triangle.
Any remainder area left over after that many samples worth of area has
been subtracted is propagated to the area of the next triangle - this also
applies if the triangle is too small to have even a single sample point
allocated to it to make sure it's area is still accounted for.
If a triangle is big enough to have sample points allocated
within it those points are randomly positioned using barycentric co-ordinates
in a similar manner to how the capital cities were placed. There is nothing in this strategy to prevent
samples from adjacent triangles from falling close to each other but in general
I am happy that it produces an acceptably even distribution with a quality/performance
trade-off that can easily be controlled
by varying the area-per-sample value.
So given the proportion of each type of terrain making up a
country how do I turn that into a population value? I assign a number of people per square
kilometre to each type of global terrain, multiply that by the area of the
country then by the weight for that type of terrain to get the number of people
living in that type of terrain in the country then finally sum these values for
each terrain type to get the total number of people in the entire country.
I've produced these people-per-Km2 values largely
by using the real world figures
for population density found on Wikipedia as a basis. Using figures a year or two old, the Earth has an approximate average population density of just 14 people per square kilometre when you count the total surface area of the planet but this rises to around 50 people per square kilometre when you count just the land masses.
As shown on the infographic above however the huge variety factors influencing real world population density lead to some areas of the planet being very sparsely populated with only a couple of people per square kilometre while other areas have 1000+. There isn't enough information present in my little simulation to reflect this diversity yet however so I'm currently working with a far more restricted diversity based around the real world mean. The values I am currently using are:
As shown on the infographic above however the huge variety factors influencing real world population density lead to some areas of the planet being very sparsely populated with only a couple of people per square kilometre while other areas have 1000+. There isn't enough information present in my little simulation to reflect this diversity yet however so I'm currently working with a far more restricted diversity based around the real world mean. The values I am currently using are:
Figures for how many "people" to create per square kilometre for each terrain type |
So given the fairly random distribution of terrain on my
planet as it now stands what sort of results drop out of this? Currently the terrain looks like this:
The visual planetary terrain composition, currently the ocean terrain type has a slightly higher weighting so there is more water surface area than any other single terrain type |
while making 100 countries produces the figures shown here
Terrain composition for a number of the countries along with their resultant population densities by total area and by landmass area |
As can be seen basing the terrain population densities on
real world values has generated a planetary population not too different to our own but as my planet is currently 24% water rather than the 70% or so found on
Earth the actual densities are probably on the low side. The global terrain composition is currently
made up like this:
Proportion of the planet covered by each terrain type and resultant contribution to the planet's population |
What is interesting is that the sampling strategy ensures that the population count properly reflects the proportion of the planet that is land mass - you can see countries such as Sralmyras which are 32% water have a lower population density by area of just 13 while Kazilia which is 7% water has a density of 17 people per Km2.
With a population count my plan is to now use that in
conjunction with the terrain composition profile to derive a settlement
structure for each country so I know how many villages, towns and cities to
create. Watch this space.