December 28, 2019

Prehistory I

I alluded to this mechanism in the previous post. I want to see how tribal hunter-gatherer societies, with small carrying capacities (around Dunbar's number) spread and grow through time without the added constraints of the full historical generator.

Each tribal polity can only occupy one hex at a time (not a strictly realistic assumption, but we can simply say that there are no other polities of note in the area). Carrying capacity $K$ decreases as resources in the hex are used up. Once $K$ converges with the population size, the tribe must either move or split to maintain balance. When a tribe leaves, the area begins to recover.


There are certain hexes with a high desirability which serve as generators: once a tribe reaches one, there's never any incentive to leave, and so more and more tribes are spun off as a result. When I add discoveries, these will become probable Ur-city locations.

The desirability issue is particularly obvious when a saturation point is reached. I've not yet added oceanic migration, so the tribes bounce around from place to place like so many gas molecules in a closed container.



(I feel compelled to point out that 1500 years is a pretty long time. In 519 AD, the Kingdom of Wessex was founded. In fantasy, we typically deal with deep-time related to people groups - thousand year reigns are not unusual. In real life, empires are generally much more temporary.)

This simulation progresses much faster than the "civilized" simulation, due to code rewrites and the fact that these tribes aren't doing much other than running around and eating all the wildlife.

In these first runs, I noticed that the raw desirability, which is the main selection factor, is far too high for areas that humans (the only race I'm working with for exploratory purposes) would normally avoid, such as deep tundra. So that will need to be fixed. I also want to add a mechanism for tribal warfare, if there is a some greener grass on the other side but it's occupied already.


December 12, 2019

History XXII: R&D

I have long been fascinated by the Worlds: History project. Go check it out.

One idea I'd like to steal gain inspiration from is the discovery system. People groups have chances to learn new technologies over time (or even lose them). It's quite comprehensive in design if not fully filled out.

I love this. Conceptually, it should synthesize with my existing tech tree, yielding at least the following benefits:
  1. Prehistory is now possible; Year 0 doesn't necessarily start with the first city, and every polity doesn't begin with a city/settlement.
  2. Tribes/polities should be able to migrate more rapidly, reaching more area of the planet's surface.
  3. Technology will be different in different areas. This already exists but is fairly deterministic, based on population density. If your density is X, then you have agriculture, for example. This is captured by the tech level.
The downsides? It's a whole 'nother branch of work for me in addition to all of the research I'm already doing. So it might be useful to build it as a toggled mod. Additionally, DrTardigrade is working on timescales many factors larger than mine.

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.

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 19, 2019

Detail V | Roads VIII

Roads are easier than rivers because they do not shape the terrain they "flow" through as rivers do. I thought they would be more complicated but they turned out to be quite simple.

The river ingress and egress hexes are found by doing a transform on the character values of the strings of the names of the hexes. This gives a nice stochastic but repeatable location. For the roads, I simply reverse the inputs. Badabingbadaboom.

The roads (which are defined at the 20-hex level) enter the hex and make their way to the 1-hex with the highest infrastructure, which is located on the river and is assumed to be the settlement center. Where there are no roads, there are trails. Trails may or may not be well maintained, and they are not suitable for significant trade. But they allow transportation of goods and supplies to and from remote outposts such as mines which may not have access to a main trade road. Again, these trails all seek the assumed central hex.

Trails are also defined at the 20-hex level to connect settlements with low infrastructures. Generally speaking, a road will only occur through a 20-hex with $I\geq 50$. An exception is made if the road is being laid (and maintained) from capital to capital. Therefore, trails are used instead to connect lower $I$ settlements as well as provide access to hinterlands.

Darker hexes are less civilized, road in red

As a note on the trade system: only 20-hexes with a road can have a market. If your settlement has no market, you'll have to travel to find one. All goods produced in a 20-hex without a market must find their way down a trail to somewhere they can be sold. Therefore, for the purposes of the system, these goods are credited as being produced in the market settlement, even though their physical location might be different. My trade system engine assigns them to the market which is closest in the network.

This raises interesting gameplay situations. Most people in these remote locations would either make their own tools or carefully guard something they took a specific trip to buy. Very rarely would a merchant make their way down these dangerous and unfriendly trails to sell their wares. Plan accordingly.

June 18, 2019

History XVI: God Gave a Loaf to Every Bird

The famine mechanic is killing city development. As it should! However, it's too much. Nothing can develop past a few thousand people. Since rural population is dependent on infrastructure, neither can ever increase to the point where actual substantial growth is possible. And that's with a very generous assumption that it only takes 2-3 farmers to feed one urban dweller. Some estimates put this as high as 9.

We want a situation where some settlements can grow and others die out, or where a settlement can be cut off in time of war.

As a "temporary" stop-gap, I've increased the population density significantly in rural areas. This gives you more food-producers. However, starvation still does restrict nation formation. I haven't found a case yet where starvation will completely wipe out a civilization, but it proves significant in politics in the following ways:

Starvation naturally reduces hegemony morale. It can affect it so much that when a larger nation comes knocking on the door, the food-restrained nation acquiesces without a fight. But this in turn can cause problems for the conquerors, who have possibly bitten off more than they can chew.

In addition, hegemonies with very low morale (but no war) are much more likely to experience secession, as cities with large enough infrastructure may feel they're better off striking out on their own. They may or may not be correct.

All of this makes for a complex interplay of resources and politics.

It is very interesting how, watching lines grow in a text file, how I tend to anthropomorphize these collections of bits. I feel national pride swell when a city throws off the yoke of an oppressor, or defeats a stronger neighbor. Let's tell a story.

Menesesese was an elven city founded in 645, in a jungle climate. They named their new civilization Menese. Although they would experience a few major disasters over the years (in 857, 1289, and 1401), they lived in peace with their older neighbor, another elven city called Moterure, which had been founded in 24, six centuries before. By 1543, Mote had founded 8 more cities down the coastline, stretching down to Menesesese.

However, in 1613, Mote attacked and defeated Menesesese, incorporating it into their growing kingdom. This would last until 2185, when Menesesese rebelled, forming the Menesesese hegemony again (I need to add some code so the rebellious hegemon will take its original name, Menese, not the name of the city, which may have prefixes or suffixes as it does in this case).

From 2195-2198, Mote and Menesesese would fight over the cities of Ritikerure, Chorcliste, Mieprure, Wenafrure, Interure, Chorvetek, and Chordmose. Unfortunately, Chrovetek was totally destroyed during the First Mote-Menesesese War. Although Moterure itself did not fall, nearly all its cities now lay in the hands of the Menesesese...-ese. Mote would starve and shrink over the next 50 years.

In 2258, relations again deteriorated, but this time Moterure was more than willing to accept Menesesese rule. Alas, this peace too was not to last, as Mote would rebel only nine years later in 2267, taking with them the cities of Magirure, Neferirure, Savcerure, and Raprurure.

Over the next 1600 years, this story would play out again and again. Cities were destroyed and castles built. As I write this, the simulation is in year 3950. The Twelfth Moterure-Menesesese War ended in 3882. And it surely will not be the last.


This provides me a rich tapestry for a game set around this region. There is plenty of wilderness space, but even the loosely populated landscape is dotted with ruins, reminders of the hatred between these two nations that spans three millennia. I know where all the battles were fought (and where great generals might have fallen and grand items lost), where the ruined cities are located (and where the ghosts of the slain still wander). There are old elves who still fought in the last war...there is peace now, but for how long, they ask? Never trust a Mote. You better be careful not to look too Menesesese in the Neferirure market.

And all of it out of whole cloth.

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.

June 11, 2019

Detail IV: Wilderness Colors

I've just been using a dark and light green to indicate wild and settled terrain. But I need to match that to the actual terrain colors from the 20-hex map.

I really like Welsh Piper's hex generation mechanism so I'll be borrowing some thoughts from here. For now, I'll just define a primary type, a secondary type, and a settled type.

Sometimes, settled will be the same color as unsettled. For example, the halflings, who live in icy terrain, wouldn't be able to grow cropland. In this case, I'll define something like settled = primary, where ice is primary and rock is secondary. So the settled areas are still delineated.

However, most of my test cases right now are in forested areas, so I'll concentrate on those. All those areas turn into grassland type when settled, at least in terms of display. I've also put a pattern over the wild 1-hexes to visually differentiate them if the secondary type is also grassland.

Blitpsy, population 4976, infrastructure 84

I also implemented a condition where the highest infrastructure hex must be on a river. This ensures that a settlement (when I get around to placing them) will always have access to the river.

South of Blitspy, starting to transition into grassland, some of which is settled and some which is not

Speaking of rivers and colors, I'm not sure the river stands out enough. I also kind of want to make the river a bit more fractalized, but I remember that I'm making a representation, a symbolic map, not a literal terrain map.

It does seem that the heightmap (which is shown by lightning the hex the higher you go) is almost invisible. That's fine; it'll mostly be important for determining the rivers and roads.

To do: roads, coastal 20-hexes, and river sources.

June 10, 2019

Detail III: Infrastructure

I have been thinking more about how to generate infrastructure for the detailed hexes. I've floated a few ideas here and there which seem to work well, but I thought of an interesting situation where the current system might give odd results.

To sum up, the infrastructure number of a 20-mile hex will indicate how many of the 400 1-mile hexes will be settled. For ease of experiment, let's assume that the 20-hex is forested, and that the settled 1-hexes are cleared land (whether for grazing animals or for houses, doesn't matter yet).

Previously, I was just using the infrastructure number as the number of settled 1-hexes, up to a maximum of 400, at which point the hex would be totally settled. But after reading this post several more times, I believe I can come up with a more robust system.

The problem is that infrastructure spread stops at the boundaries of a hegemony. This means there is a possibility of a hard edge where there is a totally settled 20-hex ($I\geq 400$) next to a relatively unsettled 20-hex (say, $I=10$). The whole point of the detailed 1-hex view is to give a smooth interpolation between discrete 20-hexes.

So what's the point?
The Tao (Alexis) uses 2-mile or 6-mile hexes, allowing a smoother interpolation because the detail is not as fine. With the 1-hex, there are 400 hexes that must be made to play nice. He gives a chart, however, detailing the behavior of each hex type and group depending on the number of wilderness hexes that surround it. 2-hexes which are completely settled (Type I) contribute 64 points of infrastructure to the total, and so on down the line. Read the links for more info, I won't rehash it here.

Since I'm not dealing with hex groups directly, I need a way to translate or spring-board off this existing system of ideas into my own map. I will define groups of 1-hexes in the following way: counting the 1-hex itself and the surrounding 6 hexes, how many are wild (of the 7 total)? This gives us 8 total types. Furthermore (and here's the distinctive key): these groups are not discrete. Each hex contributes not only to its own group type, but also those of its neighbors. In this way, the combinations are made even more unique...if it works.

