Stability Guide v1.12

Leoreth

Bofurin
Retired Moderator
Joined
Aug 23, 2009
Messages
37,922
Location
風鈴高等学校
I have some time on my hands and have decided to focus mainly on the stability mechanic. I know there are a couple of bugs and other miscellaneous stuff that has accumulated over the time, but I think this central feature of the mod has spiraled out of control in parts and I need to get it back on line.

So I'm currently revising the entire stability script. It started with a complete replacement of the old RFC script that saw some radical changes. I'm now comparing it side by side with the original implementation to see if something can be brought back, in case it worked better. I will also address a couple of points which I have recently listed in the stability feedback thread.

The purpose of this thread is to create a guide to the rules of the stability system. My initial idea was to design and balance the stability system and then write a definite guide when that's done. That wasn't the smartest idea because I have to rely on your feedback to do this, and feedback is only valuable if people know the rules. So while I go over parts of the current mechanic and make some changes, I will also post the current rules for that part here in this thread. In the future, these rules will be updated here once there is a change. This will serve both as a central place of reference for what is "current" (and that means, the latest SVN revision) and as a basis to create the definite guide for 1.12 once it is ready for release.

Don't expect this guide to be nicely structured until I have covered every aspect. For the general idea I can still refer you to the OP of the stability feedback thread. That thread also still remains the place to go for actual feedback on the stability system. Please only post here if you have questions on how the current system works.
 
EXPANSION

Overextension

Overextension is the main factor of expansion stability. It depends on two scores:
- core population score
- periphery population score

Without taking modifiers into account, they are just the population in your core and the population outside of your core, respectively.

As long as your periphery population score is below your core population score, everything is fine. Once the periphery score exceeds 100% of the core population score, you will receive an expansion stability penalty according to a formula which I will explain later.

The scores are affected by a number of modifiers and therefore aren't only based on city population.

The core population score is multiplied by [current era]+1. That means, even in the ancient era (= 0), every point of core population can potentially support two points of periphery population without any penalties. Since the modifier is era-based, your ability to support a large periphery grows during the game.

Additionally, if a civilization has only one city in their core and is in the classical era or later, they receive an additional core population score equal to the population of that one city multiplied by their current era. This is meant to support civilizations such as Inca or Tibet with a small core that can only contain one city.

The periphery population score depends on multiple factors. Therefore, for every city a modifier is calculated, which has the initial value of 0 and cannot have a lower value than -1. For every modifier point, the population of the city counts 50% more, i.e. a modifier of 2 means its population counts double. Having a modifier of -1 means the population only counts half. The following factors affect the modifier:

+2 if the city is not on historical territory (so it makes sense to mainly control historical tiles)
+1 if you are not the original owner of this city (unless you are running Totalitarianism or Warrior Code, or the city is under your control for more than 25 turns)
+1 if you have less than 50% culture in this city
+1 if you have less than 20% culture in this city (those two penalties are cumulative, for a total of +2 if you are below 20%. Native culture counts double within their own cores. Persia is immune to culture-based penalties due to their UP)
+2 when running City States (this civic is only meant for small civilizations)
-1 if the city has a Courthouse
-1 if the city has a Jail
-1 if it is an overseas city and you are running Mercantilism
-1 if it is an overseas city and you are Portugal (their UP)
+1 if it is a historical overseas city an you are running Totalitarianism (to discourage Totalitarianism for maintaining colonial empires)

The stability penalty you receive for every percentage point of periphery population score exceeding 100% core population score is given by the function graphed below:

attachment.php


If you are not a math person, that means that the penalty can be at most -25, and that it grows faster right after exceeding 100% than later on. It works this way to have a diminishing yet growing effect of overexpansion to allow domination games without making stability meaningless when playing for historical victories.

Between stability checks, the overextension penalty can only increase by at most 5 negative points. For instance, if you had a penalty of 0 in the last check and the calculation results in -10, you will still only get a penalty of -5 until the next check.

