Anti-Warmonger Fervor

saamohod

Deity
Joined
Jul 22, 2014
Messages
3,109
Location
Unoccupied Ukraine
How is it calculated? I've only captured one AI capital but my Anti-Warmonger penalty is 35% which is quite a lot.
 
Second attempt.

Could anyone clarify how the Anti-Warmonger penalty calculated? Couldn't find it in Civilopedia. Is it 35% per foreign capital captured?
 

Summon Devs

Unlimited range
2 sec cast

Summons a knighted developer of the Vox Populi to explain a game mechanic.

Disclaimer: Explanation may take a while and spark controversy for more complicated mechanics. Unhelpful trolls or politicians desperate to be reelected may spin the resulting debate, turning it into personal attacks, accusations of incompetence, or a pretext to declare war on another nation.

If the developer is in a foul mood, the caster may be smitten by divine lightning, inflicting 7,983 to 10,255 Nature damage and stunning them for 5 sec. The summoning spell shall be legally indemnified in all subsequent civil lawsuits and tort claims for lost limbs, singed clothing, smoke coming out of people's ears, associated war damages, hurt feelings, jaywalking resulting from trauma, and halitosis.

... Okay, in all seriousness, I'll look at the warmonger code tonight and write up a plaintext explanation. It's been requested for a while. :)
 
I'm happy to wait for details, but I'm pretty sure it's tied to their warmonger rating. AIs that don't see you as much of a threat won't get as much of a bonus. Also since it's tied to that it reduces over time and can be changed up via world congress. (More or less with various policies.)

Just to tide you over till the real explanation comes.
 
I'm curious to learn that as well, my wars on huge map (immortal) get a little tedious with 65% buff for the enemy.
 
Anti-warmonger fervor = (Warmonger Amount / 10, rounded down) * Anti-Warmonger Player's Current Era

Era = 0 in Ancient, 1 in Classical, 2 in Medieval, etc.

Cap. Fervor cannot be lower than 0% and cannot be higher than 0-75% for human players (depending on difficulty level) or 50% for AI players. The upper cap can be modified in DifficultyMod.xml.

Tile. The tile the unit is standing on during an attack affects anti-warmonger fervor:

If the unit with fervor is standing in friendly territory, it gets the full CS bonus. Friendly territory = unit owner's land, or another player's land that the unit owner entered with permission (for City-States, you need to be Greece, have permission to enter for some reason - e.g. Barbarians are invading the CS - or have at least 30 Influence; for civilizations, you need Open Borders. Being at war does not count as Open Borders).

If the unit with fervor is standing on a tile owned by the player they're attacking, they get no CS bonus.

If the unit is standing anywhere else, the CS bonus is halved, rounded down.

Now, the key part of this calculation is the Warmonger Amount. This is a complicated calculation with a lot of variables, and I'm still working on understanding it. :scan: I'll post more later today.
 
Last edited:
Warmonger Amount is the key value in anti-warmonger fervor and all other warmongering penalties.

Warmonger Amount starts at 0 and cannot be negative. It is reset to 0 for masters and vassals if vassalage is made (voluntary or not). Vassals receive no warmongering penalties since they have no rights, and vassals ignore their master's warmongering. Resurrecting a civ resets your warmongering penalties with them to 0.

The information below explains the current calculation, including any bugs that may be present (which will be noted).

Once every turn while an AI is alive, they reduce all players' warmonger amount in accordance with the table below:
Code:
Other player military strength compared to us is:

IMMENSE or POWERFUL:
- Subtract 2 if Casus Belli is active
- Subtract 5 if Global Peace Accords is active
- Subtract 1 otherwise

STRONG or AVERAGE:
- Subtract 4 if Casus Belli is active
- Subtract 7 if Global Peace Accords is active
- Subtract 3 otherwise

POOR, WEAK or PATHETIC:
- Subtract 5 if Casus Belli is active
- Subtract 8 if Global Peace Accords is active
- Subtract 4 otherwise

