top of page

## Spatial Simulation on a Hexagonal Arena

This project implements a spatial simulation​ of Peter Turchin's Metaethnic Frontier Theory, as described in his book, Historical Dynamics.  I loved the book, though I thought the line graphs didn't do the theory much justice, nor were there any visualizations online.  I figured this would be a good opportunity to try out modern game engines to see what they could do.  I chose Unity after finding a solid hex terrain system (Honey Hex), that I could use as a basis.

The theory proposes that agragrian empires rise in regions near fault lines between religions/ethnicities/cultures.  In such areas, the challenging conditions necessitate growth in the capacity for collective action (called Asabiya, in the parlance of Turchin, choosing a term from the medieval historian, Ibn Khaldun).  When an empire grows to a size where such borderlands are small compared to the overall area, the conditions for collective action dwindle and Asabiya declines, potentially causing an imperial collapse.

The relationship is easy to model in a simulation, and has the interesting feature of producing oscillations in empire size (rises and falls), as well as long periods of stability, followed by periods of rapid territorial change.  This is a pattern that has support from historical records, and is emergent from a very small set of rules.  Here's how it works:

We start with an arena of cells, each with an "imperial index" and an Asabiya value (Sₓ).  The arena is seeded with one polity made of multiple cells each with an Asabiya of 1 and imperial index of 1 (a seed empire).  All other cells have an Asabiya and imperial index of 0 (small non-state polities).  Every time step the Asabiya of each cell is incremented by the following equation if it borders another cell with a different imperial index (i.e. this is a metaethnic frontier):

Sₓ' = Sₓ + r₀ Sₓ (1-Sₓ)

Note, r₀ is a constant that can be tweaked in the simulation. If the cell is not on a border, it's Asabiya is decremended by the following equation:

Sₓ' = Sₓ - δSₓ

Again, δ is a tweakable constant.  Then each cell considers an attack on it's neigbhords with a "power" (Pₓ) equal to the following equation where Aₑ is the number of other cells that share its imperial index (empire size), Sₑ is the averaged Asabiya of all cells that share its imperial index (empire asabiya), dₓ is distance of the cell to the centroid of all other cells that share its imperial index (distance to the captial), and h is a special constant:

Pₓ = AₑSₑexp[-dₓ / h]

The defending cell's power is computed the same way.  If the difference between the attacking and defending cell's power is greater than the threshold Δ then the cell is annexed by the attacking empire (switches imperial index).  Note, Asabiya is clamped between 0 and 1, and if at any step, the Asabiya of a polity drops below a constant C then the polity is destroyed (each of its cell is re-inititalized with index 0).

One of the most critical parameters is the constant, h.  This defines how an empire's power declindes with distance from it's center.  The intriguing oscillations and alternating periods of stability and chaos only occur if the h value is in a certain range.  Too small and empires can't rise, too big and they simply expand until the bump into eachother and stay in equilibrium.  Try playing with these parameters and see the effects!

I may expand on this simulation by adding influence of terrain features of and other rules.  Let me know if you have ideas/suggestions.