Razing

Razing cities is the other contributing factor to expansion stability. The score here is very straightforward. You get a -10 stability penalty for every city you have razed. This penalty decays by 2 points every 5 turns. This penalty is global, that means if you accrue -20 raze stability from razing two cities, it still decays by 2 points every 5 turns, instead of by 4.

The exception to this rule are smaller cities. If the city has a population of less than 5, the penalty is -2 * [city population] instead. This exception does not apply to another civilizations capital, which always gives a -10 penalty when razed.

ECONOMY

Economic Growth

The economic growth score is updated every third turn, in which the total amount of commerce produced is compared to the amount from three turns earlier. Has it grown by more than 5%, the score increases, has it shrunk by more than 5%, it decreases. Otherwise the score slowly moves towards 0 again.

At every stability check the score is directly applied to the economy stability.

Some of your civics influence your economic growth stability:
- you receive extra points during economic growth when running Free Market
- you receive no penalties during economic stagnation when running Environmentalism
- you receive less penalties during economic decline when running Public Welfare

Trade

Your cities have trade routes to other cities generating commerce (exports). Other cities have trade routes to your cities also generating commerce (imports). For all civilizations, their total trade volume is calculated, which usually is the sum of exports and imports, but for Mercantilist civs it is twice their export volume instead.

The trade volume is divided by your number of cities, then subtracted a modifier that increases with your era. Effectively, you can achieve a positive score by increasing the trade yield in your cities and securing trade routes with foreign cities.

The trade stability is capped at +10 and -10 respectively.

Economic Systems

Civilizations running Mercantilism receive a -2 penalty for having open borders with a civilization with a higher commerce output.

Civilizations running Central Planning receive a -2 penalty for having open borders with a civilization that runs Free Market.

DOMESTIC

Happiness

Happiness stability works similar to economic growth stability in that it is accumulating every third turn depending on the situation of your civilization. To that end, the happy and unhappy cities in a civilization are counted based on the following criteria:

Happy city: currently celebrates the "We Love the King" day OR its happiness exceeds its unhappiness by at least a quarter of your empire's average city size and it has at least the average city size of your empire
Unhappy city: the city has more unhappiness than happiness OR the extra unhappiness (from all factors except population) exceeds a fifth of the city's population

Some explanatory examples:
Spoiler :
Is your average city size 8, a city with population 8, happiness 10 and unhappiness 8 counts as happy because the excess happiness (10 - 8 = 2) is just as high as a quarter of the population (8 / 4 = 2). The same city would not count as happy if your average city size was 12 (12 / 4 = 3).

For average city size of 8, a pop 6 city with happiness 8 and unhappiness 6 would not count as happy even though 8 - 6 <= 8 / 4, because it is smaller than your average city size.

Conversely, if a city has population 10 and a total unhappiness of 13, it has 3 unhappiness from sources other than population, which is more than 10 / 5 = 2, so it counts as unhappy regardless of its happiness.


A lot of these criteria were chosen so that you would not benefit from global happiness effects such as resources while keeping your cities artificially small, and that actions which cause unhappiness such as slavery will have an impact on stability even with a large happiness buffer.

Note that it is possible for a city to not fulfill either of these criteria, in which case it doesn't count at all for the purposes of happiness stability. A city can also both fulfill the criteria for being happy and unhappy, in which case it counts as happy.

Your happiness stability grows every third turn if you have more happy than unhappy cities, and declines if you have more unhappy than happy cities. This factor cannot exceed -10 or 10, respectively. If the amount of happy and unhappy cities is exactly the same, the value slowly approaches 0 again.

Religion

For religions, two or three percentages are calculated:
- the percentage of cities that have your state religion (believer ratio)
- the percentage of cities that have at least one non-state religion (heathen ratio)
- if you are running Theocracy, the percentage of cities that have ONLY your state religion

