November 13, 2019

History XXI: Cliodynamics IV

Of the tweaking of parameters there is no end.

I've had to suspend some of my own disbelief regarding civilization decay. For the most part, the simulation runs best if civilizations are allowed to grow to their fullest extent. Cliodynamic pressure can collapse a state but not (by itself) remove them from the map.

I also implemented a few changes for armed forces. Recall the distributions of the ages for each race. Each hegemony is then given a standing army based on the number of civilians between the ages of 15 and 50 (relative to human lifespan). This number is further reduced by 50% (since mostly males will fight), 10% (not all will be fit to fight), and 50% again (not all are willing). This article was helpful. Each year, the army is appreciated by new recruits and depreciated by those who die in battle. I'd like to find a way to depreciate retirees as well but without a cellular automation I'm not sure how just yet.

This significantly speeds up the battle simulation as a new military calculation is not required for each battle. In addition, armies can depreciate to the point where they are no longer viable. The amount of troops able to be concentrated at a single point of attack or defense is as follows: \[H = {A \over c} L(d)\], where $A$ is the army size, $c$ is the number of violent conflicts the hegemony is embroiled in, and $L(d)$ is a function of the distance $d$ between the capital and the point of battle. $L(d)$ encodes the army's logistical ability to supply distant points. Large armies can reach further but require additional support. \[L(d) = {1 \over \left({1 + {1 \over s}}\right)^d}\], where $s$ is the support parameter $s=2.82$.

