Showing posts with label Cities. Show all posts
Showing posts with label Cities. Show all posts

December 13, 2021

Ex Nihilo I: Starting Off

It's been a while since I've had much time to devote to my projects. I'm starting to get the itch to actually play again, and the problem rears its head that it's just not done. Nor will ever be done. I've spent a good deal of work on the tribal development system, which would eventually give rise to settled civilizations and more complex societies. I still want to develop that out, but a project of this magnitude is lifelong.

My thought at the moment is to generate a more or less fully populated world, without the benefit of the procedural history system. I would lose a lot of that organic weirdness, like the records of wars and such, but it would significantly shorten the timeline to a version that could be used in an actual game.

Instead of slowly planting and growing cities, I just place them according to the design principles I developed last year: the carrying capacity is determined first by the desirability of the location and then by proximity to nearby cities. This yields between 15,000 and 20,000 cities, ranging in size from villages of 200 to cities of about 75,000 inhabitants.

Infrastructure map: humans (green), elves (red), dwarves (blue), halflings (orange)

Not sure why halflings seem to dominate but there is plenty of time for modifying the variables later. This also brings to the front the issue that the world is roughly twice as small as it should be, and is incredibly habitable. Nothing wrong with that, but I do want to rework the map size (which gave me so much trouble 3-4 years ago) to be closer to Earth's surface area.

On the first pass, each city is its own hegemony, leading to a very busy map. About 86% of the habitable surface has at least 1 point of infrastructure, which is almost nothing anyway.

Hegemony map, very cluttered

The next step is to collapse these thousands of independent tribes into larger hegemons. Through the sword. This thins out the cities and yields a nicer political map.

Hegemony map, starting to firm up

This is approximately 10k hegemonies and about 25k cities. This is more than a pretty good start to create a playable world. I'll tweak this process some more, then begin to add resources and trade networks.

June 21, 2019

History XV: A Feebleness Bereft of Breeding

There remain a few mechanics to topple empires that I haven't yet tackled. The next one on the list is the Plague.

For now, "plague" is intentionally vague. In modern parlance, the term generally refers to the three kinds of disease spread by the Yersinia pestis bacterium: bubonic, septicemic, and pnuemonic plagues. The properties of each are different, so for now I want to think about a general model for plague transmission of infectious diseases. Diseases which may cause epidemics but are not usually transmitted infectiously, such as cholera, are also interesting but can be tackled separately.