This is buggy code - Global Peace Accords should be decreasing the decay rate, and Casus Belli should be increasing the decay rate more than it is already.

Warmonger amount is affected by five events, each of which will be covered below:

- Declaring war on a City-State
- Declaring war on a civilization
- Nuking a civilization
- Capturing a city
- Liberating a city

Event: Civilization declared war on a City-State/civilization
Effect: All civilizations run this code.
Code:
If any of these conditions are true, an individual player won't apply any penalties (and won't add to the # of war declarations counters, either) for this war declaration.
- Attacker is on our team
- Attacker declared war because of a Defensive Pact
- Attacker is a vassal
- Attacker is an unmet player
- We're also at war with the player that was attacked

If the target was a City-State, add 1 to "# of City-States we've seen this player attack".
If the target was a civilization, add 1 to "# of Civilizations we've seen this player attack".

Now apply warmongering penalties.
- For City-States, warmonger modifier begins at 200 plus 10x the # of City-States we've seen this player attack.

- For Civilizations, warmonger modifier begins at 200 plus 10x the # of Civilizations we've seen this player attack.

- Add 50 to warmonger modifier if the attacker's military strength compared to us is STRONG, POWERFUL or IMMENSE, and 25 otherwise.

- If a City-State was attacked, multiply 5 by the warmonger modifier and divide by 100, rounding down.

- If a Civilization was attacked, multiply 10 by the warmonger modifier and divide by 100, rounding down.

- Multiply the result by the game (average) era's Warmonger Percent and divide by 100, rounding down.
Ancient Era: 60
Classical Era: 70
Medieval Era: 80
Renaissance Era: 90
Industrial Era: 100
Modern Era: 110
Atomic Era: 120
Information Era: 130

Add the final value to warmonger amount.

Event: Civilization nuked another civilization
Effect: Civilizations who got nuked run this code.
Code:
- Warmonger modifier begins at 200 plus 25x the # of times we've been nuked by this player.

- Add 50 to warmonger modifier if the attacker's military strength compared to us is STRONG, POWERFUL or IMMENSE, and 25 otherwise.

- Multiply 20 by the warmonger modifier and divide by 100, rounding down.

- Multiply the result by the game (average) era's Warmonger Percent and divide by 100, rounding down.
Ancient Era: 60
Classical Era: 70
Medieval Era: 80
Renaissance Era: 90
Industrial Era: 100
Modern Era: 110
Atomic Era: 120
Information Era: 130

Add the final value to warmonger amount.