One thing that becomes immediately apparent in the early years is the small troop sizes. A hegemony of approximately 10,000 people may only be able to support an army of 1000 or fewer (and that's at maximum $H$). In the first few hundred years, battle numbers are commonly in the dozens of troops, not thousands.

I tweaked some of the secession mechanics as well. I'd really like to implement some promotion and linearization but I have to think about how best to implement it and whether or not it'd be too computationally expensive. Currently there are still some issues where polities will either fracture into a billion competing hegemonies or glom together into massive, continent-spanning empires.


It's interesting that most polities haven't been able to stick around long enough to reach higher technologies. Most of them end up staying around Tech 6 or 7, which is barely past animal husbandry; a party in these areas would be hard pressed to find any kind of good gear or even wealth. But I suppose glory is always there for the taking.

October 17, 2019

History XX: Cliodynamics III

Continuing from here.

Recall these equations: \[\dot{\log N} = r_0 \log N \left(1 - {\log N \over k_\textrm{max} - c W}\right) - d \log N W\] \[\dot{\Xi} = \rho_0 \log N \left(1 - {\log N \over k_\textrm{max} - c W}\right) - b \log N\] \[\dot{W} = a \log N^2 - b W - \alpha \Xi\], where $N$ is the population, $\Xi$ is the power of the state, and $W$ is the intensity of warfare.

Turchin's original works don't make it very clear that these are log-scaled numbers. I decided to track this discretely for each individual city, so I imagine there will be a handful of second-order effects.

This does result in some pretty intense cycling.
$S$ in red, $A$ in blue
The total area fluctuates over about 200 years, while the $S$ lags that pattern slightly. I'm trying to think of a good way to tie $W$ or $\Xi$ to $S$, so that internal conflict will not arise when $S$ is high and collective solidarity is strong.

However, an error in the code (neglecting to restrict $k_\textrm{max} - c W$ to positive values) resulted in a situation where populations skyrocketed to billions of people in a single city.

Fixing that error introduced another artifact where it was extremely difficult for any significant hegemonies to arise and stabilize. The largest city topped out at less than 1500 inhabitants: barely a village.

The timescale is appropriate at about 200 years. But we want something more in terms of population, especially if we want the PCs to be able to have steel weapons and access to higher forms of magic such as wizardry and bardic training.

With some work, this could be tweaked to account for the longer lifespans of different races, if that's a thing in your game. If your elves live to 1000, their empires are more likely to last around 2000 years instead.

September 11, 2019

History XIX: Cliodynamics II

Continuing from here.

I'm still a little confused how Turchin's original spatial simulation could collapse at all, given an $S_\textrm{crit}=0.003$. Theoretically, this implies a frontier of 3 to a total area of 1000. My calculations indicate that this could be achieved by a circular area of radius 666 (oddly enough). Which is absolutely enormous. In his real-world simulations, he implements a restriction on what constitutes a frontier space, and this makes much more sense in terms of generating low $S$. Adjusting $S_\textrm{crit}$ doesn't help much: even at $S_\textrm{crit}=0.02$, the theoretical empire is three times the size of Europe before it undergoes spontaneous collapse.
A few more changes to implement before the next run:
  • Mountains and rivers make $S$ decay more slowly.
  • Cities can now send settlers as soon as they reach a population of $2P_0=300$.
  • However, only hexes which derive at least 25% of their infrastructure from the parent city can be settled. This forces a condition where capitals must be dependent on growth from their satellite hubs at a certain point.
Let's see how these do.
$S$ in red; $A$ in blue (hinterlands in light blue dashed, cities in darker blue dashed)
$P$
One interesting thing I noticed right away was that the population of the largest cities (and then the kingdoms) quickly stabilized. No fresh blood was available to work the fields, and all resources were efficiently distributed with no surplus. No new cities could form because of the rules listed above. In the absence of mechanisms to shake up the existing power structure, the hegemony remained in relative status. $S$ and $P$ fluctuated somewhat, based mostly in this case on fluctuations in the population of the largest city moving around a transition point.

Because my cities are grown from scratch, there is a practical limitation on how soon they can "meet" and create metaethnic frontiers. In almost all cases, a hegemony is surrounded not by other hegemonies, but by the wilderness, which should certainly provide enough danger to increase collective solidarity.

However, a random troll in the wilderness is not as dangerous to society as another hegemony who might be eyeing your infrastructure and resources. To this end, I can consider increasing $S\to0.25$ or a similar value in cases where the frontier is not a metaethnic border but a wilderness border.

How does that help?

Better! Interesting that $S$ begins to increase as the total $A$ does - it looks like this is when Mengj starts to bump up against other competing hegemonies.

More things to try:

September 9, 2019

History XVIII: Cliodynamics I

I have recently been reading up on cliodynamics, which is the application of mathematical models to historical population sociodynamics. If this sounds familiar, that's because it's exactly what I've been doing for the last few months. So it's good to put a name on it.

One thing that particularly interests me is the theory of social collapse. This is something that's been missing from my own work, try as I might. I think that cliodynamics might be able to help me answer this question.

In one of his models, Peter Turchin defines a measure called asabiya, which is an Arabic term implying social cohesion. Turchin applies this in a simulation by logistically raising the asabiya of a hinterland/border cell to 1, while internal cells exponentially decay to 0. If the average asabiya of a whole hegemony reaches a critical value, the entire thing collapses. \[S_{t+1} = S_t + r_0 S_ t (1 - S_t)\] \[S_{t+1} = S_t - \delta S_t\]
The effect of this is that empires should only last about 200 years on median, which is much closer to the real world than the massive empires I've been dealing with. Once a critical mass is reached, my empires last...forever. There's no real pressure to collapse, barring a random extinction event such as a plague.

Another paper in the same vein explores secession and hierarchy elements in a manner that is very similar to mine. So I'm happy to synthesize it into my body of knowledge.

However, I still need to account for the size to asabiya feedback mechanism. In all these models, the size of the polity $A(t)$ is part of a larger model which is affected by $S(t)$ (the asabiya), or even the metaasabiya $R(t)$. My own $A(t)$ is determined by the growth of cities and their infrastructure reach.

Therefore, I'm going to pull in another model developed by Turchin to correlate population $N$, state resources $S$, and internal warfare $W$. This provides a way to "hook into" the $K$ carrying capacity mechanism and thereby connect the two models. In particular, we have: \[\dot{N} = r_0 N \left(1 - {N \over k_\textrm{max} - c W}\right) - d N W\] \[\dot{S} = \rho_0 N \left(1 - {N \over k_\textrm{max} - c W}\right) - b N\] \[\dot{W} = a N^2 - b W - \alpha S\]
So as population $N$ varies, it will affect total area $A$ and therefore $S$ (I don't know why he uses the same variable for asabiya and state resources).

The question is how to discretize this function. The model as given is a hegemony/polity-level equation, governing the total state. Therefore, I have to scale W to the individual city:\[\dot{N_i} = r_0 N_i \left(1 - {N_i \over k_{i,\textrm{max}} - c W {N_i\over\sum_j N_j}}\right) - d N_i W {N_i\over\sum_j N_j}\]

I also don't have to collapse the entire hegemony at once if the critical point $S_{crit}$ is reached. Normally, secession is controlled by a loyalty variable. I'll still maintain this, but I'll also make secession likely to happen if the average asabiya is below the critical point, regardless of loyalty score. This will cause quick collapse if the empire overextends itself but also provides an opportunity for it to "recover" after that collapse.

First: some testing of the basic asabiya concept. I'll run the model as normal, while keeping track of what the asabiya should be. Then examine which hegemonies should have collapsed. The only change I'll make to the normal model is to suppress other collapsing mechanisms such as surrender and secession.

Initially, I thought that I should use the area-dependent asabiya model: \[S_{t+1} = S_t + r_0 \left(1 - {A \over 2 b}\right) S_ t (1 - S_t)\] to account for the size of the polity. This proved to a very strong feedback effect to the point where $S$ decayed to its end-state nearly immediately.

Examining the largest hegemony (the Thav empire) using the non-area-dependent model:
S (red), A (blue): over time
It quickly becomes clear that there is an effect introduced by Turchin's simulation space which accelerates empire demise. Here, the asabiya of this large empire does not drop even close to the $S_\textrm{crit}=0.003$ value which provides Turchin with such historical variation. I believe this to be due to a few factors.

In these early stages of implementation, there is still no feedback from $S\to A$. Therefore, there can be no collapsing mechanism as $S$ enters a positive (and mutually destructive) feedback loop. There are a couple of places I can connect this loop. The first is in terms of warfare escalation. If the power differential between two hegemonies is above a threshold, it becomes more likely that the stronger will invade. Individual hex power is defined by the following equation: \[P = A \bar S \exp(-d/h)\], where $d$ is the distance from the capital and $h$ is a drop-off factor usually equal to 2. We can average this for every hex in the hegemony to determine the $\bar P$ for the hegemony. In the case of Thav above, $\bar P = 4.72036$. This will also be interesting to examine over time to see if it's useful anywhere else.

The largest hegemony during this 500-year run is the Winan empire:


The jump in $A$ appears to be directly attributable to the expansion mechanic kicking in around 335. All of a sudden, the few (4) cities that Winan has conquered begin pumping out colony cities. This dramatically increases the reach of the empire, which has a detrimental effect on $S$. From this and the Thav simulation we can see that it takes between 300-400 years for a city to grow to expansion size (under the current rules).

Of course, there is no law in the real world that demands that settlements refuse to send out settlers unless they have more than 5000 people. But these rules are justified elsewhere on this blog.

Looking at overall power:

There's a slight bump during the initial expansive "golden age", but this quickly returns to what appears to be a pretty steady number. The interesting thing is that $\bar P$ appears to be steady regardless of the continued movement of $S$ or $A$.

The other place is in the infrastructure spread calculation. Remember that as cities grow, they spread their influence, creating new borderlands for the empire (and eventually butting heads with other empires). What if this growth (already affected by terrain) were also affected by the power of the city in question? More powerful cities could spread their influence further and vice versa. In addition, when Turchin applies this model to real-world conditions, he imposes an additional constraint that regions must experience a certain amount of cultural conflict to be considered true "frontiers." For example, linguistic and religious borders contributed to this intensity score. That shouldn't be terribly difficult to implement. I'll try these next time.

Through all this, I feel very much as if I'm exploring an actual history. Although it's shaped by my own decisions and preconditions, on net it's stochastic to feel alien. And that's pretty cool.

August 9, 2019

History XVII: Cradle of Civilizations

I have been working mostly on updates to the code. Now it runs a little smoother.

To this point, I've been randomly placing cities across the map. Because each race has a highly preferred climate, this usually means that, e.g., elven cities will all end up in roughly the same place. But occasionally there will be a city placed far across the map, on the other side of the world.

I'm not, for the moment, interested in creating a grand mythology. They're cool, and maybe I'll work on some lore at some point, but for now it's irrelevant. However, I do wonder if a single-origin point for each race wouldn't give even more verisimilitude.

The first settlement (for each race) will be randomly placed. Each subsequent city must then be a specific distance from an existing settlement. This can model expansion from a single-origin point.

If the initial city is not in an optimally desirable location, then migration should naturally occur up towards those optimal locations.


Seems good-ish so far. I think the city generation ought to be a bit higher to account for the additional constraints.With this model, none of the races would have met another "civilized" race yet after 1200 years.

Whether that's likely or not is up to the discretion of the reader.

Stranger Railroads

SPOILERS AHEAD

Yes, yes, I know that Stranger Things is responsible for "helping revive" mainstream interest in D&D.

Who cares?

The people making money off of D&D, of course. The hobby is not significantly enriched by this.

In fact, it's hurt.

This is the same effect that brought us the vapidity of 5th edition, reinforced by high budget dramatic productions which pretend to play D&D.

Stranger Things S3 is no different. Its heavy-handed lip service sends the message that this way to "play" is not only acceptable, but desirable.

All season long, Will wants to play D&D with his friends, who are increasingly mired with girl-problems. When he finally gets his board and story set up, he is able to force them to sit at the table. Conveniently hidden from accountability behind his screen, he railroads their characters through his plot with the subtlety of John Henry's hammer.

In the Stranger Things game philosophy, the players must dance to the DM's tune. There is no opportunity for the players to make choices. Only false choices can be presented, otherwise the "game" (of course, it's not really a game) is ruined.

Fed up, Mike makes a choice. And it's a good one! To save the village (why do they care) and become heroes (which, of course, is the only possible outcome of this so-called game), they must defeat the zombies. Mike decides that the best option is to ignite the room they are in, killing the party but also the zombies and living on forever as heroes.

Of course, in the grand scheme of the season, this is a signpost to the climatic scene. But more importantly, it's a deviation from the Supreme Overload Will's script. "You can't do that!" he whines. Why not? It's the only meaningful choice the players have made!

Without these meaningful choices, the game is not a game. It's just a series of guesses to see which way the DM wants the party to go; and never fear, you can't guess wrong. Sure, you have "agency" as long as you select from the following pre-approved list of actions.

Don't worry, you can't make the wrong choice, because all roads lead to the same point.

Which leads me to ask, what's the point?

July 16, 2019

Resources XXI: Aurochs

The auroch was a breed of very large cattle which went extinct in the 1600s. Rather than a generic "cattle" reference, I want to use them for a bit more exotic feel.


Since we have no live aurochs, I'm going to use stats for the Indian gaur, another very large taurine, as my base.


An auroch calf weighs about 50 lbs at birth. Based on current calf prices relative to gold, a reference of gold can purchase 15,000 head of calves. They are found in A/B/C Koppen climates.

A calf is economically useful after it's been weaned, which for aurochs is approximately 8 months. During this time, there is already a material upkeep cost because the mother's milk is gradually being replaced by solid food. This is factored as an upkeep cost even if the animal is largely grazing, because any forage the auroch gets off my land is potential food I can't grow and sell; it is a sacrificial investment. Overall, this works out to 483 pounds of food, selected by the lowest price available in the region.

Once the calf is weaned (about 200 lb), its food uptake is significantly increased. The animal will eat about 2% of its body weight per day for the next 2 years and 4 months (more or less). This is 23,679 pounds of food up to its full weight (2,500 lb).

Each of these costs is mixed with the labor of local herdsmen, which increases the cost somewhat. However, herdsmen are usually in good supply and so the added labor cost is generally low.

This makes a full-grown auroch quite valuable (depending on the cost of feed). This cost will be used to determine the local costs for meat, leather, horn, and bone glue (and perhaps other things, but these are the most important for now).

Looking at the city of Kwazfulnis (population: 3896 dwarfs, 795humans, 237 halflings, 101 elves): you can get a calf for about a copper; but a weaned calf will cost you 28 sp, and a fully grown beast is 141 gp!

It's possible these prices don't make sense. I feel like every time I look at my base commodities table I see another mistake to correct. But I'm making slow progress, and I'm more concerned that the system work flawlessly (or good enough) so that updates/corrections can be made more easily.

July 15, 2019

Trade V: Money Makes the World Go Round

The fantasy economy runs on gold.

But gold is rare.

Yet trade still manages to happen. How?

My world is very disconnected. There are many separate networks which do not interact at all: the tech level is too low, the roads haven't been built, the markets aren't connected.

Many places do not have any gold at all.

But they have silver.

So what I've done is check each sub-network to see if gold is available. If it is, all is well. If not, we move to a silver standard. If (and this is more rare still), silver is not available either, I fix the price of chalcopyrite, since copper is a Stage 1 good (gold and silver are both Stage 0). If copper is not available, you're out of luck; for now anyway. If I add another precious metal it should be easy enough to go back and add it into this selector. So eventually, everyone should have something to base a coinage economy on.

I do think it might be worth it to adjust the rarity of gold. In the iteration I'm testing at the moment, I have 10 gold mines for 17,290 settled hexes. That's an occurrence of about 0.058%, whereas gold should be around 0.3%. Of course, there is more gold...it just hasn't been found yet. In reality, it's a little higher than the target, around 0.5%. I think I'll add a stronger effect on desirability since gold is so important.

July 10, 2019

History XVI: Loyalty

Based on a comment by Scott.

Each new settlement begins with a loyalty of 0. This score will increase or decrease over time, stochastically.

Positive effects include: being the capital and being surrounded with other cities of the same hegemony.

Negative effects include: being of a different race than the capital city, being in an enclave, and starvation.

A low loyalty will not immediately incite rebellion. A negative loyalty will, however, make it possible, and lower the bar to rebel. Because the score moves semi-randomly (nudged by the factors above), it's possible for a town to pull back from the brink, as it were.

Cities which are conquered have their loyalties reset to 0. Previously, towns would trade hands and rebel constantly, and a kingdom would put down a rebellion only to have it erupt again the next year. With the loyalty score, that behavior is still possible, but tempered. Depending on the random outcome, peace and order may be restored, or not.

This can also have effects during war. A disloyal city, faced with the threat of attack, will simply surrender.


Speaking of war, I fixed a "small bug" where nations would claim to be at war and then not do any actual fighting. This is odd because the normal way of doing things today is to do a lot of fighting and then claim to not be at war at all.

June 26, 2019

Detail VI: Lakes

Adding lakes was easy once I decided that I wasn't going to approach the beautiful detail of Undiscovered Worlds. All I need is a representation of a concept (which, at its heart, is the essence of a map anyway).

Low-quality lakes are easy to make. All I do is find where two rivers meet, then expand the lake around that point, flowing into any lower hexes. Usually, this means I end up with lots of long "lakes" which simply follow the river. This is a side effect of the terrain generation.


Still, small inconsistencies in the system are outweighed by its usefulness (and can always be addressed later). I can search over my 20-hex world map, find a place that looks interesting, and generate it quickly in detail.


One thing that inevitably comes to mind is just how much of this country is wild...but at the same time, there are a good number of scattered villages. How much conflict happens here between the humanoids and their encroaching civilization and the intelligent creatures who want to stay put? A good deal, I'll reckon. Not to mention, with a couple good scouts in your party, you might be able to hide from the law here for years. That's a lot of area to search.

I do have plans to implement a suggestion from Scott and blend the terrain edges together more smoothly.

Now if only I could get a proper SVG to PNG export...Inkscape is ok for some things but my installation has proved miserable when it comes to applying filters and blends.