TypeAdjacent SettledInfrastructure
I77
II66
III55
IV44
V33
VI22
VII11
VIII00

This has some interesting implications. Observe the minimum situation for a Type I hex:



The very presence of the Type I implies a further 6 Type IVs. That's a total of 31, if the above values are used.

Type II (total 24):


Type III (from here on out, I've tried to show the lowest configuration, there are others that could be higher, total 17):


Type IV (total 12):


Type V (total 7):


Type VI (total 4):


Type VII (total 1):



So how do I make this work? I'll start with a brute force approach.

It's very quick to run an algorithm over the 20-hex and get the total infrastructure number based on the 1-hexes. So what I'll do is gradually increase the number of settled 1-hexes and check the number. When I reach the target number, I'm done.

So far, this works pretty well.

$I=113$
Let's try it out for a stark difference. The top hex has $I=1000$, and the bottom two, $I=10$.


Not bad! The edge is still pretty hard...but not as hard. Furthermore, the individual hex groups could be identified for feature placement.

An issue with the infrastructure values for each hex type: The higher the numbers go, the fewer 1-hexes will end up on the final map. Earlier, I had defined 400 as the value of a filled 20-hex: but with the new system, a 20-hex must have $I=2268$. That's pretty high. But it does imply 346 sq. mi. of continuously occupied land (including farmland).

Finally, each iteration is totally random. I want a way to save them so if I come back later, or make a map for a game, I can reproduce it. Each configuration is extremely unique, and so I need a fingerprint. There are a couple of ways I can do it, but here's a very simple one.

First, I sort the hexes by their address, then assign 1 for settled and 0 for wilderness. Then I join all those numbers into a long binary string, padded to 400 zeros. For $I=1000$, that looks like this:
0b0000010000000000000010010011000100000000000000001000000000000000000001000000001001110000000000000101000000010000010000000000100000000010101010000100000010010000010001001000000000001000000011100000000000100000000001000100010010100000001101010000110010000000001000000010000000000000000010000100000000001000000000010000000000000000000010000000000100001000001001000100000000101000001011000100110000010000
But that's super long! So instead, I'll convert that number into hexadecimal. It's still long, but manageable.
0x400093100008000040270005010400802a840904480080e00200444a0350c802020000840080100000801082440282c4c10
I can save this fingerprint for use with this specific hex. When I'm recreating it, I can just pass the seed back to the generator. It's very simple. I think I should try and implement it for the height and river data, but that will require some extra thinking.

June 7, 2019

History XIV: Here I Stand (Summary)

I thought for a bit on how to present a total overview of the system (suggested by Ted), but there are so many moving parts. Still, it's good to sit down and think about it a bit.


This ought to help in keeping things straight. Or perhaps it makes it even more confusing.

It's clear there are several feedback loops: most notably that the city growth rate is affected by the overall tech level of the hegemony. This provides a significant obstacle to small starting cities, but gives a boost to established empires. The loops keep things interesting. In addition, many of these links involve some randomness, which means that things will generally tend in the same direction each time I run the whole simulation, but it's never going to be exactly the same.

Desirability is a value, expressed as a percentage, which describes how desirable a piece of land is for settlement. Each race prefers a different arrangement of terrain and weather. The desirability value will affect how large a settlement can arise in a hex, and also captures the number of resources available there (whether or not they are being totally utilized). Because the resource allotment code adds complexity and time to the history simulation, the desirability is used as an approximation of resources in the battle simulator (since a settlement with access to more physical resources will have an inevitable edge over their adversary). Raw desirability is the desirability in the absence of civilization; it is mixed with infrastructure to obtain a measure of desirability for city expansion, when an existing settlement sends out settlers.

Infrastructure is an integer which describes the effect of settlements on surrounding terrain. Although the Tao only uses elevation to limit the spread of infrastructure, I also include local effects such as forest or desert. I also make infrastructure "flow" downriver easier than upstream. A high enough infrastructure (over 400, for now) changes a forested hex into plains or grassland, depending on the local climate (which is a feedback element encouraging a more efficient infrastructure spread). A higher infrastructure implies a better training mechanism for soldiers. Infrastructure spreads from every settlement in a hegemony and stops at the border.

Hexes with infrastructure but no settlement are the hinterlands; they are prime candidates for future settlements. Since the hinterlands are populated (however sparse), reinforcements can be press-ganged. Generally, however, their population is very low. The rural population of any hex with an infrastructure value is an exponential function of that infrastructure number.

If the effect of a hegemony's capital (measured in % of total infrastructure in a hex) drops too low, and a city's self-generated infrastructure is high enough (100), then a rebellion is possible.

Available resources (which are fed into the market system, not shown) are acquired by cross-referencing the available resources (which is somewhat determined by terrain) with the resource definitions. Certain resources cannot be extracted by low-tech cultures, but may become available as the hegemony grows.

The Long-awaited GitLab. There is no README yet: I've been working on this for two years now, and so the code is a garbled mess in places and cleaner in others. Eventually I'll get around to some housekeeping. Enter at your own risk.

June 6, 2019

History XIII: Every Manly Heart is Bounding

Not every war is a total war. More often than not, the loser realizes they're fighting a futile war and they surrender. I'll implement a morale score to keep track of this, as suggested by Lance.

Morale goes down when a successful attack is launched against you or a random natural disaster occurs. It goes up when a successful attack is launched by your forces, or you repel an invader. In addition, morale will creep up every year by a small amount.

Because the potential for disaster is very high (0.1% across all cities), and morale is a hegemonic property, morale will tend to drop much quicker than it can rise (absent success in war). This also implies that larger hegemonies will collapse (speaking in morale terms) much sooner than small ones.

If a hegemony's morale (measured from 0-100%) drops below a critical level (10%), it will unconditionally surrender. This is a bit brute force; these surrenders could be very complicated, with vassal states being formed, or a simple exchange of cities, or a total assumption into the conquering kingdom. This latter situation will be enforced, at least until I tackle the vassal state code.

An interesting situation arose where the city of Pawsapa rebelled against the Khare hegemony (a dwarven kingdom of appreciable size) and then destroyed several cities and conquered others, eventually forcing the outlying settlements to declare fealty to Pawsapa instead of Khare. Vieskhare (the founding city) had been established nearly 2600 years before, but a series of natural disasters left her vulnerable to rebellion. A sad story (if you're a Kharen nationalist).

There's also a bug where a large city which surrenders will immediately trigger the secession code and rebel again, forming a new hegemony with a full morale (albeit usually giving up a few cities). It might be a feature instead...

I'm sure I'll continue to tweak the exact values, but the mechanism is at least in place.



May 31, 2019

History XII: I Was a Sword in the Hand-grip

The scourge of perfect vs imperfect information continues.

Wins in blue, losses in red. Number of forces for A and D

From this we see that larger forces win battles, overwhelmingly. That's somewhat of an obvious conclusion. However, we should instead look at the battles which subverted mere numbers.

Ratio of force sizes to ratio of killing rate. Wins in blue, losses in red.

Very rare, and the ones that do have a significant power advantage, as shown by the $\alpha/\delta$ ratio. However, it's also interesting that the attacker can sometimes lose despite a numbers advantage. It's possible to determine a rough set of equations to determine if one has an advantage in both numbers and power, but I'll leave that for another day.

To improve the chance of victory, then, we'd like to do a little scouting before-hand, and only attack if we believe we have a numbers advantage. The quality of the estimation will depend on our hegemony's tech level.

Minor note: at tech level 11, attacking forces will have access to engineering capabilities, and so the effect of a defending castle is neutralized.

May 30, 2019

History XI: The Kingdoms of this World

I need to understand how the secession mechanic is working in practice, so I disabled it to see what sort of empires are built without it. Previously, many tiny kingdoms would spring up with no clear rhyme or reason - a city would be founded and immediately secede against its hegemon. Why so sensitive?

In addition, there's not enough war overall, and the wars that are fought are ultimately pointless for the attacker (with an overall success rate of about 6%, it's unclear why anyone would bother in the first place).

So there are some issues with the battle system, but I'll table that for now until I know what's going on with rebellion/secession. Really, these are secessions, not civil wars; civil wars are waged in the interest of taking over the central government of the entire hegemon, whereas seceding parties usually just want to be left alone. Of course, they are automatically at war either way according to the system.

These problems were addressed by a few tweaks:
  • Cities will secede only if they provide a certain amount of infrastructure to themselves AND they have a minimal (1%) contribution from their initial hegemon's capital.
  • Peace, being preferable to war, is still common. There is only a 1% chance for a relationship to increase above HIIK 0. However, I removed the restrictions on which cities would be attacked - previously only cities which increased the hegemon's overall desirability would be targeted.
  • In addition, attackers will choose their targets a bit more wisely. If they suspect that the defending force is too large, they won't attack. However, I still think this suffers from perfect information. Perhaps this should only kick in at higher infrastructure levels, where the attacking army would have access to advanced intelligence and a better knowledge of the defender's strength.
  • Cities can now be cut off from reinforcements. If an attacker takes all the hexes around a city, or a region, then those armies will have no expectation to be reinforced, and thus begins a catastrophic snowball. It could even result in another secession, depending on the circumstances. Right now, there's no specific incentive for an army to break the blockade by taking a strategic choke-point.
It's becoming more obvious that sub-kingdoms are the way to go if you want to maintain a large empire. Although I haven't worked out the mechanics for it, the only ideas I have so far are 1) conquest and submission and 2) voluntary submission. I would need a mechanic whereby a country would divide itself into administrative districts unprompted. I can use the current numbers, but the details of it elude me so far.