There is a bug which causes this code to be run once plus an additional time for every civ that has met both players, rather than only once, meaning the penalty can be dramatically increased
(the intention was to have all other civs apply warmongering penalties when a nuke is used on any civ, but this isn't currently working).

The next post will explain how penalties for city capture and bonuses for city liberation work, which is what I'm sure most of you are interested in knowing. :)
 
Last edited:
Can we have warmonger fervor not apply when defending a vassal's territory? It's kind of weird to see warmonger penalties when defending my vassal.
 
Event: Civilization captured a city (through conquest only; trade doesn't count)
Effect: All civilizations run this code.
Code:
When a player conquers a city:
- If they're able to liberate the city, they will receive warmongering penalties once they choose to raze, annex or puppet it.
- If they're not able to liberate the city, they will receive warmongering penalties right away.

Under certain conditions, no warmongering penalties are applied. These are:
Condition 1 - Capturing a city from Barbarians
Condition 2 - Recapturing a city you founded
Condition 3 - Recapturing a city that you were the *last* to previously own

Condition 3 Example: Civ A conquers Civ B's city, then Civ B recaptures it. If Civ A captures it a second time, they will not receive additional penalties.
However, if Civ C (any other player) acquires the city at any point, Civ A will receive penalties again if they capture it after that.

If none of the three conditions apply, then all civilizations will apply warmongering penalties (see next code block).

Code for applying warmongering penalties from city conquest
Code:
NOTE: "We"/"our" refers to the civ applying the penalties. The conqueror/attacker is the player who captured the city. The victim/conquered is the player who had their city captured.

Don't apply warmongering penalties if any of these conditions are true:
- We're on the conqueror's team
- We're not alive
- We haven't met the conqueror
- We're at war with the victim, and our war score against them is negative (or any of our teammates' war score against them is negative)

Step 1. Base Value
Every turn, the game calculates the economic value of all cities and stores the highest value in memory. Economic value takes into account all city yields, the presence of World Wonders, and luxury/strategic resources.

- Base value starts at (100 * city economic value) / highest economic value of any city (minimum 1), rounded down. Cities are thus rated on a 0-100 scale, where 0 is worthless and 100 is the best city in the world.
- If the city is the victim's capital, base value is increased by 25% (this is potentially bugged; will investigate further).
- If the conqueror has owned the city previously, reduce base value by 10 * the number of times previously owned.
- If Casus Belli is active OR the player is sanctioned (they do not stack), reduce the base value by half, rounded down.
- If Global Peace Accords is active, double the base value.
- Base value is always 1 at minimum.

Step 2. Warmonger Modifier
If the conqueror is a vassal, warmonger modifier is 1.

If the conquered player is our master, warmonger modifier is 150.

Otherwise, warmonger modifier is 100.


Step 3. Warmonger Approach Modifier
Warmonger approach modifier starts at 0.

If we're the victim or we have a Defensive Pact with the victim, add 75 to warmonger approach modifier.

If we're not the victim and we don't have a Defensive Pact with the victim, then compare military strengths.

If the conqueror's military strength compared to us is...
IMMENSE or POWERFUL, add 75.
STRONG or AVERAGE, add 50.
POOR, WEAK or PATHETIC, add 25.

If the victim's military strength compared to us is...
IMMENSE, POWERFUL or STRONG, subtract 50.
AVERAGE, POOR, WEAK or PATHETIC, subtract 25.


Step 4. Warmonger Status Modifier
Warmonger status modifier starts at 0.

If we're also at war with the victim, subtract 25 from warmonger status modifier.

If the victim is a City-State:
- If we're their ally, add 75.
- If we're friends, add 50.
- Otherwise, add 25. (I think this is supposed to be "subtract 25" but it subtracts a negative)

- If we have a Pledge to Protect them, add 75.
- Otherwise, subtract 25.

If we and the conqueror have the same *majority* (note: not official) religion, subtract 25, and if the victim has a different majority religion, subtract an additional 50.

If we and the conqueror have different *majority* (note: not official) religions, add 25, and if the victim has the same majority religion as us, add an additional 50.

If we and the conqueror have the same ideology, subtract 25, and if the victim has a different ideology, subtract an additional 50.

If we and the conqueror have different ideologies, add 25, and if the victim has the same ideology as us, add an additional 50.

If the victim is sanctioned and the victim isn't our master or our vassal, subtract 75.

If Casus Belli is active, subtract 75.

If Global Peace Accords is active, add 75.

If we're an AI player, multiply the current value of warmonger status modifier by (100 + our Diplo Balance flavor + our Warmonger Hate flavor) and divide by 100, rounding down.

If we're a human, assume average values - increase warmonger status modifier by 25%.

Factor in our proximity to the conqueror:
DISTANT: Subtract 25.
FAR: Add 25.
CLOSE: Add 50.
NEIGHBORS: Add 75.

Warmonger status modifier cannot be lower than -75.


Step 5. Apply all modifiers

- Multiply the base value by (100 + Warmonger Modifier) and divide by 100, rounding down.
- Multiply the result by (100 + Warmonger Approach Modifier) and divide by 100, rounding down.
- Multiply the result by (100 + Warmonger Status Modifier) and divide by 100, rounding down.
- Multiply the result by the game (average) era's Warmonger Percent and divide by 100, rounding down.
Ancient Era: 60
Classical Era: 70
Medieval Era: 80
Renaissance Era: 90
Industrial Era: 100
Modern Era: 110
Atomic Era: 120
Information Era: 130

The final value is added to warmonger amount.

Event: Civilization liberated a city
Effect: All civilizations run this code.
Code:
NOTE: "We"/"our" refers to the civ applying the bonus. The liberator is the player who liberated the city. The liberated player is the player who had their city liberated.

Don't apply a liberation bonus if any of these conditions are true:
- We're on the liberator's team
- We're not alive
- We haven't met the liberator
- We're at war with the liberated player, and our war score against them is negative (or any of our teammates' war scores against them are negative).
- The city was liberated from our control