Alexis addresses some initial thoughts about a player catching disease (or building up a town's resistance to such) here. As a town's infrastructure rises, the individual's chance for becoming diseased grows, to the tune of $I \ over 10000$. For a settlement of $I = 474$, the chance would then be $0.0474\%$. That's not so bad. In addition, this is just "disease." That's pretty broad. Let's place the chance of contracting actual plague at 0.2%, on top of the chance to contract any disease. That makes the overall chance really low, 0.009%.

Like anything else you might care to learn about, the amount of research done on the subject is staggering. Consider these sources:
Even from just these, a clearer picture emerges of how to model such an event. Particularly, a set of equations (the SIR model), which always interests me. \[{\partial S \over \partial t} = B - {\beta S I \over N} - d S\]\[{\partial I \over \partial t} = {\beta S I \over N} - \gamma I - d I\]\[{\partial R \over \partial t} = \gamma m I - d R\], where $S$ is the susceptible population, $I$ is the infected population, $R$ is the recovered population, $N = S + I + R$ is the total population, $B = 0.4$ is the birth rate, $\beta=0.5$ is the contact rate, $d=0.4$ is the death rate, ${1 \over \gamma} = 26$ is the infectious period, and $m=0.33$ is the mortality. By tweaking these parameters (this particular set is for bubonic plague) we can model different kinds of diseases when we wish.

I don't really care about $B$ and $d$ since these time steps are usually modeled in days and I step history forward one year at a time. So all the calculation will take place in a single fell swoop. \[{\partial S \over \partial t} = -{\beta S I \over N}\]\[{\partial I \over \partial t} = {\beta S I \over N} - \gamma I\]\[{\partial R \over \partial t} = \gamma m I\]. This generates a curve that's quite nice when modeled with the above parameters, for a city that begins with a population of 32,210 and a single infection:


That's pretty devastating.

The plague then spreads to a neighboring city, which must make its own save against infection. And the cycle repeats. A city could shake off the plague but then get it again from a neighbor. This makes a death spiral possible to wipe out an entire civilization.

....Now having done all this work, it occurs to me that the fancy equations are irrelevant. The only way to be removed from the pool entirely is to die...which means that the only calculation necessary is $N_1 = \mu N_0$. Huh. However, the full calculation can still tell me how long the epidemic lasts, in order to spread it to other settlements over more than one year. Plus, it might be interesting to know how many total are infected in case the party is caught in the middle of an epidemic.

Somewhat anticlimatic.

June 12, 2019

History XV: It Might Be Famine All Around

A hegemony's capital (or largest cities) should be limited by the amount of people they control (hence the working classes ability to keep them supplied).

Currently, this is limited by the carrying capacity, $K$. Therefore, the upper bound on $K$ will be affected by this control.

Assume that $P$ is the population of a city. The farmer ratio $\alpha=3$ can be defined in this case as 3 farmers necessary to support 1 other individual. I'm leaving this as a variable, not a hardcode, because this number is very dependent on who you ask and what time period we're talking about. Therefore, the number of people required to support a city of population $P$ is \[n = \alpha P\]. How many people do we have available? Assuming 100% of the rural population is involved in food production (a bad assumption, again something we can change), then we just need the total amount of rural people in that hegemon $P_r$. How many of those are available to send their goods to our city? If the total urban population of the hegemon is $P_u$, then our city will demand \[{P \over P_u}\] of the resources. This means that only \[{P P_r \over P_u}\] are specifically available to it. We can compare this number to the needed number $n$, and see that \[K_n = \min\left(K, {P P_r \over \alpha P_u}\right)\], that is, if there is enough manual labor, then the city can realize its full potential.

I grabbed a random capital to use for this, Chivenkare. Chivnekare has a population of $P=49920$, and $K\sim55000$. So it is a good test case. It has a good number of cities spread over a large island. Givne this, $n = 149760$. We find that $P_r = 177865$. Already we see danger signs, as Chivenkare is not the only city in its hegemon. However, $P_u = 85887$, so ${P \over P_u} = 0.58$, there may be hope yet.

Ultimately, we find that $K_n = 34460$, meaning that a huge famine is imminent. Sorry, fellas!

This implies a few things for the overall simulation:

  • Cities cut off from the major area of the hegemon will starve and collapse. This is true regardless of the diplomatic relations with the hegemon which surrounds it. Resources are scarce.
  • Hegemons at war could collapse very quickly as food runs out, even if they are technically winning overall. This would be a cascading collapse.
  • Another cascade could be precipitated by an unrelated catastrophic event.
  • Land will be a premium. My automata are not "smart," because they will not seek more land; but those unable to acquire it, spreading influence, infrastructure, and gaining rural working hands, will quickly perish. This mirrors the historical expansion and collapse of many empires, which outgrew their ability to feed themselves and were destroyed in short order.

May 23, 2019

Cities IV: Hinterland

Shockingly, people don't always live near major cities.

I was reading this post again, reminding me that there are places far from established "cities," especially in the general fantasy-scape common to D&D, and my world is no exception.

To be fair, my cities begin at a population of 150...which is barely a hamlet.

But - there should still be people a day's travel from a hamlet, working fields and digging mines. Not to mention providing warm bodies for the king's wars.

Right now, I don't spread infrastructure into hexes without a city. Instead, I'll try restricting it only from entering into a hex that is directly controlled by another hegemony. Then, the hegemony with the most infrastructure contribution can take ownership of that hinterland hex, with the tax revenue and military support that that entails. As far as gameplay goes, this might determine which hexes the ruler of the land grants to the players, or what kind of resistance they might encounter if they desire to clear a hex.

Infrastructure reach
Colored by hegemony
At first glance it looks ok, but I have some weird situations where the hinterlands are cut off from the heartlands. That's not entirely unheard of IRL, but I'd like to avoid it for now.

Much better

I'd like to go back in and add a line to the city expansion code. A new city may pop up within any hex that the hegemony controls, whether or not it's a direct neighbor. This will hopefully allow some spread-out empires as well, with some breathing room.

Not ideal

April 7, 2019

Demographics V: Urbanites

I've struggled for a while to come up with a reasonable mechanism to produce rural population numbers. The city numbers are determined by the growth system, but it doesn't account for those living outside the walls.

My first thoughts were that it should depend on the urbanization rate $u$ and infrastructure of the entire hegemony. Given $u$, the total urban population of the hegemony $P_u$, the total infrastructure of the hegemony $I_t$, and the local infrastructure $I_i$, I should be able to arrive at a reasonable rural population $P_r$: \[P_r = {I \over I_t} \left({P_u \over u} - P_u\right)\] So areas with high infrastructure will pull in a greater proportion of the total rural population. Makes sense at first.

But this can yield unreasonably high local densities. Considering the hegemony of Deribri. Deribri itself is quite small, and the more natural capital is the city of Guinrhyce (which is still in the Deribri hegemony). Guinrhyce has a population of $P_i = 44884$ and $I_i = 700$. For the Deribri kingdom/empire, $P_t = 939729$ and $I_t = 37787$. Assuming that $u$ is a function of $\bar{I}$, the average infrastructure of the hegemony, \[u\left(\bar{I}\right) = 0.96 \left(1-\exp\left(-\tau \bar{I}\right)\right) + 0.04\], where $\tau=0.00039$ is a constant which determines the speed at which the function varies, then $u\left(\bar{I}\right) = u\left(102\right) = 7.8\%$. This yields $P_r = 11108079$. Since the Kingdom of Deribri comprises 367 hexes, we can say that the population density of the entire kingdom is ${P_t + P_i \over 367 \cdot 347} = 94.605$ persons per square mile. This is pretty high. However, we can either 1) chalk it up to magic/it's my world, go kick rocks, 3) accept that the cities are too populous, or 3) increase the required distance between cities according to CPT.

