February 5, 2019

History III: Rise of Civilizations

To this point, I've been placing cities more or less randomly. Sure, the presence of a large metropolis will increase the chances a bit, but the new cities are still spawning from nothing, essentially.

With the new changes, cities that are large enough (population at least 2500, for now) have a small chance to spin off a new city into a neighboring hex, if one is available. This should make things a little more procedurally driven. However, this can lead to a steady-state-esque system where all cities are around 2500 in population; every time they got bigger, the excess drained off into a new city somewhere.

Another big change is the way I'm processing the cities and placing new ones. Initially, I'd place all cities, then check all the new ones for birth/death rate, then check road availability, etc, etc. Now, I look at each city in turn and run through each of those functions in a random order. This allows a bit finer control over what's going on down at the local level, and I think it helps with the road generation as well, since I'm adding roads to cities as they become large enough, not waiting until the end of the year to place them.

The slowest parts of the algorithm are the remaining random city placement - I have to have some new civilization seeds - and the desirability/infrastructure algorithms. I mean, it's Python, so everything is pretty slow anyway, but those algorithms have to perform a calculation for each of the 108k hexes, sometimes many times. So there is definite room for improvement. My programming style is usually to hack something together that works inefficiently, and then target those inefficiencies later.

Generally speaking, it takes about 150-200 years for infrastructure to advance to the point of supporting actual maintained roads (keep in mind that the roads I'm generating are not the only way of traveling between settlements, just the only way of moving appreciable quantities of trade goods). A party could still travel along a trail, etc. The roads are looking much better.

Year 1030, halfling kingdom


Humans (green) spread out very quickly along the coasts. To adjust this, I can add some "gravity" to the expansion function to pull things closer together. These empires (if empires they be) would not be very manageable with early tech. Halflings (orange) dominate many areas, since so much of the map is near the southern pole.

Year 1030, human kingdom

Year 1030, halfling and dwarfen kingdoms
In every sim I've run so far, the dwarfs (blue) have about 3 or 4 kingdoms right here in the middle of the continent. This represents the only Dfc climate on the map, which my dwarfs like. So here they all are.

Elves (red) are pretty rare. I gave them a reduced modifier for growth rate (my elves aren't a bazillion years old, but they do live about 150-175 years), and that really tends to hurt.

Year 1030, human, elf, and halfling kingdoms
But what's this?

Year 1030, dwarfen kingdom...mostly
A pretty large elfish city, right smack dab in the middle of the biggest dwarfen empire in the world? How?

This is where the raw numbers can give rise to interesting story. The simulation says that a dwarfen city fell into ruins, through emigration or disease, and not long after, a group of elves moved into and took over, building their own metropolis! No doubt to the chagrin of the dwarfs. Fascinating.

race
urban pop.
dwarf184646
human444824
halfling429106
elf113819
orc61150

The total population (cities included) after 1030 years of simulation is 20,517,454. Not bad. Maybe a little much, but I do have five races. Elves grow very slowly, as intended. The dwarfs also lag, but since they are geographically clustered, it's not as obvious. But it might be rare to see a dwarf outside of those areas. Orcs are present on the map, but they rarely form permanent settlement, so their urban population is very low relative to the rest.

The next thing I need to do is figure out how these loosely connected settlements will coalesce into kingdoms and empires. I'd also like to include long-range colonization, not just expansion into an adjacent empty hex on land.

1 comment:

  1. "Humans (green) spread out very quickly along the coasts. To adjust this, I can add some "gravity" to the expansion function to pull things closer together."

    I think that "gravity" is political and militar power.

    ReplyDelete