Some non-state religions are ignored for the purposes of the second and third ratios ("tolerance").
- civs with Secularism tolerate all non-state religions
- Mughals tolerate all non-state religions because of their UP
- Hinduism and Buddhism tolerate each other
- Confucianism and Taoism tolerate each other

Heathen ratio: You incur neither penalties nor bonuses if your ratio is 30%. Otherwise, you receive -1 stability for every 10% over 30% and +1 stability for every 10% below 30%.
Believer ratio: You incur neither penalties nor bonuses if your ratio is 75%. Otherwise, you receive -1 stability for every 5% below 75% (up to a maximum of -10) and +1 stability for every 5% over 75%.
Theocracy bonus: if you are running Theocracy, you also receive +1 stability for every 20% of your cities that only have your state religion.

Note that while the other factors require you to have a state religion, the religion stability from the heathen ratio also applies when you don't have a state religion.

Civics

Civics stability comes either from running a certain combination of civics or from running specific civics in a certain era or after discovering a certain technology.

Totalitarianism + Autocracy: +5
Totalitarianism + Central Planning: +3
Totalitarianism + [any religious civic except Secularism]: -5

Central Planning + Industrialism: +2
Central Planning + [any labor civic except Industrialism or Public Welfare]: -5

Egalitarianism + Republic: +2
Egalitarianism + [any labor civic except Public Welfare]: -3
Egalitarianism + Environmentalism: +2
Egalitarianism + Secularism: +2

Capitalism + Representation: +2
Capitalism + Free Market: +3
Capitalism + Guilds: -5

Environmentalism + Industrialism: -5

Theocracy + Fanaticism: +5
Theocracy + Organized Religion: +3
Theocracy + Secularism: -7
Theocracy + Egalitarianism: -3

Vassalage + Warrior Code or Levy Armies: +3
Vassalage + [any other military civic]: -5
Vassalage + Capitalism or Industrialism or Public Welfare: -5
Vassalage + Dynasticism: +2 in the Middle Ages
Vassalage + Agrarianism: +3 in the Middle Ages

City States + Vassalage or Absolutism or Egalitarianism: -3
City States + Guilds: +2
City States + [any economic civic except Self-Sufficiency, Guilds and Mercantilism]: -5
City States + Militia or Mercenaries: +2
City States + [any military civic except Militia, Mercenaries and Naval Dominance]: -3

Absolutism + Republic: -5
Absolutism + Mercantilism: +3
Absolutism + Organized Religion: +2
Absolutism + Dynasticism: +2 in the Renaissance

Republic + Representation: +2

Warrior Code + Dynasticism: +2
Warrior Code + Fanaticism: +2

Autocracy + Standing Army: +3

Vassalage in the Middle Ages: +2
Vassalage in the Industrial Era or later: -5

Theocracy in the Industrial Era or later: -5

Pantheon in the Classical Era or earlier: +2
Pantheon in the Middle Ages or later: -2 * [current era]

City States in the Classical Era or earlier: +2
City States in the Industrial Era or later: -5

Direct Rule or Vassalage or Absolutism after the discovery of Democracy: -5
Slavery or Agrarianism after the discovery of Democracy, unless running Totalitarianism: -5

Any Organization civic except Totalitarianism and Egalitarianism after the discovery of Communism: -5

Self-Sufficiency or Guilds after the discovery of Corporation: -5

Slavery after the discovery of Economics, unless running Totalitarianism: -5

Mercenaries after the discovery of Nationalism: -5

Warrior Code after the discovery of Military Science: -7

FOREIGN

A couple of factors contribute to your foreign stability rating:

For every neighboring collapsing civ that you have open borders with: -3

For every collapsing vassal: -5
For every unstable vassal: -2
For every solid vassal: +3
For every vassal when running Vassalage: +2

For every defensive pact with a higher ranked civilization: +5

For every open borders treaty with a civ with your state religion: +1
For every open borders treaty with a civ with a different state religion: +2
For every second civilization you can contact: -1