Even if we accept a high density of 95 for the kingdom, there is still a really high local density based on the rural population. ${I_i \over I_t} = 1.852\%$, so Guinrhyce will support about $R_i = {I_i \over I_t} P_t = 206937$ people outside the city walls. This is a total hex density of ${P_i + R_i \over 347} = 706.409$ persons per square mile! Inside a city itself, this may be reasonable. But even leaving off the urban population still gives a density of around 600 pop/sqmi. Much too high.

However, it's still good to work through these things. These tools will be useful to approximate populations once I've reduced the overall city sizes appropriately.

March 29, 2019

Cities III: Toponymy

My generated names are too similar and there is no delineation between personal names and place names. What I'd like is a system to assign toponyms that are similar between settlements. This will aid player recognition (ha, who am I kidding) in terms of culture and personal names. Think, for example, the cities of Leningrad or Cardiff share elements with other cities in those countries, based on the toponyms -grad (place) and caer- (fort). Hence, it's unlikely that you would mistake, upon first hearing, that Petrograd and Caernarfon were personal names.

I'd be remiss if I did not mention this excellent series on naming places, over on Here Dragons Abound. This is a constant source of inspiration.

Since I have no database of names in real use, how do I find these toponyms? And how do I ensure they are consistently applied?

I'll start simply, by assuming that the name is terrain independent: no special convention for hills or mountains or valleys (Cwm Rhondda).

It should be fairly short, 4-5 letters.

It could be either a prefix or a post fix. But that'll need to be consistent.