Step 1. Base value
Every turn, the game calculates the economic value of all cities and stores the highest value in memory. Economic value takes into account all city yields, the presence of World Wonders, and luxury/strategic resources.

- Base value starts at (100 * city economic value) / highest economic value of any city (minimum 1), rounded down. Cities are thus rated on a 0-100 scale, where 0 is worthless and 100 is the best city in the world.
- If the city is the victim's capital, base value is increased by 25% (this is potentially bugged; will investigate further).
- If the conqueror has owned the city previously, reduce base value by 10 * the number of times previously owned.
- If Casus Belli is active OR the player is sanctioned (they do not stack), reduce the base value by half, rounded down.
- If Global Peace Accords is active, double the base value.
- Base value is always 1 at minimum.

Step 2. Warmonger status modifier
Warmonger status modifier starts at 0.

Add 300 if we're the liberated player.

Subtract 25 if we're at war with the previous owner of the city (before it was liberated).

Subtract 25 if we're at war with the liberator.

If the liberated player is a City-State:
- If we have at least 60 Influence with that City-State, add 75.
- Otherwise, if we have at least 30 Influence with that City-State, add 50.
- Otherwise, subtract 25.

Factor in our proximity to the liberator:
DISTANT: Subtract 25.
FAR: Add 25.
CLOSE: Add 50.
NEIGHBORS: Add 75.

Warmonger status modifier cannot be lower than -75.

Step 3. Apply warmonger status modifier
- Multiply the base value by (100 + Warmonger Status Modifier) and divide by 100, rounding down.

The final value is subtracted from warmonger amount.

Can we have warmonger fervor not apply when defending a vassal's territory? It's kind of weird to see warmonger penalties when defending my vassal.

That could be done.
 
Information on related metrics:

Warmonger Score is the "warmongering penalties" value used in the Opinion calculation, and also to determine Warmonger Threat below.

This is how it's calculated:
Code:
Base value is warmonger amount.

A player is "untrustworthy" if they've denounced us, we've denounced them, or we consider them (or any of their teammates) a backstabber.

If a player isn't untrustworthy, then reduce the base value based on friendship status:
- If we're currently friends or we have had at least two consecutive DoFs without a denouncement, broken DoF or war declaration since then, then reduce the base value by half, rounded down.
- If this isn't the case, but we DO have a Defensive Pact, then reduce the base value by 25%.
- If neither of these are the case, but we've had at least one DoF in the past without a denouncement, broken DoF or war declaration since then, then reduce the base value by 10%.

If this player isn't untrustworthy and has done any of the following:
- Made a DP with a player we also have a DP with...
- Made a DoF with one of our friends...
- Denounced one of our enemies...

...then reduce the value by 25%.

If this player is untrustworthy, increase the value by 50%.

If this player has denounced any of our friends, made a DoF with any of our enemies, or made a DP with any of our enemies, increase the value by 25%.

If this player resurrected us or we resurrected them, reduce the value by 50%, rounded down.

