Showing posts with label War. Show all posts
Showing posts with label War. Show all posts

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 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 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 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 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.


April 8, 2019

History VI: It Is Well That War Is So Terrible

The enemy said, 'I will pursue, I will overtake, I will divide plunder, my desire will be full of them, I will draw my sword, my hand will destroy them.' - Exodus 15:9 LEB

The Heidelberg Institute for International Conflict Research (HIIK) defines 6 levels of violence intensity between nations.

lvldesc.
0no conflict
1dispute
2non-violent crisis
3violent crisis
4limited war
5war

Levels 0-2 are non-violent, while 3-5 are escalated into actual conflict. This fascinating paper gives me a great set of models to use to predict conflict between nations [1]. For example, a variable for "border conflict" $C$ can be used as a "bad neighbor index": \[C = \sum_1^n x_i p_i,\] where $n$ is the number of bordering nations, $x_i$ is the previous year intensity for nation $i$, and $p_i$ is the percent of border shared with nation $i$. This paper [2] takes it a step further by providing a transition probability matrix between peace and war!

However, Hegre's robust model only transitions between no conflict (0-2), minor conflict (3), and major conflict (4-5). So I can use this to create a full transitional matrix between the 6 levels (using my old friend Inverse Distance Weighting).


After a bit of testing, that seems like it transitions way too quickly. My tests devolved into war within 10 years. Guess that's possible when everyone is super touchy. Let's try something more fundamentally based.


That does a little better. Doing a few tests shows it has a nice spread leading up to war, between 70 and 280 years for 5 tests. Perhaps it could even be modified per nation. Some are naturally peaceful, some are naturally expansionist. It is quite obvious from even a few tests how massively the matrix affects behavior.


At creation, every nation will be at Level 0 with its neighbors (barring circumstances like a secession from the parent hegemony, in which case it would already be at war).

However, this transition matrix is situationally agnostic. It doesn't know how much border I share with that crazy king who's always eyeing my silver mines. It doesn't remember the bloody civil war in which my people were brutally defeated but still nurse their wounds with undaunted pride and opportunistic ears. So while this system can add some substantial random salt, it's not the end all be all. We need a few more mechanics and numbers for that (rebellions, treaties, overall population contentment, confederations, etc). But for now we will assume that war is only governed by this single mechanic.

If two nations are at war, they will seek to capture the bordering city which has the highest raw desirability.

Now, how do two nations actually fight? There has been some work done about this from a game design perspective, but I'm particularly drawn to the Lanchester equations. These are very simple equations which describe the attrition rates of two armies of size $A$ and $B$ at battle: \[A'(t) = - \beta A(0)^{2-n} B(t)\] \[B'(t) = - \alpha B(0)^{2-n} A(t)\], where $\alpha$ and $\beta$ are the combat effectiveness of $A$ and $B$ respectively, and $n$ is the attrition parameters. $n=1$ is the linear case, where one solider kills one soldier, but $n=2$ is the square case, more applicable to modern warfare. It also turns out that when a defender is fortified, the attack attacks linearly, while the defender defends with the square law. This makes sense intuitively - it is difficult to take a position. So how do I use this in my game?

First I need to determine the raw number of troops. I'll pull random low percentage (3-6%) from the rest of the country to determine a standing army size, and 5x that from the attacked hex. This includes both urban and rural populations (right now, my rural calculation is 5 times the infrastructure number but I don't like this and will address it soon).

Potential issues: it doesn't make much sense for the entire standing army to reinforce a single city in every case. It may not be strategically important, or it may be the fortress upon which the whole balance hangs. There's no way to know, and I'm looking for verisimilitude, not accuracy.

Consider the following free cities:
  • Wienw, population 559 (rural 11,670), founded 3604. Militarization rate: 5.6%. Total military: 2,860.
  • Aedcad, population 6,694 (rural 31,110), founded 3325. Militarization rate: 4.9%. Total military: 1,742.
Aedcad attacks Wienw but is met with a much larger defending force (Wienw gets a boost because it's being attacked). To figure out who wins and how many troops are lost, I need a measure of $\alpha$ and $\beta$. If one side has steel swords and the other has bamboo canes, it almost doesn't matter how many people you have with canes. Technically, I can get numbers for weapon availability by leveraging the market system, but I can't computationally afford to do that every simulated year. So instead, I'll use the desirability and infrastructure indexes, which are updated regularly. The theory being that resource availability yields a higher desirability, and a higher infrastructure gives you a better mechanism to train your troops. For Wienw ($\alpha$) and Aedcad ($\beta$), this gives \[\alpha = {0.7368 \cdot 103 \over 10} = 7.589\] \[\beta = {0.5242 \cdot 21 \over 10} = 1.101\] The indexes are averages of the entire hegemony (which in these cases is only one hex) and they are divided by 10 to bring it into a reasonable range. A soldier from Wienw can kill almost 8 enemies before he dies, but an Aedcadian can only manage around 1.

The solutions for the above equations are too long to display here, but suffice it to say that Aedcad was soundly defeated (using $n=1.25$). Defenders will hang on until they have lost 50% of their troops; attackers will break off if they have lost 30%. Aedcad (red) loses 528 men in the attack - a costly battle, and Wienw (blue) only loses 467. Because these are single cities, it's easy to just subtract the casualties; in the case of larger hegemonies, all cities will lose some in proportion to how many they supplied.


However, as robust as this may seem, I don't know if it will be fast enough to use as my primary engine of war. I'll have to run some tests with some non-linear solvers. But otherwise, it's a fair start.

Potential issues: why would Aedcad attack Wienw in the first place, given Wienw's military and numbers advantage? However, we have information that Aedcad does not: perfect information on the likelihood of a victory or loss. Until we salt the system, Aedcad will always lose this battle. It's just a question of by how much. I'd also like to create some castles/other fortifications, because these are gameably cool, would most likely be built in highly contested areas, and would give a significant defensive boost.

References:

  1. B. Boekestein, “A Predictive Logistic Regression Model of World Conflict Using Open Source Data,” Air Force Institute of Technology, 2015.
  2. H. Hegre, J. Karlsen, H. M. Nygård, H. Strand, and H. Urdal, “Predicting Armed Conflict, 2010-2050,” Int. Stud. Q., vol. 57, no. 2, pp. 250–270, Jun. 2013.