1160 years

May 28, 2019

History X: Wish Not One Man More

I've simulated 16778 battles so far over 1363 years of history. The attacker has a record of 1073-15712. Atrocious! Why the bad record?

First of all, peace between major nations forms too easily! There needs to be more war between these larger entities. Secondly, secession is too volatile. Small cities will throw off the yoke of their much stronger leaders, sometimes immediately after founding. I thought I was pre-selecting sites that were still controllable but something is going funky. The small city then fruitlessly attacks the larger nation. Thirdly, castles are basically unassailable, especially because these small rebel bands are leading tiny armies against them.

There are a few things I'll tackle to address these issues.
  1. Peace is preferable to war, but long-term peace is hard to obtain in this world.
  2. Work on secession dynamics, make it more difficult at the very least.
  3. Don't attack a castle with a garrison many times larger than your own force.
These factors currently lead to a proliferation of hegemonies, many tiny kingdoms in a smallish area. That's ok from a historical perspective and could lead to some interesting effects, but I'd like to consolidate just a bit from a computing perspective.

Click for larger image. Infrastructure numbers in red. Battles marked by black Xs

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

May 3, 2019

History IX: Notes from the Front Line

Battles take a long time to resolve (when you're trying to manage many cities), and so they're slowing down the whole enterprise. I've implemented a few changes to hopefully make this smoother.

First, only cities with at least 1000 people can initiate an attack against a neighbor. This fixes an "issue" where small tribes would get locked into a constant series of battles so that neither could grow larger than a few hundred persons. This is a fascinating outcome, but I want to see if I can let some cities grow a bit larger so the battles get more interesting. If I can squash some bugs that this rock is covering, maybe I'll remove the restriction.

Second, the rout percentages have been changed to random distributions, centered on 30% losses for attacker and 50% losses for defender. This gives a bit of salt to the simulation.

Third, when an attack is initiated, I have to think broader than just "this little town attacks its large neighbor." The capital city is the one calling the shots here, and so it makes more sense to gather an army and send them to the battlefield, rather than just hoping that the national military will show up and back your power play. This should allow more decisive (and "strategic") victories, as much larger forces will be able to overwhelm smaller intermediate cities.

Fourth, I've implemented treaties. When two nations drop from HIIK 1 (dispute) to HIKK 0 (no conflict), they can agree to an armistice for a certain period of time: about 5-40 years. This mechanic is also triggered after a drop from HIIK 4/5 (limited war/war) to HIIK 3 (violent crisis). During the armistice, both nations are at HIIK 0. After the armistice ends, the normal transition mechanism resumes. This should reduce the overall number of wars and allow nations to gain some strength before plunging themselves into mutually destructive conflicts.

May 1, 2019

History VIII: The Long Arm of the State

How far does influence extend?

As empires grow large, it becomes difficult to control the extremities. Eventually, it collapses under its own weight. There are several mechanisms to describe this, but first I'll concentrate on the physical size of the hegemony.

As of the last running of my history simulator, the largest hegemony (Drudny) covers 785 cities. It's massive, and contains a huge number of people (around 64M) when both rural and urban populations are considered. For comparison, the zenith of the Roman Empire had around 90M people and the equivalent of about 5500 cities/hexes of area. Based on that, I think my population equation is somewhat skewed.

An empire of this physical distribution would be nearly impossible to maintain given the restraints of the fantasy-tech level, where technology and travel are severely limited and magic is rare. The degree of control that the capital city $i$ has on a given city $j$ located $\delta_{ij}$ days away (not necessarily the straight line distance) can be quantified by the following metric: \[C_{ij} = {P_i \over \delta_{ij} ^ n}\], where $n$ is the distance modifier, usually 2. Values for the Drudny hegemony range from 32531.15 (right next to the capital) to 11.32 (over a month's travel away).

How much of a "rebellion index" does this number represent? It's difficult to say. The best way forward for now is to fix a number and test it out. A Monte-Carlo by fire. A city with $C_{ij} \leq 25$ is susceptible (not automatically!) to revolution. A value of 25 means that a city of 1000 can reliably control hexes up to 6 days away, and a city of 25,000, about 30 days. For these threshold cities, the chance of revolution each year is 25%, which would lead to a revolution within 25 years max if the situation is not resolved.

This obviously leads to the conclusion (as many empires reached throughout real history), that a massive empire is best controlled with some measure of decentralization. China solidified itself with jùn and xiàn; Russia with oblasts; Rome with provinces; Wales, with cantrefi. This decentralization would ensure that every city maintained the threshold score. I will need to think more about how to implement this later.

So far I have not had any empires grow large enough to experience a revolt.

April 30, 2019

Demographics VI: Return of the Urbanites

The equations here are cool, but they start to yield some pretty large numbers when the empire size begins to grow. So I'm going to try an alternative system for a while and see how it feels.

This is just a simple logistic function centered at $I_0 = 400$, with a maximum value of 480 persons per 1hex: a very high rural density indeed for the development we're talking about. \[d(I) = {480 \over 1 + \exp\left(- k \left(I - I_0\right)\right)}\]. $k$ is set to 0.016, so that $d(5) = 1$. The population of a whole 20hex is given as $400 \cdot d(I)$.

Since this doesn't rely on the urbanization rate (which is now derived rather than set) to determine population, we can now get population numbers for hexes with no cities. The hinterlands.

April 16, 2019

History VII: Blood Alone Moves the Wheels of History

The simulator is working pretty well, so I took a few moments to make a nice historical snapshot. This image represents the growth of settlements over 2700 years. It's rotated so that north is to the left, to get a good view of the central continent.


There is a large band of civilization right in the middle. This represents the Cfb Koppen climate, so a European-type climate, where the jungles of the equator give way to lighter forest.

After 2700 years, the oldest empires are:
  • Delig, est. 1, population: 1,303,170. The capital city is Hvatfar (pop. 2,103). The largest city, however, is Jakom (pop. 28,001). They produce mostly agricultural products but have access to iron and copper ores and coal. Delig is a small halfling kingdom, with only 8 cities. Deligfar itself, the founding city, stood until 1030, when it fell to disaster (disease or natural disasters).
  • Tilaj, est. 1, population: 2,128,289. A dwarf kingdom, Tilaj is much bigger than Delig, with 31 cities (but hence a lower density). The capital city is Nzuavjuab (pop. 3,229). The largest city is Limai (pop. 13,839). Tilaj mines silver, iron, and copper. Tilajp lasted until 1701, quite a run.
I haven't run the full trade network yet, so I'm not sure if this will change, but notice that neither of these empires have access to gold or steel (which requires manganese and nickel). This will severely limit the trade abilities of these ancient peoples.

The largest empire is:
  • Popach, est. 3, population (human): 11,064,595. The capital is Tepwyð (pop. 151 - really??). The largest city is Dwrzwie (pop. 20,806). Comprises 176 cities. Again, no gold! Perhaps I should place a very high emphasis on gold during city placement.
The largest city is:
  • Ldwia, est. 2058, population (human): 69,402. Part of the Umidyl hegemony. Ldwia is due for a crash - they are far above their carrying capacity.
All told, there are 716,318,766 persons accounted for. That's a lot, especially for the short amount of time, but remember that I've got 5 races, not just one.

I like the war simulation so far, but the transition matrix does not account for empire minded cultures. The chance of a Cyrus the Great arising (20 year campaign) or an Alexander the Great sweeping across the world, moving so fast he appears to be flying, is very low. And perhaps it should be. But we have many examples of this type of thing in our own world, so I would imagine it could happen more often here. Perhaps there might be a special mechanic where a great leader arises and pushes the boundaries of the empire without suing for peace.

I'd also like to incorporate more bloodless politics (two kingdoms joining in a confederation or an empire) or more bloody politics (secession or balkanization). All things in time.