If we have the same religious interests (either they have our official religion, we have their religion and we didn't found, or we have the same majority religion), then reduce the value by 25%.

If we have opposing religious interests (we both have religions and we don't have the same religious interests, and we're not ignoring religious differences for some reason), then increase the value by 25%.

If we have the same ideology, then reduce the value by 50%.

If we have opposing ideologies and we're not ignoring ideology differences for some reason, then increase the value by 50%.

Multiply the value by our Warmonger Hate flavor (ranges between 1-10) and then divide by 15.

The final value is the Warmonger Score, which is used for the opinion calculation and for warmonger threat.

IMPORTANT NOTE: When at war with a player, only religion, ideology and the Warmonger Hate flavor modify that player's warmonger score.

Warmonger Threat is used to determine how threatening a player is in terms of warmongering. The calculation for it is as follows:
Code:
Check a player's warmonger score (not amount!):

>= 160: Critical Threat
>= 80: Severe Threat
>= 40: Major Threat
>= 10: Minor Threat

If we're on a map with less than 4 players (including City-States) at game start and they've killed at least one player, then override this:
- Warmonger Mod = 10 * (Our Warmonger Hate Flavor - 5); ranges from -40% to +50%.
- Players Killed Percent = 100 * (# of civs *and* City-States they killed) / total number of players

- Add (Players Killed Percent * Warmonger Mod) / 100 to PlayersKilledPercent.

- If PlayersKilledPercent is now at least 40, then warmonger threat is Critical. If it's at least 25, then warmonger threat is Severe.

The AI updates its warmonger threat value before the warmonger amount decays for the turn, not after.
 
Hey do you think warmonger decay rate should scale with game speed? like marathon decays less than epic and like quick decays faster than standard. sort of a minor quibble.
 
As always Recursive, another super thorough and wonderful summary! I am now going to try working through an example to see if I understand under everything.

Our story begins with our hero who is in the Classical era. He encounters an Average Military villain who declares war on him.

EDIT: Recursive corrected a few points (the example is already doing its job!) So I have updated the math and then continued the example. One thing I just learned is that every division loses the remainder, so we will incorporate that.

War Declare in Classical Era
Spoiler :

  • Warmonger Modifier = 200 + 10* 1 (1 civ attacked, me!) + 25 (Villain average military strength) = 235
  • 235 * 10 / 100 (a civilization was attacked) = 23
  • 23 * 70 (Classical Era) / 100 =

  • 16 Warmonger Score
Anti-Warmonger Fervor
16 / 10 = 1 = 1% AW Fervor

The war continues for 3 turns, and then our villain also declares war on a City State. The cad!!!

Warmonger Decay - 3 turns
Spoiler :

Previous Warmonger: 16
16 - 3 turns * 3 (average strength) =
7 warmonger score

War Declare on CS in Classical Era
Spoiler :

  • Warmonger Modifier = 200 + 10* 1 (he attacked me previously) + 10 * 0 (since I'm not a CS, I don't add anything here) + 25 (Villain average military strength = 235
  • 235 * 5 (CS attack) / 100 = 11
  • 11 * 70 (Classical Era) / 100 = 7
  • 7 + 7 (previous warmonger score) =

  • 14 Warmonger Score
AWF
14 / 10 = 1 = 1% AW Fervor


The war grows worse, and the villains strength has increased (now Strong). Further, after 2 more turns of warring, he takes our newly made city Dinkyport! It was literally the worst city in the world, but gosh darn it it was ours!

Warmonger Decay - 2 turns
Spoiler :

Previous Warmonger: 14
14 - 2 turns * 3 (Strong strength) =
8 warmonger score

Lose a City in Classical Era
Spoiler :

Base Value: 1 (bottom of the barrel city economically)
Warmonger Modifier: 100 (neither vassal or master relationship)
Warmonger Approach Modifier: 75 (we are the victim!)
Warmonger Status Modifier: 0 (either side has a religion or ideology yet to modify) * .25 (human average) = 0
0 +75 (we are neighbors) = 75 @Recursive, could you give us a ballpark range of Diplo Balance Flavor and Warmonger Hate Flavor, just to have a feel on how much multiplier this number tends to be?

1 (Base Value) * (100 + 100 [Warmonger Modifier]) / 100 = 2
2 * (100 + 75 [Warmonger Approach Modifier] ) / 100 = 3
3 * (100 + 75 [Warmonger Status Modifier]) / 100 = 5
5 * 70 (Classical Era) / 100 = 3

3 + 8 (previous warmonger score) =
11 warmonger score = 1% AWF


@Recursive can you check me on this so far, I will then continue with another example.

Bonus: What if I had lost my capital (the best city in the world) instead?

Spoiler :

Base Value: 100 (best city in the world) * 1.25 (capital) = 125
Warmonger Modifier: 100 (neither vassal or master relationship)
Warmonger Approach Modifier: 75 (we are the victim!)
Warmonger Status Modifier: 0 (either side has a religion or ideology yet to modify) * .25 (human average) = 0
0 +75 (we are neighbors) = 75 @Recursive, could you give us a ballpark range of Diplo Balance Flavor and Warmonger Hate Flavor, just to have a feel on how much multiplier this number tends to be?

125 (Base Value) * (100 + 100 [Warmonger Modifier]) / 100 = 250
250 * (100 + 75 [Warmonger Approach Modifier] ) / 100 = 437
437 * (100 + 75 [Warmonger Status Modifier]) / 100 = 764
764 * 70 (Classical Era) / 100 = 534

458 + 8 (previous warmonger score) = 542
542 / 10 = 54 = 54% AWF
 
Last edited:
As always Recursive, another super thorough and wonderful summary! I am now going to try working through an example to see if I understand under everything.

Our story begins with our hero who is in the Classical era. He encounters an Average Military villain who declares war on him.

War Declare in Classical Era

  • Warmonger Modifier = 200 + 10* 1 (1 civ attacked, me!) + 25 (Villain average military strength) = 235
  • 235 * 10 / 100 (a civilization was attacked) = 23.5
  • 23.5 * 70 (Classical Era) / 100 = 16.45
Anti-Warmonger Fervor
16.45 / 100 = .1645 (rounded down) = .16

@Recursive, I am going to assume that you meant to divide by 100 and not 10 from your formula, otherwise you always have a value over 1, which I know is not accurate.

.16 * 1 (Classical Era) = .16 = 16% Anti-Warmonger Fervor


Since I have found a possible error, I will stop here and get confirmation, and then continue the example once I know the formula is correct.

Hero's Anti-Warmonger Fervor: Calculation

Base amount = 10
Warmonger Modifier = 200 + (10 * 1) + 25 = 235
10 * 235 / 100 = 23.5 = 23 (rounded down)

23 * 70 (Classical Era) / 100 = 16.1 = Warmonger Amount of 16 (rounded down)

Anti-Warmonger Fervor = 16 / 10 = 1.6 = 1 (rounded down)
1 * current era (1) = 1

Anti-warmonger fervor is 1%.

Every time there's a division, the remainder is discarded, not carried over to the next calculation.
 
For next hotfix/version, I've cleaned up the code and fixed all the bugs I identified during my examination.
 
For next hotfix/version, I've cleaned up the code and fixed all the bugs I identified during my examination.

@Recursive could you take a look at my updated example and see if I am still calculating everything correctly? (this actually led to an interesting forum question...if I edit a post and put a new call out in it, does the user receive that new call out?)
 
One thing I'll note about all this - it is called warmonger but it is probably, more appropriately, war success. Stuff like defending vassals, defending your own land, taking an owned city back, etc., are all examples of success, and since war is a zero-sum game, it makes other civs nervous.
 
One thing I'll note about all this - it is called warmonger but it is probably, more appropriately, war success. Stuff like defending vassals, defending your own land, taking an owned city back, etc., are all examples of success, and since war is a zero-sum game, it makes other civs nervous.

Good point. You should consider changing the term.
 
@Recursive could you take a look at my updated example and see if I am still calculating everything correctly? (this actually led to an interesting forum question...if I edit a post and put a new call out in it, does the user receive that new call out?)

Ah, I didn't receive a notification for your edited post, sorry. Yeah, I'll take a look at it - although keep in mind I've fixed a few things for next version. :)
 
Top Bottom