Not every town will have the same version of the toponym. See the example above of Cardiff and Caernarfon. There are a couple of ways to do this (I might implement lenition rules in the future), but I think the easiest thing to do for now is to generate a new toponym that is within a threshold Levenshtein distance from an existing toponym. This'll account for differences in language and culture.

I won't do it by nation/hegemony (which I have yet to implement, coming soon with the political rules), I'll give each city a chance to take on a toponym similar or the same as that of the city which spawned it (I've been calling these "mother cities"). For now, I only track the mother city, but when I break the peace and install war/rebellion rules, the mother city may be in a different hegemony (even now it can be destroyed and no longer exist, but its children live on). This will preserve culture across national boundaries.

So when a city is being assigned a name, it will have a 20% chance of being assigned one of the current toponyms from its mother city's list. There is a 20% chance it will take a similar toponym, and 10% that it will create an entirely new one (which is then added to the mother's list). This will allow a bit of linguistic drift and everything won't be perfectly uniform.

Since the toponyms will be generated from the racial Markov chains, there should be similarities (but not replication) between, e.g., dwarfs and dwarfs, or orcs and orcs. A savvy player could perhaps pay attention to a town's name and discern some of the history and culture of that place.

Of course, in real history, settlement names change all the time for many reasons. But for now I'll keep names static. One thing at a time.

Let's try it out.

Mother city: Iowendawn, population 898, founded 3183 (human)

Toponyms: Umieu-, Teg-, Cos-
  • Uedestkamtowty, population 395, founded 3608
  • Umieuzowenki, population 1964, founded 3550
  • Umieuronwe, population 16079, founded 3178
  • Umieuaenkilbede, population 9566, founded 3275
  • Umieutamtopry, population 1254, founded 3520
  • Umieuprach, population 1503, founded 3601
  • Unostangel, population 1414, founded 3549
  • Umieudesogon, population 12765, founded 3157
  • Ukopach, population 1899, founded 3563
  • Tegcorwe, population 1799, founded 3092
  • Cosmadei, population 3411, founded 3549
  • Tegmorwen, population 229, founded 3405
  • Dustrys, population 333, founded 3602
It's not perfect, but I like it. It does expose a problem in that the names are generally very long, and the addition of a toponym makes it even worse. We want players to be able to say the names, after all (with a minimum of giggling). The answer lies in the Big Phoney package, which uses neural networks to categorize different syllables. It seems to work pretty well, translating the word into ARPABET:

Umieuaenkilbede $\rightarrow$ Y UW2 M UW0 AA1 NG K IH0 L B EH2 D $\rightarrow$ Yoom-yoo-ang-kil-behd $\rightarrow$ /juˌmuɑˈŋkɪlbɛˌd/

Uedestkamtowty $\rightarrow$ Y UW2 D IH0 S T K AE1 M T OW0 T IY0 $\rightarrow$ Yoo-dist-kam-toa-tea $\rightarrow$ /juˌdɪstkæˈmtoʊti/

I can use this to limit the number of syllables a word has, for ease of pronunciation. I have not been able to find an easy converter between ARPABET and IPA but that is not a priority (update: this package works). However, it's not terribly fast, so I may need to explore a less robust method. I could limit the overall word length to something more manageable, and use this to produce pronunciation guides for players.

February 21, 2019

History IV: Diminishing Returns

I had some good discussion on Reddit about the last post, and one thing that stood out to me in particular was the idea of diminishing returns for the effect of infrastructure on desirability. If the contribution is linear, existing infrastructure may quickly come to dominate the scene.

Year 2000, way too much growth? Colored by political entity

However, I think I still want a separate metric for new city placement. I think both of these are worth implementing to see how they affect population distribution. Disregarding infrastructure will be the easiest way to find a new spot for a totally new settlement, whereas a city expansion or colonization will want to stick close to the original and make use of existing infrastructure.

Year 500, colored by race
It is still curious to me how the geographic isolation of the dwarves results in a rapid growth of both cities and infrastructure. Humans should technically expand faster...but they don't. I look forward to exploring if this is merely an error in my code, or an example of emergent order.

February 8, 2019