Being the worst enemy of a higher ranked civilization: -4

For every neighbor you are at war with while running Autocracy: +2
For every civilization with different state religion you are at war with while running Fanaticism: +3
For every civilization with the same state religion you are at war with while running Fanaticism: -2

MILITARY

All military scores are calculated for each your civilization is in.

Conquest Stability

This factor depends on the number of cities you have conquered from this civ compared to those you have lost to it. Cities are worth more if the owner has less of them, i.e. losing a city has a larger impact if you don't have a lot of them in the first place.

Battle Stability

Similar to conquest stability, the battles you have won are compared to the battles you have lost. In either case, a battle is "worth" as much as the defeated unit's power rating. How much battle stability you get or lose depends on your overall military strength - the stronger you are, the less of an impact a singular battle has in either way. Battle stability decays while a war lasts.

War Weariness Stability

Your war weariness is compared to your enemy's. If it is larger, you receive a penalty proportional to the difference. This penalty also decays while the war lasts.

Barbarbian Losses Stability

You receive a -1 stability penalty for every battle you lose against a barbarian unit. This penalty also decays over time.
 

Attachments

  • ExpansionFunction.png
    ExpansionFunction.png
    11.8 KB · Views: 7,289
STABILITY LEVELS

Stability levels represent the overall stability of your empire. Stability levels are persistent and should not be confused with the stability score which is calculated on stability checks according to the rules described above, and then discarded. There are five stability levels from best to worst:

Solid
Stable
Shaky
Unstable
Collapsing

Your stability level can change during a stability check. They also influence what happens when a stability check has a negative outcome.

STABILITY CHECKS

A stability check is when your stability "matters". They don't happen periodically, but instead are triggered by a number of events:
- losing a city
- razing a city (human only)
- discovering a technology
- becoming a vassal
- acquiring a vassal (+)
- starting a war
- making peace (+)
- changing civics or state religion
- moving your capital
- building a wonder (+)
- starting a golden age (+)
- receiving a great person (+)

Events marked with a (+) trigger positive stability checks. These checks cannot have negative consequences, which will be explained in more detail below.

During a check, your stability score is calculated according to the rules described in the previous post. This score is compared to the stability threshold. Based on this comparison, the stability check can have three possible outcomes:

Positive: The stability score exceeds the threshold by more than 10 points
Neutral: The stability score is equal to or greater than the threshold (but by not more than 10 points)
Negative: The stability score is less than the threshold

The threshold itself depends on your situation. In particular, it depends on the current stability level:
- on solid: +20
- on unstable: +10
- on shaky: 0
- on unstable: -10
- on collapsing: -20

The varying threshold has the purpose of making sure that a civilization does not "fall through the levels" with a constant stability score in subsequent checks. So unless their score changes, every civilization will eventually arrive at a stability level that reflects it.

The threshold is also lower later in the game to improve overall stability, and while in a golden age to make it easier to gain stability then. The average stability of all other civilizations also influences the threshold to avoid a world of only unstable or only stable civs.

The consequences of a stability check are as follows:

Positive: The stability level increases by one.
Neutral: Nothing happens.
Negative: The stability level decreases by one. If the previous stability level was shaky or lower, a crisis occurs. Civilizations on solid or stable cannot trigger crises.

During a positive stability check (labeled with a (+) above), negative stability checks have no consequences.

Human players receive an additional warning for negative outcomes of stability checks. In practice that means that they are immune against the first negative outcome of a stability check, and only subsequent negative outcomes will take effect. Instead, a warning will be displayed in the main event log.

Civilizations that experience a crisis are also immune against stability checks of any kind for the next ten turns.

CRISES

A negative outcome of a stability check can trigger a crisis. The type of crisis depends on two factors: your stability level and the stability category with the lowest value (the crisis type).

Negative outcomes on solid or stable don't trigger a crisis.

