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.