History III: Beyond the Pale

After several thousand years of peaceful simulation, I noticed an interesting phenomenon.

Hexes are supposed to have a random chance to generate a new settlement. However, the location for these places is determined by the desirability of a place.

The desirability is partially determined by the local infrastructure.

This means, apparently, that when empires reach a critical mass, it's essentially impossible for any hex that's not adjacent to one of these empires to generate a settlement! So once the first few large coalitions are formed, no others ever do (at least, not geographically separated).

year 2160, human kingdom
That's one reason I end up with every dwarf in the world in a single megalithic empire. It also kinda looks like Scotland.

year 2160, dwarfen empire

This could be solved by maintaining a separate desirability index that does not take local infrastructure into account.

After 2160 years:
race
urban pop.
orc
52,567
halfling
1,315,550
human
2,282,919
dwarf
1,535,095
elf
524,542

And that's a total (including rural) population of 101,621,930. Not bad.

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.

January 23, 2019

Cities II: Names

Generating cities without names is so impersonal.

So I applied my Markov generator to them.

But I don't want them too similar to real-world names. So I decided to "mix" the models together.

For each race, I used the following recipes, with words taken from Swadesh lists (it's hard to find longer lists of more obscure words, but I'm continuously looking). I tried to pick interesting combinations, but I think this will need a lot more experimentation.

  • Orcish = Arabic + Somali. These might be too similar linguistically to give a good effect, but we will see. Qolim, Ishan, Hailid, Faris, Afalah
  • Elfish = Korean + Egyptian. And these might be too dissimilar. I've already noticed that one meme or another tends to dominate the name. Dohyungminseung, Miunghyun, Daehyeon, Petat, Aprieb
  • Dwarfish = Hmong + Egyptian. Khapet, Ziamakiuwel, Sualmayakam, Tirdjedjedi, Menkhteshi
  • Humanish = Welsh + Polish. Rznardir, Garybatawart, Nosty, Kwieb, Zhciach
  • Halflingish = Bokmal + Russian. Smalt, Ideryy, Flyondel, Mamme, Smannyy
Well, they're pronounceable, at least.

The models can be mixed even further, abstracting it into a second-order chain. So if a city is founded in a kingdom of 50% humans and 50% dwarfs, then I can create a combined chain from all the existing city names of those races.

January 22, 2019

Cities I: History II: Fall and Decline

The basic city growth model is \[\Delta P = B + D + I + E\], where $\Delta P$ is population change, $B$ is births, $D$ is deaths, $I$ is immigration, and $E$ is emigration.

I handle $B$ and $D$ with the logistic equation \[B - D = r P \left(1 - {P \over K}\right)\], where $K$ is the carrying capacity of the city. I want some randomness here also, so I add a bit of random walk. I also add some random walk to $r$ (the maximum rate of increase) and $K$, to account for changing conditions in the city's management, infrastructure, and what-have-you.