A crisis on collapsing is also called a terminal crisis and always leads to a complete collapse of the civilization, regardless of crisis type. AI civilizations are immune to collapses triggered by stability checks from declarations of war by the human player.

Crises on shaky are moderate crises, while crises on unstable are severe crises. Their effects depend on the crisis type, i.e. there are:
- territorial crises (expansion)
- economic crises (economy)
- domestic crises (domestic)
- diplomatic crises (foreign)
- military crises (military)

Moderate territorial crisis: a single city secedes from your empire. It is chosen according to your stability map, so if available it will be a city on ahistorical territory.
Severe territorial crisis: "Collapse to core": if more than half of all non-core cities are ahistorical, all ahistorical cities will secede. Otherwise, all non-core cities will secede.

Moderate economic crisis: You lose gold equivalent to 50% of your research progress (sum of all techs which you have begun to research). If you do not have enough gold on treasury, the beakers invested in the techs will be subtracted directly.
Severe economic crisis: You lose gold equivalent to 100% of your research progress (see above). All your cottages downgrade one level. You lose all GP points in all cities.

Moderate domestic crisis: All unhappy cities will go into two turns of unrest.
Severe domestic crisis: Two turns of anarchy. All unhappy cities secede.

Moderate diplomatic crisis: Your relations with 2 civilizations will deteriorate.
Severe diplomatic crisis: Your relations with 5 civilizations will deteriorate. All your vassals are set free.

Moderate military crisis: The defense value of all cities with enemy claim is reduced to 0.
Severe military crisis: Two turns of unrest in all cities with enemy claim. You cannot move all military units for one turn.
 
Reserved.
 
Some questions:
1) so if I found a city in a historical area, and then build a jail [-1] and courthouse [-1] there... their population does not matter anymore? (I&#8217;m not running Totalitarianism)
) if -2 means you got no modifier at all, and +2 you got twice modifier.. what&#8217;s on 0?
 
Some questions:
1) so if I found a city in a historical area, and then build a jail [-1] and courthouse [-1] there... their population does not matter anymore? (I&#8217;m not running Totalitarianism)
) if -2 means you got no modifier at all, and +2 you got twice modifier.. what&#8217;s on 0?
1) Yes (this is a recent change*).
2) A modifier of 0 means the population counts as it is. In other words, the score is (100 + [modifier] * 50) * population / 100.

* okay it's technically not even committed yet :mischief:
 
That could be abused easily.

Anyway, will the game then check for each city every turn whether jail or courthouse is present?
If so, would not that lead to more loads, and so longer waiting time for each turn?
 
Stability isn't calculated every turn, the check is only necessary when a new calculation is made. The costs are trivial.
 
I revised the guide at one point because I had forgotten this mechanic is already in:
Overextension

[...]

Between stability checks, the overextension penalty can only increase by at most 5 negative points. For instance, if you had a penalty of 0 in the last check and the calculation results in -10, you will still only get a penalty of -5 until the next check.
(I will make posts like this notifying changes to the guide whenever I edit something or a rule changes.)
 
Added a section for the economy stability category.
 
Isn't that Razing penalty too strong?

I recently played USA on SVN 707 version and it forced me to play with dozens of inefficiently placed cities made by AI.
 
Since the penalty is no longer permanent, it has to be big to make sure that razing is actually somewhat costly.
 
The problem is 25 turns correspond to 5% of whole game time. That means you must not raze any cities with late starting civs.
Good point, maybe late spawns should be allowed some cheap or faster decaying razes.
 
Added a section on domestic stability covering the contributing factors of happiness and religion. Civics will follow as soon as I have revisited them.

While writing this section I have found a mistake, which will be corrected with the next SVN commit: the happy city criteria previously required that the excess happiness exceeded a fourth of this city's population instead of your average population. This is of course against the principle that smaller cities should not make it easier to have a positive happiness stability.
 
Back
Top Bottom