This leaves $I$ and $E$, which is a bit trickier. I read a lot of papers on this, which mostly deal with models for modern cities, where people often live in totally different cities. Since permanent immigration is due to many varied non-deterministic reasons, these terms often refer to the flow of workers between cities (who aren't necessarily permanent residents). These phenomena are pretty well studied, but that's not helpful to me.

So I figured that a certain percentage of people from a city would want to move someplace better. The bigger the difference in desirability ($\delta_j - \delta_i$), the more people who would try to move there, as long as the host could bear them. The number of migrants is then defined as \[M = {\delta_j - \delta_i \over 10\cdot \textrm{max}\left(\delta_j, \delta_i\right)} P_i\], where $i$ is the source and $j$ is the destination. This captures reverse flow, so I don't have to worry about which one is nicer. Since $\delta$ is already partially a function of $P$, the dense tend to get denser, to a point.

To make things more interesting, there's also a ~5% chance of a "disaster" striking (or perhaps a series of such) which decrease the population even further.

Here's a city undergoing these processes:

All of this assumes near-perfect growth, not to mention a maximum $K$ that's probably optimistic (around 100k or so, but with magic, who knows?). But more importantly, there is no war here. And that, my friends, will not do.

January 17, 2019

Infrastructure II: History I

Time to begin placing cities.

There are a few considerations to make when growing populations/cities organically.
  • Initial populations of villages are set to $P_0 = 150$. The growth equation at time $t$ then becomes \[P(t) = {K \over {1 + {K - P_0 \over P_0} e^{-r t}}}\] In the future, I'll actually progressively modify the population number, but for now I just evaluate this equation using the age of the city.
  • The carrying capacity $K$ is a function of the desirability $D$ of the location. \[K_0 = 5000 \exp\left(10 \left({D \over \textrm{max}(D)} - {1 \over 2}\right)\right)\]
  • $K$ is then modified according to Central Place Theory (CPT). One of the tenets of CPT is that cities are spaced according to the product of their populations and inversely to the distance between them. My method for doing this is as follows: the city in question is assigned a level $\ell = \log_{10} K_0 - 1$. $K_0$ is then reduced by a factor of 10 if $2 ^ i > \delta_c$ for all $i < \ell$, where $\delta_c$ is the distance to the closest city of the same $\ell$. So a city of 9500 people cannot be closer than 4 hexes to another similarly sized city. If it is, then $K_0$ is reduced by a factor of 10. This will hopefully ensure an exponential distribution of city sizes, and prevent a concentration of very large settlements.
  • $r$ will be a random number with a max of $2\% \cdot D \over \textrm{max}(D)$. This sets the maximum growth rate at 2%, but allows for a lot of variation in between. Maybe the different races should have different growth rates?
  • Any given hex which meets all other requirements has only a 5% chance of generating a city. I'll give this a little boost for particularly desirable places.
  • I won't force them to obey Zipf's Law, but I'm wondering how the distribution will shake out. Zipf's Law has been demonstrated to hold most true for "small cities" over 100,000 - for a fantasy low-tech world, that might be a "huge city" instead!
  • Another thing I need is a mechanism to destroy or stagnate a town - many things can affect a city's growth or longevity. Not every city built in 1000 BC still exists. In fact, most don't. Plague, famine, war, resource depletion, etc can all wipe out even large settlements.
  • A dynamic $K$ value might be cool also. That way a settlement might have a bright future, but overcrowding could really hurt long-term. As groups compete for resources, which larger cities need more of, smaller settlements tend to be crowded out. I need to capture that, and that might help my goal of CPT-arranged cities.

Some observations:
  • Since dwarfs (blue cities) are not "constrained" to the coast, their cities are placed much faster. This isn't necessarily a problem, but I want to consider how heavily the coast is weighted vs the inland. As a result, non-dwarfen cities are isolated, and have more difficulty coalescing into an entity.

  • The desirability map takes a dozen seconds or so to populate. This adds up and makes the year-by-year simulation very slow.
  • Similarly, it's expensive to figure out where roads should be placed so that they make sense. I've added some timeout functions to the road placement algorithm to make sure that A* doesn't get stuck somewhere it can't get out, but the constraints need some work. As shown in these images, it's made slower by the fact that eventually, every city gets a full 6 roads coming in and out.
  • Some of the orc cities (purple) behave well with roads, but there are no special road considerations for different races.
  • River crossings are a problem. They would be easier to implement if I used edges instead of tiles, but that would be a big pain to implement with the drainage code.
After 550 years of simulation, the total city populations are as follows (not including rural population, which is expected to be about 5x urban):

elf13,552,065
dwarf5,570,650
halfling11,144,894
orc28,884,984
human14,688,643
Orc growth is much faster because their cities form at great distances from the other, allowing for rapid growth and large carrying capacities from CPT. The opposite is true of the dwarfs: they have many cities, but densely packed, which reduces the maximum carrying capacity.

I could do more analysis of the cities, but I'd like to tackle the road problem first, since it feeds back into the city placement algorithm, and is the current bottleneck for any kind of long-term simulation.