Since there's been a fair amount of discussion about AI aggression going on, I figured I might as well post the approach calculation.
The approach calculation is how the AI decides whether to plan WAR or be HOSTILE, GUARDED, DECEPTIVE, AFRAID, FRIENDLY or NEUTRAL towards other players.
This code is for the 4-7 beta patch version, after my recent improvements, fixes and changes to AI aggression, so it is not reflective of 3-15-2 and any earlier versions.
However, you might still have thoughts on it - feel free to share.
This thread is intended specifically for comments on the AI's approach selection.
General diplomacy feedback on other things can be posted in the dedicated thread: https://forums.civfanatics.com/threads/diplomacy-ai-development.655040/
---------
Normal Approach Calculation
This calculation is used when updating Approach for most players (special cases are covered in the next section).
For a list of civs and their approach biases, see here: https://civ-5-cbp.fandom.com/wiki/Detailed_Guide_to_Diplomacy#Approach_Biases
Keep in mind approach biases range from 1 to 10, and are randomized by +/- 2 each game. The bias value can go above 10 from the randomization but cannot go below 1.
Here is the approach calculation for the 4-7 beta patch version, written in pseudocode:
---------
Special Case Approach Updates
Under specific circumstances when updating approaches towards major civs, the AI will (rather than go through the full two passes of GetBestApproachTowardsMajorCiv) use a simpler method of updating approaches to improve on performance and effectiveness.
These special case approach updates (if any) occur before the normal approach updates for the turn and are described in pseudocode below:
The approach calculation is how the AI decides whether to plan WAR or be HOSTILE, GUARDED, DECEPTIVE, AFRAID, FRIENDLY or NEUTRAL towards other players.
This code is for the 4-7 beta patch version, after my recent improvements, fixes and changes to AI aggression, so it is not reflective of 3-15-2 and any earlier versions.
However, you might still have thoughts on it - feel free to share.
This thread is intended specifically for comments on the AI's approach selection.
General diplomacy feedback on other things can be posted in the dedicated thread: https://forums.civfanatics.com/threads/diplomacy-ai-development.655040/
---------
Normal Approach Calculation
This calculation is used when updating Approach for most players (special cases are covered in the next section).
For a list of civs and their approach biases, see here: https://civ-5-cbp.fandom.com/wiki/Detailed_Guide_to_Diplomacy#Approach_Biases
Keep in mind approach biases range from 1 to 10, and are randomized by +/- 2 each game. The bias value can go above 10 from the randomization but cannot go below 1.
Here is the approach calculation for the 4-7 beta patch version, written in pseudocode:
Code:
[NOTES ON CERTAIN VARIABLES]
DIPLO TYPE
- At game start, each AI civ is assigned a Diplo Type: CONQUEROR, DIPLOMAT, CULTURAL or SCIENTIFIC.
- This is dependent on the leader's randomized flavors (e.g. leaders with high Offense flavors are more likely to pick CONQUEROR). Weight is also added based on the leader's UA.
- Diplo Type affects which victory condition the AI leader will be extra sensitive to for the current game, and is used several times in this approach function.
- AI civs replacing a human player in MP don't have a Diplo Type and thus, don't use this mechanic.
VICTORY COMPETITION
- The player can disable the AI's victory competitiveness in DiploAIOptions.sql by setting DIPLO_AI_NO_VICTORY_COMPETITION to 1.
- This causes the AI not to apply penalties based on the other player's progress towards winning the game.
- Once the game has been won, victory competition is disabled automatically.
ERA
- For the purposes of the approach function, the Era is 0 in the Ancient Era, 1 in the Classical Era, 2 in the Medieval Era, and so on.
- "Our era" means the evaluating AI player's current era.
- "Their era" means the evaluated player's current era.
BACKSTABBER PENALTY
The AI regularly tests players to determine if they are a "backstabber". Backstabbing penalties can occur if you:
- Break a Declaration of Friendship with a player;
- Denounce a player you're friends with;
- Declare war on a player you're friends with;
- Break a promise not to declare war on a player;
- Break a promise not to conquer a player's protected City-State;
- Declare war on one of your vassals.
AIs will ALSO view you as a backstabber if you've captured their original capital or Holy City (unless they're your capitulated vassal), although only their teammates will agree with this view.
Backstabbing a player can result in global penalties, depending on the severity of the backstabbing and the other AIs' relationships with that player.
Backstabbing penalties do not always occur (for instance, the AI will not care if you declare war on someone who backstabbed them).
They will eventually expire after a number of turns, depending on game speed.
If the AI considers you a "backstabber", or considers anyone on your team a "backstabber", it has a number of negative approach changes throughout this function.
//////////////////////////////////////////////////////
What is the best approach to take towards this player?
Run through the following steps in order.
//////////////////////////////////////////////////////
[PART 1: INITIAL WEIGHTS]
All seven approach scores start at 0.
1. Base Personality Weight
Begin by adding 1x our bias for each approach to our score for that approach.
2. Default Neutral Weight
Add our NEUTRAL bias to the NEUTRAL approach.
3. Last Turn Approach Biases
If our approach last turn was WAR and our war goal towards this player last turn was PREPARE (building up) or CONQUEST (destroy them completely), add our WAR bias to the WAR approach.
If our approach last turn was HOSTILE and we were preparing to demand from this player last turn, add our HOSTILE bias to the HOSTILE approach.
4. Domination Victory Bias
If we're not at war with this player, or we are at war and it's a stalemate or better (GetWarState function), and one of the following is true:
- Our Diplo Type is CONQUEROR, or;
- We're going for a Domination Victory.
... then add our WAR bias to the WAR approach.
5. Easy Target
If these conditions are met:
- We consider this player an easy target;
- We're at war with them already OR we're not at war with any major civilizations.
Then they're considered an "easy target" for the rest of this approach calculation.
If they're an easy target:
- Add our WAR bias to the WAR approach.
6. City-State War Quests
For each City-State that has a quest for us to:
- Declare war on this player, or;
- Liberate a city this player owns, or;
- Capture a city this player owns;
Add one to the war quest counter.
Double the war quest counter if our Diplo Type is DIPLOMAT.
If the war quest counter is above 0, then add our WAR bias plus the war quest counter to the WAR approach.
[PART 2: FRIENDSHIP MODS]
7. Declaration of Friendship
If we currently have a Declaration of Friendship with this player:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
8. Defensive Pact
If we currently have a Defensive Pact with this player:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
9. Research Agreement
If we currently have a research agreement with this player:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
10. Coop War History
Check how many times this player refused to go on a coop war with us.
+1 for each time they refused the request
+2 for each time they refused the request by warning the target AI
+2 for each time they broke a promise to start a coop war with us
-1 for each time they accepted the request and we went to war together
Note #1: The memory value tracking this is set to 0 for both players if one of them capitulates to the other.
Note #2: If one player resurrects the other, then the value is set to 0 for both players *if positive* (bad).
If the total is positive:
- Add our DECEPTIVE bias plus the total to the DECEPTIVE approach.
If the total is negative:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract the total from the FRIENDLY approach (since it's negative; the sign is flipped).
11. Coop War Soon
If we promised to start a coop war with this player against at least one third party:
- Multiply our FRIENDLY bias by the number of coop wars we promised to start with this player, and add that to the FRIENDLY approach.
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
NOTE: Coop war promises between two players are cancelled if a DoF is ended early via the Discuss menu, or the players denounce/go to war with each other.
12. Liberated Cities
If this player has liberated some of our cities, and all of the following conditions are true:
- We don't view this player as a backstabber (see explanation on backstabbing penalties above).
- This player has not captured our original capital.
- This player has not captured our Holy City.
Then:
- Add our FRIENDLY bias plus the number of our cities they've liberated to the FRIENDLY approach.
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
- Set our DECEPTIVE approach score to 0.
13. Resurrection
If this player resurrected us OR we resurrected them ("You restored their civilization after they were annihilated!"):
- Add our FRIENDLY bias to the FRIENDLY approach.
- Set all other approaches to -1x their approach bias value.
If BOTH of us resurrected each other, then:
- Add our FRIENDLY bias to the FRIENDLY approach again.
- Subtract an additional -1x approach bias value from all other approaches.
[PART 3: PROVOCATIONS]
14. Denouncements
We've currently denounced this player!
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Set our FRIENDLY approach score to 0.
This player has currently denounced us!
- Add our GUARDED bias to the GUARDED approach.
- Set our FRIENDLY approach score to 0.
15. Backstabbers
If we consider this player a backstabber:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Add our GUARDED bias to the GUARDED approach.
- Set our FRIENDLY approach score to 0.
If this player is untrustworthy *and* personally betrayed us by:
- Denouncing us while we had a Declaration of Friendship, OR
- Declaring war on us while we had a Declaration of Friendship, OR
- Broke a military promise not to declare war on us, OR
- Broke a promise not to conquer our protected City-State, OR
- Declared war on us while we were their vassal...
Then, apply extra penalties:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Add 2x our GUARDED bias to the GUARDED approach.
16. Captured Our Major Cities
Skip this check if we're this player's capitulated vassal.
If this player currently owns our original capital:
- Add 2x our WAR bias to the WAR approach.
- Add 2xour HOSTILE bias to the HOSTILE approach.
- Add 2x our GUARDED bias to the GUARDED approach.
If this player currently owns our Holy City:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Add 2x our GUARDED bias to the GUARDED approach.
If this player is an easy target:
- And they currently own our original capital, add 100 to the WAR approach.
- And they currently own our Holy City, add 5x our WAR bias to the WAR approach.
*NOTE:* Using an Inquisitor on the Holy City to remove its Holy City status will clear the associated penalties.
17. Stolen Territory
If this player has stolen our territory *DURING PEACETIME* with a Great General or America's UA:
- Add our WAR bias plus the number of thefts to the WAR approach.
- Add our HOSTILE bias plus the number of thefts to the HOSTILE approach.
If they're an easy target:
- Add 2x our WAR bias to the WAR approach.
NOTE: The number of thefts is reset to 0 for both players when war is declared between them.
Stealing territory while at war does not accrue diplomatic penalties.
18. Attacks on Protected City-States
If this player killed one of our protected City-States within the past 50 turns:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Set our FRIENDLY approach score to 0.
If they haven't killed any recently, but they *have* attacked one of our protected City-States within the past 30 turns:
If they have EVER killed one of our protected City-States:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Set our FRIENDLY approach score to 0.
Otherwise:
- Add our HOSTILE bias to the HOSTILE approach.
- Add our GUARDED bias to the GUARDED approach.
19. Captured Cities
Skip this check if their proximity from us is FAR or DISTANT.
Otherwise, count how many cities we've captured from them, and how many they've captured from us.
Subtract our conquests from their conquests to get the "difference of cities".
NOTE: The captured city count is reset for both players if either player resurrects the other.
If we've captured more cities from them than they've captured from us, check their military strength:
If they're an easy target:
- Add our WAR bias plus 2x the difference of cities to the WAR approach.
- Add our HOSTILE bias plus 2x the difference of cities to the HOSTILE approach.
Otherwise, if their military strength compared to us is AVERAGE or weaker:
- Add our WAR bias plus the difference of cities to the WAR approach.
- Add our HOSTILE bias plus the difference of cities to the HOSTILE approach.
Otherwise, if they're not our capitulated vassal, expect revenge:
- Add our GUARDED bias plus the difference of cities to the GUARDED approach.
If they've captured more cities from them than we've captured from them, check their military strength:
Skip this check if we're their vassal, UNLESS they have previously declared war on one of their own vassals.
Multiply the difference of cities by -1 (flip the sign).
If they're an easy target:
- Add our WAR bias plus 2x the difference of cities to the WAR approach.
- Add our HOSTILE bias plus 2x the difference of cities to the HOSTILE approach.
Otherwise, if their military strength compared to us is below AVERAGE:
- Add our WAR bias plus the difference of cities to the WAR approach.
- Add our HOSTILE bias plus the difference of cities to the HOSTILE approach.
Otherwise:
- Subtract our WAR bias plus the difference of cities from the WAR approach.
- Subtract our HOSTILE bias plus the difference of cities from the HOSTILE approach.
- Add our GUARDED bias plus the difference of cities to the GUARDED approach.
[PART 4: KEY PLAYERS]
20. Biggest and Major Competitors
If this player is our biggest competitor (> 18 competitor weight, highest competitor weight of all major civs):
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add 2x our WAR bias to the WAR approach.
Otherwise, if this player is a major competitor of ours (IsMajorCompetitor function):
- Add our WAR bias to the WAR approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
Otherwise, they're NOT a major competitor, so:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
21. Most Valuable DoF
If this player is our most valuable DoF (> 32 DoF weight, and more than all other civs), then:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
Otherwise, if this player is our most valuable DoF *EXCLUDING OUR CURRENT FRIENDS*:
- Add our FRIENDLY bias to the FRIENDLY approach.
22. Most Valuable DP
Skip this check if we do not have shared embassies, or Defensive Pact trading with this team is not allowed.
If this player is our most valuable DP (> 18 DP weight, and more than all other civs), then:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
Otherwise, if this player is our most valuable DP *EXCLUDING OUR CURRENT DPs*:
- Add our FRIENDLY bias to the FRIENDLY approach.
23. Relations to Other Key Players
Loop through all other valid major civs (not on our team, not on their team, not unmet, not dead, > 0 cities).
If they're at war with the other player:
If the other player is our biggest competitor:
- Add our FRIENDLY bias to the FRIENDLY approach.
Otherwise, if the other player is our most valuable DoF:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
Otherwise, if the other player is our most valuable DP (and we have shared embassies with that player, and Defensive Pact trading with them is allowed):
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
Otherwise, if they have a Defensive Pact with the other player, and the other player's military strength compared to us is AVERAGE or stronger:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
[PART 5: EVALUATIONS]
24. Military Threat
What is this player's military threat level? (GetMilitaryThreat function)
CRITICAL
- Add 2x our AFRAID bias to the AFRAID approach.
SEVERE
- Add our AFRAID bias to the AFRAID approach.
- Add our GUARDED bias to the GUARDED approach.
MAJOR
- Add our GUARDED bias to the GUARDED approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
MINOR
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NONE
- Add our FRIENDLY bias to the FRIENDLY approach.
25. Warmonger Threat
What is this player's warmonger threat level? (GetWarmongerThreat function)
CRITICAL
- Add our WAR bias to the WAR approach.
- Add our AFRAID bias to the AFRAID approach.
- Add our HOSTILE bias to the HOSTILE approach.
SEVERE
- Add our WAR bias to the WAR approach.
- Add our GUARDED bias to the GUARDED approach.
- Add our HOSTILE bias to the HOSTILE approach.
MAJOR
- Add our GUARDED bias to the GUARDED approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
MINOR
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NONE
- Add our FRIENDLY bias to the FRIENDLY approach.
26. Military Strength Compared To Us
What is this player's military strength compared to us? (GetPlayerMilitaryStrengthComparedToUs function)
IMMENSE
- Add 4x our AFRAID bias to the AFRAID approach.
- Subtract 3x our WAR bias from the WAR approach.
- Subtract 3x our HOSTILE bias from the HOSTILE approach.
POWERFUL
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our GUARDED bias to the GUARDED approach.
- Add 2x our AFRAID bias to the AFRAID approach.
- Subtract 2x our WAR bias from the WAR approach.
- Subtract 2x our HOSTILE bias from the HOSTILE approach.
STRONG
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
AVERAGE
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
POOR
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
- Subtract our AFRAID bias from the AFRAID approach.
- Subtract our GUARDED bias from the GUARDED approach.
WEAK
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Subtract 2x our AFRAID bias from the AFRAID approach.
- Subtract 2x our GUARDED bias from the GUARDED approach.
PATHETIC
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Subtract 3x our AFRAID bias from the AFRAID approach.
- Subtract 3x our GUARDED bias from the GUARDED approach.
27. Economic Strength Compared To Us
What is this player's economic strength compared to us? (GetPlayerEconomicStrengthComparedToUs function)
IMMENSE
- Add 4x our AFRAID bias to the AFRAID approach.
- Subtract 3x our WAR bias from the WAR approach.
- Subtract 3x our HOSTILE bias from the HOSTILE approach.
POWERFUL
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our GUARDED bias to the GUARDED approach.
- Add 2x our AFRAID bias to the AFRAID approach.
- Subtract 2x our WAR bias from the WAR approach.
- Subtract 2x our HOSTILE bias from the HOSTILE approach.
STRONG
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
AVERAGE
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
POOR
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
- Subtract our AFRAID bias from the AFRAID approach.
- Subtract our GUARDED bias from the GUARDED approach.
WEAK
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Subtract 2x our AFRAID bias from the AFRAID approach.
- Subtract 2x our GUARDED bias from the GUARDED approach.
PATHETIC
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Subtract 3x our AFRAID bias from the AFRAID approach.
- Subtract 3x our GUARDED bias from the GUARDED approach.
28. DoF Level
What is our DoF Level with this player? (GetDoFType function)
DoF Level starts at NEW and is set to UNTRUSTWORTHY if a DoF is broken, or there is a denouncement/DoW in either direction.
Every time a DoF is signed, DoF Level advances as follows based on the old level:
UNTRUSTWORTHY or NEW -> FRIENDS
FRIENDS -> ALLIES
ALLIES -> BATTLE BROTHERS (highest level)
If DoF Level is...
UNTRUSTWORTHY
- Add our WAR bias plus our Era to the WAR approach.
- Add our GUARDED bias plus our Era to the GUARDED approach.
- Add our HOSTILE bias plus our Era to the HOSTILE approach.
NEW
- Add our NEUTRAL bias plus our Era to the NEUTRAL approach.
- Add our FRIENDLY bias plus our Era to the FRIENDLY approach.
FRIENDS
- Add our FRIENDLY bias plus our Era to the FRIENDLY approach.
- Subtract our DECEPTIVE bias plus our Era from the DECEPTIVE approach.
ALLIES
- Add our FRIENDLY bias plus 2x our Era to the FRIENDLY approach.
- Subtract our DECEPTIVE bias plus 2x our Era from the DECEPTIVE approach.
BATTLE BROTHERS
- Add our FRIENDLY bias plus 3x our Era to the FRIENDLY approach.
- Subtract our DECEPTIVE bias plus 3x our Era from the DECEPTIVE approach.
29. Victory Dispute Level
How competitive are we over the same victory condition? (GetVictoryDisputeLevel function)
Skip this check if the game turn is 150 or less, or victory competition is disabled.
(NOTE: Vassals do not compete for victory.)
FIERCE COMPETITION
Opinion Indicator: "They know you are competing with them, and they hate it!"
- Add our GUARDED bias plus their era to the GUARDED approach.
- Add our HOSTILE bias plus their era to the HOSTILE approach.
- Add our WAR bias plus their era to the WAR approach.
STRONG COMPETITION
Opinion Indicator: "They suspect you are competing with them."
- Add our DECEPTIVE bias plus their era to the DECEPTIVE approach.
- Add our GUARDED bias plus their era to the GUARDED approach.
- Add our WAR bias plus their era to the WAR approach.
WEAK COMPETITION
Opinion Indicator: "They fear you are competing with them."
- Add our NEUTRAL bias plus their era to the NEUTRAL approach.
- Add our DECEPTIVE bias plus their era to the DECEPTIVE approach.
NO COMPETITION
- Add our FRIENDLY bias plus their era to the FRIENDLY approach.
- Add our NEUTRAL bias plus their era to the NEUTRAL approach.
30. Victory Block Level
How much do we want to stop this player from winning? (GetVictoryBlockLevel function; the farther you are in the lead, the more they hate you)
Skip this check if the game turn is 150 or less, or victory competition is disabled.
(NOTE: Vassals do not compete for victory.)
(NOTE #2: If Opinion of this major civ is FRIEND or ALLY, no victory block penalties are applied.)
FIERCE DESIRE
Opinion Indicator: "Your behavior infuriates them."
- Add our GUARDED bias plus their era to the GUARDED approach.
- Add our HOSTILE bias plus their era to the HOSTILE approach.
- Add our WAR bias plus their era to the WAR approach.
STRONG DESIRE
Opinion Indicator: "Your behavior angers them."
- Add our DECEPTIVE bias plus their era to the DECEPTIVE approach.
- Add our GUARDED bias plus their era to the GUARDED approach.
- Add our WAR bias plus their era to the WAR approach.
WEAK DESIRE
Opinion Indicator: "Your behavior worries them."
- Add our NEUTRAL bias plus their era to the NEUTRAL approach.
- Add our DECEPTIVE bias plus their era to the DECEPTIVE approach.
NO DESIRE
- Add our FRIENDLY bias plus their era to the FRIENDLY approach.
- Add our NEUTRAL bias plus their era to the NEUTRAL approach.
31. Land Dispute Level
How much do we covet their lands? (GetLandDisputeLevel function)
MULTIPLIER begins at 1.
BONUS begins set to true. (territorial disputes are always important!)
VICTORY CONCERN begins set to false.
If our Diplo Type is CONQUEROR or our UA grants war bonuses:
- Increase MULTIPLIER by 1.
If our era is Ancient or Classical:
- Increase MULTIPLIER by 1.
If our era is Medieval+ and we're going for a Domination Victory:
- Increase MULTIPLIER by 1.
- Set VICTORY CONCERN to true.
If we're close to a Domination Victory:
- Increase MULTIPLIER by 1.
- Set VICTORY CONCERN to true.
If the other player is a reckless expander:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
If victory competition is enabled, add the number of vassals and the number of capitals the other player possesses together.
If the sum of these is greater than 2 OR they're close to a Domination Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- Land Dispute Check -
Opinion Indicator if WEAK or above: "Territorial disputes strain your relationship."
Opinion Indicator if NONE: "You have no contested borders."
NO DISPUTE
(Only apply a bonus here if BONUS is set to true.)
- Multiply our FRIENDLY bias by the MULTIPLIER, and add that to the FRIENDLY approach.
- Multiply our NEUTRAL bias by the MULTIPLIER, and add that to the NEUTRAL approach.
WEAK DISPUTE
- If Victory Concern is true OR our Diplo Type is CONQUEROR OR our UA grants war bonuses, multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our DECEPTIVE bias by the MULTIPLIER, and add that to the DECEPTIVE approach.
STRONG DISPUTE
- Multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our HOSTILE bias by the MULTIPLIER, and add that to the HOSTILE approach.
FIERCE DISPUTE
- If Victory Concern is true, double the multiplier. If false, but our Diplo Type is CONQUEROR OR our UA grants war bonuses, increase multiplier by 1.
- Multiply our WAR bias by the multiplier, and add that to the WAR approach.
- Multiply our HOSTILE bias by the multiplier, and add that to the HOSTILE approach.
32. City-State Dispute Level
How much are we competing with this player for the favor of the same City-States? (GetMinorCivDisputeLevel function)
NOTE: This check is only calculated if the AI has met at least one City-State who is still alive.
If there are no living City-States in the game, or they haven't met any, no bonus or penalty will be added for this.
MULTIPLIER begins at 1.
BONUS begins set to false.
VICTORY CONCERN begins set to false.
If our Diplo Type is DIPLOMAT or our UA grants diplomacy bonuses:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
If our era is Renaissance+ and we're going for a Diplomatic Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
- Set VICTORY CONCERN to true.
If we're close to a Diplomatic Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
- Set VICTORY CONCERN to true.
If they're close to a Diplomatic Victory and victory competition is enabled:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- Set VICTORY CONCERN to true.
If they have a diplomatic penalty for performing a City-State coup against us:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
If they've recently attacked (30 turns) or killed (50 turns) our protected City-States, or broke/ignored a promise not to conquer our protected City-State:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- City-State Dispute Check -
Opinion Indicator if WEAK or above: "You are competing for the favor of the same City-States!"
Opinion Indicator if NONE: "You are not competing for the favor of the same City-States." (only if Diplo Type is DIPLOMAT and no City-State coup penalty)
NO DISPUTE
(Only apply a bonus here if BONUS is set to true.)
- Multiply our FRIENDLY bias by the MULTIPLIER, and add that to the FRIENDLY approach.
- Multiply our NEUTRAL bias by the MULTIPLIER, and add that to the NEUTRAL approach.
WEAK DISPUTE
- If Victory Concern is true OR our Diplo Type is DIPLOMAT OR our UA grants diplomacy bonuses, multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our DECEPTIVE bias by the MULTIPLIER, and add that to the DECEPTIVE approach.
STRONG DISPUTE
- Multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our HOSTILE bias by the MULTIPLIER, and add that to the HOSTILE approach.
FIERCE DISPUTE
- If Victory Concern is true, double the multiplier. If false, but our Diplo Type is DIPLOMAT OR our UA grants diplomacy bonuses, increase multiplier by 1.
- Multiply our WAR bias by the multiplier, and add that to the WAR approach.
- Multiply our HOSTILE bias by the multiplier, and add that to the HOSTILE approach.
33. Wonder Dispute Level
How much are we competing with this player for World Wonders? (GetWonderDisputeLevel function)
MULTIPLIER begins at 1.
BONUS begins set to false.
VICTORY CONCERN begins set to false.
If our Diplo Type is CULTURAL or our UA grants cultural bonuses:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
If our era is Renaissance+ and we're going for a Culture Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
- Set VICTORY CONCERN to true.
If we're close to a Culture Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
- Set VICTORY CONCERN to true.
If they're close to a Culture Victory and victory competition is enabled:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- Set VICTORY CONCERN to true.
If their Influence Level over us is INFLUENTIAL or DOMINANT:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
If their Influence Level over us is POPULAR and their Influence Trend is RISING:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
If this player is a wonder spammer:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- Wonder Dispute Check -
Opinion Indicator if WEAK or above: "You are competing for World Wonders."
Opinion Indicator if NONE: "You are not competing for World Wonders." (only if Diplo Type is CULTURAL and no wonder spammer penalty)
NO DISPUTE
(Only apply a bonus here if BONUS is set to true.)
- Multiply our FRIENDLY bias by the MULTIPLIER, and add that to the FRIENDLY approach.
- Multiply our NEUTRAL bias by the MULTIPLIER, and add that to the NEUTRAL approach.
WEAK DISPUTE
- If Victory Concern is true OR our Diplo Type is CULTURAL OR our UA grants cultural bonuses, multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our DECEPTIVE bias by the MULTIPLIER, and add that to the DECEPTIVE approach.
STRONG DISPUTE
- Multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our HOSTILE bias by the MULTIPLIER, and add that to the HOSTILE approach.
FIERCE DISPUTE
- If Victory Concern is true, double the multiplier. If false, but our Diplo Type is CULTURAL OR our UA grants cultural bonuses, increase multiplier by 1.
- Multiply our WAR bias by the multiplier, and add that to the WAR approach.
- Multiply our HOSTILE bias by the multiplier, and add that to the HOSTILE approach.
34. Tech Competition Level
How far ahead or behind are they in technology? (GetTechDisputeLevel function)
MULTIPLIER begins at 1.
BONUS begins set to false.
VICTORY CONCERN begins set to false.
If our Diplo Type is SCIENTIFIC or our UA grants scientific bonuses:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
If our era is Renaissance+ and we're going for a Science Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
- Set VICTORY CONCERN to true.
If we're close to a Science Victory:
- Increase MULTIPLIER by 1.
- Set BONUS to true.
- Set VICTORY CONCERN to true.
If they're close to a Science Victory and victory competition is enabled:
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- Set VICTORY CONCERN to true.
If they have a diplomatic penalty for spying on us (a broken/ignored promise counts for this):
- Increase MULTIPLIER by 1.
- Set BONUS to false.
- Tech Competition Check -
Opinion Indicator if WEAK or above: "You are competing for technological advancement." (only if Diplo Type is SCIENTIFIC)
Opinion Indicator if NONE: "You are not competing for technological advancement." (only if Diplo Type is SCIENTIFIC)
NO DISPUTE (0 or less techs ahead)
(Only apply a bonus here if BONUS is set to true.)
- Multiply our FRIENDLY bias by the MULTIPLIER, and add that to the FRIENDLY approach.
- Multiply our NEUTRAL bias by the MULTIPLIER, and add that to the NEUTRAL approach.
WEAK DISPUTE (1 or 2 techs ahead)
- If Victory Concern is true OR our Diplo Type is SCIENTIFIC OR our UA grants scientific bonuses, multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our DECEPTIVE bias by the MULTIPLIER, and add that to the DECEPTIVE approach.
STRONG DISPUTE (3 or 4 techs ahead)
- Multiply our WAR bias by the MULTIPLIER, and add that to the WAR approach.
- Multiply our GUARDED bias by the MULTIPLIER, and add that to the GUARDED approach.
- Multiply our HOSTILE bias by the MULTIPLIER, and add that to the HOSTILE approach.
FIERCE DISPUTE (5 or more techs ahead, or has built spaceship parts)
- If Victory Concern is true, double the multiplier. If false, but our Diplo Type is SCIENTIFIC OR our UA grants scientific bonuses, increase multiplier by 1.
- Multiply our WAR bias by the multiplier, and add that to the WAR approach.
- Multiply our HOSTILE bias by the multiplier, and add that to the HOSTILE approach.
35. War Projection
How well do we a think a war against this player would go? (GetWarProjection function)
Estimated consequences of the war for us:
VERY GOOD
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
GOOD
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our WAR bias to the WAR approach.
STALEMATE or UNKNOWN
- Add our NEUTRAL bias to the NEUTRAL approach.
DEFEAT
- Add our AFRAID bias to the AFRAID approach.
- Add our GUARDED bias to the GUARDED approach.
DESTRUCTION
- Add 2x our AFRAID bias to the AFRAID approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
36. Target Value
Our assessment of this player's value as a military target (based on overall strength estimate) (GetPlayerTargetValue function)
SOFT
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Add 2x our WAR bias to the WAR approach.
FAVORABLE
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our WAR bias to the WAR approach.
AVERAGE
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
BAD
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
IMPOSSIBLE
- Add our FRIENDLY bias to the FRIENDLY approach.
37. Military Aggressive Posture
How much threat is posed by their military deployment near our borders? (GetMilitaryAggressivePosture function)
*Note:* Aggressive posture is NONE if they've given you Open Borders, you resurrected them, or you have a Declaration of Friendship or Defensive Pact with them.
HIGH or INCREDIBLE
Opinion Indicator: "Your military deployment is extremely threatening."
- Add our HOSTILE bias to the HOSTILE approach.
- Add our WAR bias to the WAR approach.
MEDIUM
Opinion Indicator: "Your military deployment is threatening."
- Add our GUARDED bias to the GUARDED approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
LOW
Opinion Indicator: "Your military deployment is threatening."
- Add our NEUTRAL bias to the NEUTRAL approach.
NONE
- Add our FRIENDLY bias to the FRIENDLY approach.
38. Vassalage
38A. They're a Master
If the player we're looking at has vassals:
For each of their vassals:
- Get our approach towards them (from the previous time it was updated), and add 1x that approach's bias to that approach's score.
- EXCEPTION: "Special case" players are always updated before normal players, so their new approaches from this turn's update are used here.
38B. They're Someone Else's Vassal
If the player we're looking at has a master that isn't us:
If we have the same master as them, add 2x our FRIENDLY bias to the FRIENDLY approach.
Otherwise, for each player on their master's team:
- Get our approach towards them (from the previous time it was updated), and add 1x that approach's bias to that approach's score.
- EXCEPTION: "Special case" players are always updated before normal players, so their new approaches from this turn's update are used here.
38C. They're Our Master
If they're our master, then what do we think about how they've treated us?
Tip: You can view what a vassal thinks of their treatment, and why, in the Vassalage Overview.
If we are a voluntary rather than a capitulated vassal:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
If they have previously declared war on one of their own vassals:
- Add 5x our GUARDED bias to the GUARDED approach.
CONTENT
Add 5x our FRIENDLY bias to the FRIENDLY approach.
Add 2x our NEUTRAL bias to the NEUTRAL approach.
Subtract 5x our HOSTILE bias from the HOSTILE approach.
Subtract 5x our GUARDED bias from the GUARDED approach.
DISAGREE
Add 2x our FRIENDLY bias to the FRIENDLY approach.
Add 5x our NEUTRAL bias to the NEUTRAL approach.
Add 2x our HOSTILE bias to the HOSTILE approach.
Add 2x our GUARDED bias to the GUARDED approach.
MISTREATED
Add 2x our NEUTRAL bias to the NEUTRAL approach.
Add 5x our HOSTILE bias to the HOSTILE approach.
Add 5x our GUARDED bias to the GUARDED approach.
UNHAPPY
Subtract 2x our FRIENDLY bias from the FRIENDLY approach.
Subtract 2x our NEUTRAL bias from the NEUTRAL approach.
Add 5x our HOSTILE bias to the HOSTILE approach.
Add 5x our GUARDED bias to the GUARDED approach.
ENSLAVED
Subtract 5x our FRIENDLY bias from the FRIENDLY approach.
Subtract 5x our NEUTRAL bias from the NEUTRAL approach.
Add 10x our HOSTILE bias to the HOSTILE approach.
Add 10x our GUARDED bias to the GUARDED approach.
38D. Special Modifiers
We were their vassal and they refused to give us our independence when we asked:
- Add 4x our WAR bias to the WAR approach.
- Subtract 10x our DECEPTIVE bias from the DECEPTIVE approach.
- Subtract 10x our FRIENDLY bias from the FRIENDLY approach.
We were their vassal and they gave us our independence when we asked:
- Subtract 4x our WAR bias from the WAR approach.
- Add 2x our DECEPTIVE bias to the DECEPTIVE approach.
- Add 5x our FRIENDLY bias to the FRIENDLY approach.
[PART 6: STRATEGIC DIPLOMACY]
39. Social Policies
If we have similar Social Policies (visible in the Opinion table) and they're not a backstabber:
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
- Subtract our GUARDED bias from the GUARDED approach.
If we have divergent Social Policies (visible in the Opinion table):
If their military strength compared to us is below AVERAGE:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
Otherwise:
- Add our GUARDED bias to the GUARDED approach.
40. Religion
Skip this check if both of us don't have a majority religion yet (pantheons don't count).
The Diplo Emphasis for Religion (henceforth called "ReligionEmphasis") depends on GAME (i.e. average) era.
Ancient Era = 2
Classical Era = 4
Medieval Era = 6
Renaissance Era = 5
Industrial Era = 4
Modern Era = 3
Atomic Era = 2
Information Era = 1
If they've been converting our cities (unless they promised to stop, and kept the promise).
- Add our WAR bias plus ReligionEmphasis to the WAR approach.
- Add our HOSTILE bias plus ReligionEmphasis to the HOSTILE approach.
If we have the same religion, they're not a backstabber, and they didn't capture our Holy City:
- Add our FRIENDLY bias plus ReligionEmphasis to the FRIENDLY approach, and:
If it's the World Religion and either of us is its founder or Holy City controller, then:
- Add our FRIENDLY bias plus ReligionEmphasis to the FRIENDLY approach.
If we have different religions:
- Add our WAR bias plus ReligionEmphasis to the WAR approach.
- Add our DECEPTIVE bias plus ReligionEmphasis to the DECEPTIVE approach.
- Add our GUARDED bias plus ReligionEmphasis to the GUARDED approach.
If their religion is also the World Religion and they're its founder or Holy City controller, then:
- Add our WAR bias plus ReligionEmphasis to the WAR approach.
- Add our HOSTILE bias plus ReligionEmphasis to the HOSTILE approach.
- Add our GUARDED bias plus ReligionEmphasis to the GUARDED approach.
41. Ideology
The Diplo Emphasis for Ideology (henceforth called "IdeologyEmphasis") depends on GAME (i.e. average) era.
Industrial or earlier = 7
Modern = 9
Atomic = 10
Information = 8
If we have the same ideology and they're not a backstabber (having no ideology does not count):
- Add our FRIENDLY bias plus IdeologyEmphasis to the FRIENDLY approach.
- Subtract our WAR bias plus IdeologyEmphasis from the WAR approach.
- Subtract our HOSTILE bias plus IdeologyEmphasis from the HOSTILE approach.
- Subtract our GUARDED bias plus IdeologyEmphasis from the GUARDED approach.
If we have opposing ideologies (having no ideology does not count):
- Subtract our FRIENDLY bias plus IdeologyEmphasis from the FRIENDLY approach.
- Add our WAR bias plus IdeologyEmphasis to the WAR approach.
- Add our HOSTILE bias plus IdeologyEmphasis to the HOSTILE approach.
- Add our GUARDED bias plus IdeologyEmphasis to the GUARDED approach.
42. Global Politics - Good Alliances
Skip this check if they're a backstabber.
Loop through all other valid major civs (not on our team, not on their team, not unmet, not dead, > 0 cities).
NOTE: If we're at war with a player, we have denounced them, or they're a backstabber, then they're an enemy for the purposes of this check.
For each enemy of ours that they're at war with:
- Add 2x our NEUTRAL bias to the NEUTRAL approach.
- If we don't have opposing religions and the enemy does have a religion that opposes ours, then add ReligionEmphasis to the FRIENDLY approach.
- If we don't have opposing ideologies and the enemy does have an ideology that opposes ours, then add IdeologyEmphasis to the FRIENDLY approach.
For each enemy of ours that they've denounced:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
- If we have the same religion and the enemy has an opposing religion, then add ReligionEmphasis to the FRIENDLY approach.
- If we have the same ideology and the enemy has an opposing ideology, then add IdeologyEmphasis to the FRIENDLY approach.
For each non-enemy of ours:
If both of us have made a Declaration of Friendship with the non-enemy:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
- Subtract our GUARDED bias from the HOSTILE approach.
If all three of us have the same religion:
- Add ReligionEmphasis to the FRIENDLY approach.
If all three of us have the same ideology:
- Add IdeologyEmphasis to the FRIENDLY approach.
If both of us have made a Defensive Pact with the non-enemy:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
- Subtract our GUARDED bias from the HOSTILE approach.
If all three of us have the same religion:
- Add ReligionEmphasis to the FRIENDLY approach.
If all three of us have the same ideology:
- Add IdeologyEmphasis to the FRIENDLY approach.
43. Global Politics - Bad Alliances
Loop through all other valid major civs (not on our team, not on their team, not unmet, not dead, > 0 cities).
NOTE: If we're at war with a player, we have denounced them, or they're a backstabber, then they're an enemy for the purposes of this check.
For each enemy of ours:
If this player has made a Declaration of Friendship with the enemy:
- Add our HOSTILE bias to the HOSTILE approach.
- Add our GUARDED bias to the GUARDED approach.
- Subtract our FRIENDLY bias from the FRIENDLY approach.
- Subtract 2x our NEUTRAL bias from the NEUTRAL approach.
If they both have the same majority religion, and that religion opposes ours:
- Add ReligionEmphasis to the WAR approach.
- Add ReligionEmphasis to the HOSTILE approach.
If they both have the same ideology, and that ideology opposes ours:
- Add IdeologyEmphasis to the WAR approach.
- Add IdeologyEmphasis to the HOSTILE approach.
If this player has made a Defensive Pact with the enemy:
- Add our HOSTILE bias to the HOSTILE approach.
- Add our GUARDED bias to the GUARDED approach.
- Subtract our FRIENDLY bias from the FRIENDLY approach.
- Subtract 2x our NEUTRAL bias from the NEUTRAL approach.
If they both have the same majority religion, and that religion opposes ours:
- Add ReligionEmphasis to the WAR approach.
- Add ReligionEmphasis to the HOSTILE approach.
If they both have the same ideology, and that ideology opposes ours:
- Add IdeologyEmphasis to the WAR approach.
- Add IdeologyEmphasis to the HOSTILE approach.
For each friend (DoF Accepted) of ours:
If this player is at war with the friend:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Subtract 2x our FRIENDLY bias from the FRIENDLY approach.
- Subtract our NEUTRAL bias from the NEUTRAL approach.
If the friend has the same majority religion as us, and this player has an opposing religion:
- Add ReligionEmphasis to the WAR approach.
- Add ReligionEmphasis to the HOSTILE approach.
If all three of us have the same majority religion, then they're a traitor to the faith!
- Subtract ReligionEmphasis from the FRIENDLY approach.
- Add ReligionEmphasis to the GUARDED approach.
If the friend has the same ideology as us, and this player has an opposing ideology:
- Add IdeologyEmphasis to the WAR approach.
- Add IdeologyEmphasis to the HOSTILE approach.
If all three of us have the same ideology, then they're a traitor to the ideology!
- Subtract IdeologyEmphasis from the FRIENDLY approach.
- Add IdeologyEmphasis to the GUARDED approach.
If this player has denounced the friend:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Subtract 2x our FRIENDLY bias from the FRIENDLY approach.
- Subtract our NEUTRAL bias from the NEUTRAL approach.
If the friend has the same majority religion as us, and this player has an opposing religion:
- Add ReligionEmphasis to the WAR approach.
- Add ReligionEmphasis to the HOSTILE approach.
If all three of us have the same majority religion, then they're a traitor to the faith!
- Subtract ReligionEmphasis from the FRIENDLY approach.
- Add ReligionEmphasis to the GUARDED approach.
If the friend has the same ideology as us, and this player has an opposing ideology:
- Add IdeologyEmphasis to the WAR approach.
- Add IdeologyEmphasis to the HOSTILE approach.
If all three of us have the same ideology, then they're a traitor to the ideology!
- Subtract IdeologyEmphasis from the FRIENDLY approach.
- Add IdeologyEmphasis to the GUARDED approach.
44. Trade Value
- Multiply the total gold we're getting from trade routes with this player by 100.
- Multiply the total science we're getting from trade routes with this player by 100.
- Multiply the total culture we're getting from trade routes with this player by 100.
- Multiply the total gold they're getting from trade routes with us by 100.
- Multiply the total science they're getting from trade routes with us by 100.
- Multiply the total culture they're getting from trade routes with us by 100.
- Estimate our total GPT by getting the total GPT from our cities (including trade route yields) and multiply by 100.
- Estimate our total Science per turn by getting the total Science per turn from our cities (including trade route yields) and multiply by 100.
- Estimate our total Culture per turn by getting the total Culture per turn from our cities (including trade route yields) and multiply by 100.
- For the Culture estimate, also add 100x the handicap bonus (FreeCulturePerTurn) to this. The AI doesn't normally receive a Culture per turn boost but humans can add one manually via DifficultyMod.xml.
Calculate the "trade deltas" with this player:
- Gold Delta = (5 * (GPT we get - GPT they get)) / GPT estimate
- Science Delta = (5 * (SPT we get - SPT they get)) / SPT estimate
- Culture Delta = (5 * (CPT we get - CPT they get)) / CPT estimate
* The results from all divisions are rounded down to the nearest integer (any remainder is ignored).
* If any of the estimates are 0 or negative, 1 is used in place of the estimate.
Now add in the value from ongoing trade deals with this player:
[Deal Value Calculation]
Deal value starts at 0.
For each ongoing deal with them:
- If we're getting GPT from this deal, multiply the GPT by the amount of turns left in the deal, and add this to the deal value.
- If we're getting resources from this deal, multiply the number of resources in the deal by the amount of turns left in the deal, and add this to the deal value.
- If this deal allows us Open Borders in their lands, add 10 to deal value.
- If this deal allows them Open Borders in our lands, add 5 to deal value.
- If this deal has a Defensive Pact in it, add 10 to deal value.
[End Deal Value Calculation]
Now that we have the total deal value:
- Add our Diplo Balance and Loyalty leader flavors together (average for each is 5); this determines how much we care about trade loyalty.
- Multiply the total deal value by the sum of the flavors.
- Divide by 20 and discard any remainder.
- Divide by 5, discard any remainder; this is the final deal value we will use in the calculation.
Add the Gold Delta, Science Delta, Culture Delta and Trade Deal Value together.
The total is doubled if the player is considered a "strategic trade partner" (IsStrategicTradePartner function).
If the total is greater than 0:
- Add the total to the FRIENDLY approach.
45. Bankrupt
If our current Gold is 0 and our current GPT is less than or equal to 0:
If going to war with this player would actually increase our GPT (because we're paying them GPT):
- Add our WAR bias plus the amount of GPT we would gain to the WAR approach.
- Add our HOSTILE bias plus the amount of GPT we would gain to the HOSTILE approach.
Otherwise:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
46. Bankruptcy Sanity Check
Calculate the GPT we would lose by declaring war on this player (this calculation factors in the teammates, masters, vassals, Defensive Pacts, and allied City-States we would also go to war with).
(NOTE! The GPT lost can be less than 0 - for instance, if we're giving them 50 more GPT than we're receiving in our trade deals. Also, if already at war, the calculation will always return 0.)
If the GPT we would lose is greater than 0, and one of the following conditions are true:
- This player is not close to any victory condition;
- Victory Competition was disabled in CoreChanges.sql;
Then perform the following calculation.
- Begin by calculating our current GPT income and subtracting the GPT we would lose from declaring war.
- Calculate the average of our instant Gold yields for this turn and the previous 9 turns, and add this to our GPT income.
- If the total income is negative, then calculate the amount of turns it would take for us to go bankrupt at this adjusted income rate.
- If we would go bankrupt in 30 or less turns, then the "sanity mod" is equal to the adjusted income (so if it would be -20, then the "sanity mod" is -20).
- The sanity mod is reduced by 1% for each turn it would take to go bankrupt after declaring war - if we're already bankrupt, the reduction is 0%; if it would take 30 turns, the reduction is 30%.
After this calculation:
- Subtract the sanity mod from the WAR approach.
- Subtract the sanity mod from the HOSTILE approach.
47. Current Wars
For each other player (not this player or any of their teammates) that we're at war with, analyze the war state (GetWarState function):
Our war state with this other player is CALM or a STALEMATE
- Add our NEUTRAL bias to the NEUTRAL approach.
Our war state with this other player is DEFENSIVE or we're NEARLY DEFEATED
- Add our FRIENDLY bias to the FRIENDLY approach.
If both of us are fighting together against a common foe, and it isn't because of capitulated vassalage:
- Add our FRIENDLY bias to the FRIENDLY approach.
If the player we're evaluating is a neighbor, we want him on our good side, since we're going to war with others:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
If the player we're at war with is a neighbor, we want this guy on our good side, since we're going to war with neighbors:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
48. Dogpiling
If this player is already at war with other major civilizations, we might want to gang up on the guy we're looking at (our potential victim).
Skip this check if we're currently losing all our wars (or nearly defeated in any war). Also skip this check if we're very unhappy.
For each other player that they're at war with, if it's a player that we've met:
If one of the following is true:
- The potential victim is a major competitor of ours;
- The other warring player's proximity to the victim is CLOSE or NEIGHBORS, and their war projection of their ongoing war against our potential victim is GOOD or better.
And the following is NOT true:
- Our war projection of ANY player at war with the victim (and CLOSE or NEIGHBORS with the victim) is STALEMATE or worse.
i.e. if we can't take someone at war with them, we don't want them to sweep over us after finishing with this guy
Then add a dogpiling bonus:
- Add weight for Victory Dispute: 0 if NONE, 1 if WEAK, 2 if STRONG, 3 if FIERCE
- Add weight for Victory Block: 0 if NONE, 1 if WEAK, 2 if STRONG, 3 if FIERCE
- Add weight for our war projection against the potential victim: 0 if DESTRUCTION, 1 if DEFEAT, 2 if STALEMATE, 3 if UNKNOWN, 4 if GOOD, 5 if VERY GOOD
- Add weight for the other warring player's war projection against the potential victim: 0 if DESTRUCTION, 1 if DEFEAT, 2 if STALEMATE, 3 if UNKNOWN, 4 if GOOD, 5 if VERY GOOD
If the total dogpiling bonus for all players at war with them is greater than 0:
- Add 1/2 the dogpiling bonus (rounded down) to the WAR approach.
- Add 1/2 the dogpiling bonus (rounded down) to the HOSTILE approach.
49. Disabled Victory Conditions
If Science, Culture and Diplomatic Victories are all disabled:
- Add 3x our WAR bias to the WAR approach.
- Add 3x our HOSTILE bias to the HOSTILE approach.
50. They're Close to Victory
If they're close to Domination Victory:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Add 2x our GUARDED bias to the GUARDED approach.
If they have at least one other major civ's original capital:
- Add our WAR bias plus the number of other major civs' original capitals they control to the WAR approach.
- Add our GUARDED bias plus the number of other major civs' original capitals they control to the GUARDED approach.
- Add our HOSTILE bias plus the number of other major civs' original capitals they control to the HOSTILE approach.
If victory competition has not been disabled:
If they're close to winning a Science Victory:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If they're close to winning a Culture Victory:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If they're close to winning a Diplomatic Victory:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If we're BOTH close to any victory condition:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If they're close to any victory condition AND they're an easy target:
- Add 5x our WAR bias to the WAR approach.
51. Grand Strategy Weight - Domination Victory
Skip this step if we're not at least in the Medieval Era (unless we're close to a Domination Victory already).
Skip this step if all of these conditions are FALSE:
- We're aiming for a Domination Victory.
- We're close to a Domination Victory.
- Our Diplo Type is CONQUEROR.
51A. Leader Flavors
Add the average of our Boldness and Offense flavors to the WAR approach.
Add the average of our Meanness and Denounce Willingness flavors to the HOSTILE approach.
51B. Capitals We Control
If we control at least one other major civ's original capital AND still control our own original capital.
- Add our WAR bias plus the number of other major civs' original capitals we control to the WAR approach.
- Add our HOSTILE bias plus the number of other major civs' original capitals we control to the HOSTILE approach.
51C. Capitals They Control
If they control at least one other major civ's original capital:
If we're close to a Domination Victory:
- Add 5x our WAR bias multiplied by the number of other major civs' original capitals they control to the WAR approach.
- Add 5x our HOSTILE bias multiplied by the number of other major civs' original capitals they control to the HOSTILE approach.
If we're not close to a Domination Victory, and they still own their original capital:
- Add 2x the number of other major civs' original capitals they control to the WAR approach.
- Add 2x the number of other major civs' original capitals they control to the GUARDED approach.
- Add 2x our FRIENDLY bias MINUS 2x the number of other major civs' original capitals they control to the FRIENDLY approach.
If they're an easy target:
- Add 5x our WAR bias to the WAR approach.
51D. We're Close To Domination Victory
If we're close to a Domination Victory and the other player still has their original capital:
- Add 5x our WAR bias to the WAR approach.
- Add 5x our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add 5x our WAR bias to the WAR approach.
51E. Normal Strategic Weight
If we're not close to a Domination Victory, and we still own our original capital:
If the other player's military strength compared to us is above average:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our GUARDED bias to the GUARDED approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
- Subtract our DECEPTIVE bias from the DECEPTIVE approach.
If the other player's military strength compared to us is average or weaker:
- Subtract our FRIENDLY bias from the FRIENDLY approach.
- Subtract our NEUTRAL bias from the NEUTRAL approach.
- Subtract our GUARDED bias from the GUARDED approach.
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
If we have a Defensive Pact with this player, and their DP value (from DoRelationshipPairing) is greater than 0:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
- Subtract our GUARDED bias from the GUARDED approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
- Subtract our DECEPTIVE bias from the DECEPTIVE approach.
If the other player's proximity to us is FAR or DISTANT and their economic strength compared to us is above average:
- Add our NEUTRAL bias to the NEUTRAL approach.
If our opinion of them is NEUTRAL or better:
- Add our FRIENDLY bias to the FRIENDLY approach.
Otherwise:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
If we have a Declaration of Friendship with them:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
51F. Open Borders
If we have no territorial disputes with them and they allow us Open Borders:
If our opinion of them is FAVORABLE or better:
- Add our FRIENDLY bias to the FRIENDLY approach.
Otherwise:
- Add our NEUTRAL bias to the NEUTRAL approach.
51G. Vassal
If they're our vassal:
- Add our FRIENDLY bias to the FRIENDLY approach.
51H. Coop Wars
If the # of times they've denied a coop war (see step 8 for how this is calculated) is above 0 (bad):
- Subtract 3x the # of denials from the FRIENDLY approach.
- Add 3x the # of denials to the HOSTILE approach.
- Add 3x the # of denials to the DECEPTIVE approach.
If the # of times they've denied a coop war is below 0 (good):
- Add 3x the # of denials to the FRIENDLY approach.
- Subtract 3x the # of denials from the HOSTILE approach.
- Subtract 3x the # of denials from the DECEPTIVE approach.
52. Grand Strategy Weight - Diplomatic Victory
Skip this step if we're not at least in the Renaissance Era (unless we're close to any victory condition already).
Skip this step if all of these conditions are FALSE:
- We're aiming for a Diplomatic Victory.
- We're close to a Diplomatic Victory.
- Our Diplo Type is DIPLOMAT.
52A. Base Friendship Increase
If the other player is not close to winning the game (or victory competition is disabled):
- Add our FRIENDLY bias plus the average of our DoF Willingness and Diplomacy flavors to the FRIENDLY approach.
If we're also close to a Diplomatic Victory:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
52B. Long-Term Alliances
Get the DoF Level for this player (see step 28).
DOF LEVEL: UNTRUSTWORTHY
- Add our WAR bias to the WAR approach.
- Add our GUARDED bias to the GUARDED approach.
- Add our HOSTILE bias to the HOSTILE approach.
DOF LEVEL: NEW
- Add our NEUTRAL bias to the NEUTRAL approach.
DOF LEVEL: FRIENDS
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
DOF LEVEL: ALLIES
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Subtract 2x our WAR bias from the WAR approach.
- Subtract 2x our HOSTILE bias from the HOSTILE approach.
- Subtract 2x our DECEPTIVE bias from the DECEPTIVE approach.
DOF LEVEL: BATTLE BROTHERS
- Add 3x our FRIENDLY bias to the FRIENDLY approach.
- Subtract 3x our WAR bias from the WAR approach.
- Subtract 3x our HOSTILE bias from the HOSTILE approach.
- Subtract 3x our DECEPTIVE bias from the DECEPTIVE approach.
52C. City-States - Provocations
NOTE: This check is only calculated if the AI has met at least one City-State who is still alive. If there are no living City-States in the game, or they haven't met any, no bonus or penalty will be added for this.
Add the number of times they lowered our influence directly (spies, Great Diplomats, etc) to the number of times they've performed a coup against us.
(NOTE: Performing a coup also awards a penalty for lowering influence, so coups are counted twice here.)
Multiply the total by 3, and add it to the WAR and GUARDED approaches.
52D. City-States - Protection
If they haven't lowered our City-State Influence directly and our dispute level over City-States is NONE or WEAK:
For each City-State that we're protecting OR allied to, that they're protecting:
- Add 2 to the FRIENDLY approach.
- Add 2 to the NEUTRAL approach.
- Subtract 2 from the WAR approach.
- Subtract 2 from the HOSTILE approach.
- Subtract 2 from the DECEPTIVE approach.
52E. World Congress Competition
Skip this step if the World Congress has not yet been founded.
Skip this step if Victory Competition was disabled.
If this player has more World Congress votes than any other player not on our team:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
- Add 2x our DECEPTIVE bias to the DECEPTIVE approach.
If they're also an easy target:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If we're also close to winning a Diplomatic Victory:
- Add 5x our WAR bias to the WAR approach.
- Add 5x our HOSTILE bias to the HOSTILE approach.
If this player has more votes than we do:
- Add 2x our DECEPTIVE bias to the DECEPTIVE approach.
- Add 2x our GUARDED bias to the GUARDED approach.
If they're also an easy target:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If we're also close to winning a Diplomatic Victory:
- Add 5x our WAR bias to the WAR approach.
- Add 5x our HOSTILE bias to the HOSTILE approach.
If this player does not have more votes than we do:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Subtract 2x our WAR bias from the WAR approach.
- Subtract 2x our HOSTILE bias from the HOSTILE approach.
53. Grand Strategy Weight - Cultural Victory
Skip this step if we're not at least in the Renaissance Era (unless we're close to any victory condition already).
Skip this step if all of these conditions are FALSE:
- We're aiming for a Cultural Victory.
- We're close to a Cultural Victory.
- Our Diplo Type is CULTURAL.
53A. They Have Influence Over Us
If their Influence level over us is at least POPULAR, and one of these two conditions is true:
- Their Influence over us is at least INFLUENTIAL, OR
- Their Influence trend is RISING;
Then, if victory competition is enabled:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our GUARDED bias to the GUARDED approach.
If they're also an easy target:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
53B. Tourism Bonuses
Skip this step if any weight was added in step 53A.
If we're allowing them Open Borders:
- Add our FRIENDLY bias to the FRIENDLY approach.
If we're also already influential on half of the civs we need in order to win a Cultural Victory:
- Add our FRIENDLY bias to the FRIENDLY approach.
If they're our vassal:
- Add our FRIENDLY bias to the FRIENDLY approach.
53C. They're the civ we have the lowest Influence on
Skip this if we're already Influential.
If they're an easy target, and victory competition is enabled:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If we're also close to winning a Cultural Victory:
- Add 5x our WAR bias to the WAR approach.
- Add 5x our HOSTILE bias to the HOSTILE approach.
If they're not an easy target:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add 2x our DECEPTIVE bias to the DECEPTIVE approach.
If we're also close to winning a Cultural Victory:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
53D. Influence Level and Trend
Skip this step if any weight was added in step 53C.
If we're close to winning a Cultural Victory:
- Add our FRIENDLY bias to the FRIENDLY approach.
Check our influence level over them:
UNKNOWN
- Add 2x our DECEPTIVE bias to the DECEPTIVE approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
EXOTIC
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our FRIENDLY bias to the DECEPTIVE approach.
FAMILIAR
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
POPULAR
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
INFLUENTIAL
If our Influence Trend is NOT Rising:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
If our Influence Trend is Rising and our Opinion of them is FAVORABLE or better:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
If our Influence Trend is Rising and our Opinion of them is COMPETITOR or worse:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
DOMINANT
If our Opinion of them is FAVORABLE or better:
- Add our FRIENDLY bias to the FRIENDLY approach.
If our Opinion of them is COMPETITOR or worse:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add 3x our WAR bias to the WAR approach.
- Add 3x our HOSTILE bias to the HOSTILE approach.
54. Grand Strategy Weight - Spaceship Victory
Skip this step if we're not at least in the Renaissance Era (unless we're close to any victory condition already).
Skip this step if all of these conditions are FALSE:
- We're aiming for a Spaceship Victory.
- We're close to a Spaceship Victory.
- Our Diplo Type is SCIENTIFIC.
54A. Spaceship Competition
If the other player's team has built at least 1 spaceship part OR they're close to a Science Victory and we aren't:
If victory competion is enabled:
- Add 5x our WAR bias to the WAR approach.
- Add 5x our HOSTILE bias to the HOSTILE approach.
If they're NOT a spaceship competitor and we're close to Science Victory:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add 2x our NEUTRAL bias to the NEUTRAL approach.
54B. Normal Strategic Weight
Skip this step if any weight was added in step 54A.
They have a tech lead of 4 or more techs:
- Add our WAR bias to the WAR approach.
- Add our GUARDED bias to the GUARDED approach.
- Add our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
They have a tech lead of 2 to 3 techs:
- Add 2x our DECEPTIVE bias to the DECEPTIVE approach.
- Add 2x our GUARDED bias to the GUARDED approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
We're equal in tech count, or within 1 tech of each other:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
If their military strength compared to us is at least AVERAGE:
- Add our FRIENDLY bias to the FRIENDLY approach.
We have a tech lead of 2 to 3 techs:
- Subtract our DECEPTIVE bias from the DECEPTIVE approach.
- Subtract our GUARDED bias from the GUARDED approach.
If their military strength compared to us is at least AVERAGE:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
We have a tech lead of 4 or more techs:
- Subtract 2x our DECEPTIVE bias from the DECEPTIVE approach.
- Subtract 2x our GUARDED bias from the GUARDED approach.
If their military strength compared to us is at least AVERAGE:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Subtract 2x our WAR bias from the WAR approach.
- Subtract 2x our HOSTILE bias from the HOSTILE approach.
54C. Defensive Pact/Research Agreement
Skip this step if any weight was added in step 54A.
If they don't have a tech lead of 4 or more techs, we have a Defensive Pact, and their DP value is above 0:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add 2x our NEUTRAL bias to the NEUTRAL approach.
If they don't have a tech lead of 4 or more techs, we have a Research Agreement, and we haven't already researched every tech:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add 2x our NEUTRAL bias to the NEUTRAL approach.
[PART 7: ADDITIONAL FACTORS]
55. Nukes
If the other player is a human (or Gandhi :) ), assume their chance of nuking us is 100%.
If the other player is an AI:
- If nukes have been used already by either of us against the other, assume their chance of nuking us is 100%.
- Otherwise, get the other leader's Use Nuke flavor, add 1 to it and multiply it by itself. The result is their % chance of nuking us.
We have nukes and they don't
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
They have nukes and we don't, and their probability of nuking us is greater than 50%
- Add 2x our AFRAID bias to the AFRAID approach.
We both have nukes, and their probability of nuking us is greater than 25%
- Add 2x our GUARDED bias to the GUARDED approach.
If they've previously nuked us:
- Add 3x our WAR bias to the WAR approach.
- Add 3x our HOSTILE bias to the HOSTILE approach.
- Add 3x our GUARDED bias to the GUARDED approach.
56. Unique Units
If our civilization has at least one Unique Unit (UU):
If we've unlocked a UU technology and have at least one UU currently active:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If we're also going for (or close to) a Domination Victory:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
If we've unlocked a UU technology but we don't have at least one UU currently active:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our WAR bias to the WAR approach.
If we don't have a UU technology, but will have one soon:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
57. We're Cramped (a lot of nearby land is owned by others)
If the other player is one of our NEIGHBORS:
- Add our WAR bias to the WAR approach.
- Add our GUARDED bias to the GUARDED approach.
58. We're very unhappy AND we have more than 0 war weariness:
- Add our FRIENDLY bias plus 1/5th of our current war weariness to the FRIENDLY approach.
- Add our NEUTRAL bias plus 1/5th of our current war weariness to the NEUTRAL approach.
59. Reckless Expander
If we believe this player is a reckless expander (IsPlayerRecklessExpander function):
Opinion Indicator: "They believe we are expanding our empire too aggressively!"
- Add our WAR bias to the WAR approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our HOSTILE bias to the HOSTILE approach.
If our diplo type is CONQUEROR:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
60. Wonder Spammer
If we believe this player is a wonder spammer (IsPlayerWonderSpammer function):
Opinion Indicator: "They believe we are building World Wonders too aggressively!"
- Add our WAR bias to the WAR approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our HOSTILE bias to the HOSTILE approach.
If our diplo type is CULTURAL or CONQUEROR:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
61. Duel
If there's only two major civilizations alive:
If we're going for or close to a Domination Victory:
- Add 1000 to the WAR approach.
If victory competition is enabled:
- Add our WAR bias to the WAR approach.
If they are also close to any victory condition and an easy target:
- Add 1000 to the WAR approach.
62. Coop War Against This Player
If we promised another player to go to war against this player (third-party war bribery counts):
- Add our WAR bias to the WAR approach.
63. War Bonus
(This entire section is ignored for vassal players.)
War bonus starts at 0.
If our diplo type is CONQUEROR or our leader traits give us bonuses towards war:
- Add 3 to the war bonus, and also see below:
If they're an easy target:
- Add our WAR bias to the WAR approach.
If our civilization has at least one Unique Unit (UU), we have the technology for a UU unlocked, AND at least one active:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If we have a UU, a UU tech, at least one UU active, and we're going for (or are close to) a Domination Victory:
- Add our WAR bias to the WAR approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
If we unlocked Authority:
- Add 1 to the war bonus.
If we completed Authority:
- Add 1 to the war bonus.
If we unlocked Imperialism:
- Add 1 to the war bonus.
If we completed Imperialism:
- Add 2 to the war bonus.
If our Ideology is Autocracy:
- Add 3 to the war bonus.
If we have a temporary attack bonus (e.g. from Global Wargames)
- Add 2 to the war bonus.
If the war bonus is greater than 0:
- Add our WAR bias plus the war bonus to the WAR approach.
- Add our HOSTILE bias plus the war bonus to the HOSTILE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
64. Difficulty Bonus
(This entire section is ignored for vassal players.)
If our Opinion of this player is COMPETITOR or worse, a bonus is also added for difficulty:
Difficulty bonus starts at 0.
- Add AIDifficultyBonusBase (see AI and Difficulty) to the difficulty bonus. This ranges from 0 (Settler) to 9 (Deity).
- If less than 0, difficulty bonus is set to 0; if greater than 10, difficulty bonus is set to 10.
- Subtract 4 if this is a COMPETITOR, 2 if this is an ENEMY, and 0 if they're UNFORGIVABLE.
If the difficulty bonus is greater than 0:
- Add our WAR bias plus the difficulty bonus to the WAR approach.
- Add our HOSTILE bias plus the difficulty bonus to the HOSTILE approach.
- Add our DECEPTIVE bias plus the difficulty bonus to the DECEPTIVE approach.
If they're also an easy target:
- Add our WAR bias to the WAR approach.
65. Leader Personality
(This entire section is ignored for vassal players.)
Currently only Ashurbanipal, Montezuma and Gandhi have extra weight added for this.
NOTE: The check evaluates whether the AI has the relevant traits, not the leader name.
If we are Assyria, and we haven't researched every tech already:
If they have more techs than we do:
- Add our WAR bias plus their tech lead to the WAR approach.
If we have more techs than they do:
- Add our FRIENDLY bias plus our teach lead to the FRIENDLY approach.
If we have the same number of techs:
- Add our NEUTRAL bias to the NEUTRAL approach.
If we are Montezuma:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If the era is Medieval or earlier:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If we are Gandhi:
- Add our FRIENDLY bias to the FRIENDLY approach.
If the other player has zero warmonger penalty with us:
- Add our FRIENDLY bias to the FRIENDLY approach.
If we currently have at least one nuke or have previously nuked them, and Nuclear Gandhi is enabled (DiploAIOptions.sql, active by default), then:
- Add 100 to the WAR approach.
- Add 100 to the HOSTILE approach.
- Set our FRIENDLY approach score to -1000.
- Set our NEUTRAL approach score to -1000.
- Set our AFRAID approach score to -1000.
- Set our DECEPTIVE approach score to -1000.
66. World Congress Resolutions
(This entire section is ignored for vassal players, or if the World Congress is disabled/hasn't been founded yet.)
If the United Nations has been constructed, and we're going for (or close to) a Diplomatic Victory:
- Add our FRIENDLY bias to the FRIENDLY approach.
- Subtract our WAR bias from the WAR approach.
- Subtract our HOSTILE bias from the HOSTILE approach.
If one of us is sanctioned by the World Congress:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If the Casus Belli resolution is active:
- Subtract 2x our FRIENDLY bias from the FRIENDLY approach.
- Subtract 2x our NEUTRAL bias from the NEUTRAL approach.
- Add 2x our WAR bias to the WAR approach.
- Add 2x our HOSTILE bias to the HOSTILE approach.
If the Global Peace Accords resolution is active:
- Add 2x our FRIENDLY bias to the FRIENDLY approach.
- Add 2x our NEUTRAL bias to the NEUTRAL approach.
- Subtract 2x our WAR bias from the WAR approach.
- Subtract 2x our HOSTILE bias from the HOSTILE approach.
If the Cold War resolution is active, and we can't make trade routes to at least one major civilization that we've met:
If this player has the same ideology (having no ideology doesn't count):
- Add our FRIENDLY bias plus IdeologyEmphasis to the FRIENDLY approach.
- Add our NEUTRAL bias plus IdeologyEmphasis to the NEUTRAL approach.
- Subtract our WAR bias plus IdeologyEmphasis from the WAR approach.
- Subtract our HOSTILE bias plus IdeologyEmphasis from the HOSTILE approach.
- Subtract our GUARDED bias plus IdeologyEmphasis from the GUARDED approach.
If this player has an opposing ideology (having no ideology doesn't count):
- Subtract our FRIENDLY bias plus IdeologyEmphasis from the FRIENDLY approach.
- Subtract our NEUTRAL bias plus IdeologyEmphasis from the NEUTRAL approach.
- Add our WAR bias plus IdeologyEmphasis to the WAR approach.
- Add our HOSTILE bias plus IdeologyEmphasis to the HOSTILE approach.
- Add our GUARDED bias plus IdeologyEmphasis to the GUARDED approach.
[PART 8: PRIORITIZATION]
67. Prioritization
Prioritize our approaches to avoid adopting the same approach towards too many players. This allows for more variance and strategy.
(Skip this step if there is only one player to update approaches for this turn, not counting "special case" players.)
GetBestApproachTowardsMajorCiv is called twice for each player.
On the first pass through this function, step 67 is skipped, and the final totals for each civ's approach scores are recorded at the end of this function.
If this is the second pass through this function, then for EACH of the seven approaches:
- Collect all civilizations' first pass approach scores for this approach.
- Rank them in order from highest approach score to lowest approach score.
- If this civilization has the highest approach score for the approach, do not subtract any weight.
- If this civilization is ranked second, subtract -1x the approach bias for that approach from the current score.
- If this civilization is ranked third, subtract -2x the approach bias, and so on.
- Ties are broken by player order (player 1 is first priority, player 2 is second priority, etc.)
68. Negative Approach Weights
At this point in the function, if any approach weight is negative, set it to 0 instead.
[PART 9: MULTIPLIERS]
69. Too Many Vassals Multiplier
If this player is not our master, and they have vassals:
- Increase the WAR approach score by 10% for each vassal they have.
- Increase the GUARDED approach score by 10% for each vassal they have.
70. Proximity Multiplier
The farther away a player is, the less likely we are to care about them!
If this player is personally able to declare war on us right now, then they CAN ATTACK US.
(They might not be able to; e.g. if a peace treaty prevents it; if the Permanent War or Peace game option is enabled.)
Check if we have a valid military attack target for this player (i.e. we can pathfind to them for an attack).
If we do have a valid attack target, then check if we WANT CONQUEST against this player.
We want conquest if any of the following conditions are true:
- We're going for Domination Victory.
- We're close to a Domination Victory.
- We promised another player to go to war against them (coop/3rd party war).
- They're a backstabber.
- Our Opinion of them is ENEMY or UNFORGIVABLE and they're our biggest competitor.
- Our Opinion of them is ENEMY or UNFORGIVABLE and they're an easy target.
- Our Opinion of them is UNFORGIVABLE and our War Projection of a war against them is GOOD or VERY GOOD.
- They're a reckless expander.
- They're a wonder spammer.
- They are close to any victory condition and victory competition is enabled.
Now, on to the proximity multiplier!
If proximity is...
NEIGHBORS
- If we want conquest, increase WAR and HOSTILE approach scores by 100%. Otherwise, if we have a valid attack target, increase them by 50%.
- If they can attack us, increase AFRAID approach score by 50%.
- Increase FRIENDLY approach score by 50%.
- Increase DECEPTIVE approach score by 50%.
- Increase GUARDED approach score by 50%.
CLOSE
- If we want conquest, increase WAR and HOSTILE approach scores by 50%. Otherwise, if we have a valid attack target, increase them by 25%.
- If they can attack us, increase AFRAID approach score by 25%.
- Increase FRIENDLY approach score by 25%.
- Increase DECEPTIVE approach score by 25%.
- Increase GUARDED approach score by 25%.
FAR
- If we want conquest and we're able to cross ocean tiles, increase WAR and HOSTILE approach scores by 25%.
- No other changes.
DISTANT
- If we don't want conquest OR we're not able to cross ocean tiles, decrease WAR and HOSTILE approach scores by 25%.
- Decrease FRIENDLY approach score by 25%.
- Decrease AFRAID approach score by 25%.
- Decrease GUARDED approach score by 25%.
- Decrease DECEPTIVE approach score by 25%.
71. Domination Victory Disabled
If Domination Victory is disabled:
- Divide the WAR approach score by 2.
- Divide the HOSTILE approach score by 2.
72. Opinion
Opinion is applied as a +/- % modifier to Approach scores after all other modifiers have been considered.
However, each leader also has several personality values which affect how much a positive or negative opinion will change their approach. These personality values are once again based on AI flavors, which are randomized slightly from game to game to be less predictable.
The higher a modifier for an approach is, the more having a positive opinion (above Favorable) or negative opinion (below Competitor) will affect that approach.
This applies both ways (a leader with a high War modifier will add more weight to the War approach if their opinion is negative, but will also remove more weight from the War approach if their opinion is positive). In contrast, a leader with a low War modifier will add or remove less weight based on opinion.
The modifiers are as follows:
WarMod = WAR bias * Boldness
HostileMod = HOSTILE bias * Denounce Willingness
DeceptiveMod = DECEPTIVE bias * Meanness
GuardedMod = GUARDED bias * (10 - Forgiveness)
AfraidMod = AFRAID bias * (10 - Boldness)
FriendlyMod = FRIENDLY bias * Loyalty
NeutralMod = NEUTRAL bias * Diplo Balance * 2
Note that in the code, good modifiers subtract opinion (negative is good) and bad modifiers add opinion (positive is bad).
IF OPINION IS GREATER THAN 30 (Competitor)
Increase hostility and fear:
- Multiply WAR approach score by (100 + WarMod + Opinion).
- Divide WAR approach score by 100.
- Multiply HOSTILE approach score by (100 + HostileMod + Opinion).
- Divide HOSTILE approach score by 100.
- Multiply DECEPTIVE approach score by (100 + DeceptiveMod + Opinion).
- Divide DECEPTIVE approach score by 100.
- Multiply GUARDED approach score by (100 + GuardedMod + Opinion).
- Divide GUARDED approach score by 100.
- Multiply AFRAID approach score by (100 + AfraidMod + Opinion).
- Divide AFRAID approach score by 100.
Decrease friendliness and neutrality:
- Multiply FRIENDLY approach score by 100.
- Divide FRIENDLY approach score by (100 + FriendlyMod + Opinion).
- Multiply NEUTRAL approach score by 100.
- Divide NEUTRAL approach score by (100 + NeutralMod + Opinion).
IF OPINION IS LOWER THAN -30 (Favorable)
- Multiply Opinion by -1.
Increase friendliness:
- Multiply FRIENDLY approach score by (100 + FriendlyMod + Opinion).
- Divide FRIENDLY approach score bv 100.
Decrease hostility, fear and neutrality:
- Multiply WAR approach score by 100.
- Divide WAR approach score by (100 + WarMod + Opinion).
- Multiply HOSTILE approach score by 100.
- Divide HOSTILE approach score by (100 + HostileMod + Opinion).
- Multiply DECEPTIVE approach score by 100.
- Divide DECEPTIVE approach score by (100 + DeceptiveMod + Opinion).
- Multiply GUARDED approach score by 100.
- Divide GUARDED approach score by (100 + GuardedMod + Opinion).
- Multiply AFRAID approach score by 100.
- Divide AFRAID approach score by (100 + AfraidMod + Opinion).
- Multiply NEUTRAL approach score by 100.
- Divide NEUTRAL approach score by (100 + NeutralMod + Opinion).
IF OPINION IS IN THE -30 TO 30 RANGE (Neutral)
Increase neutrality:
- Multiply NEUTRAL approach score by (100 + NeutralMod).
- Divide NEUTRAL approach score by 100.
73. Modder Bonus/Penalty
If base approach weight (flat or percentage) was added or subtracted in DiploApproachWeights.sql, add or subtract it now.
Flat weight is factored in before percentage weight.
[PART 10: ZERO-OUT CONDITIONS]
"Scratch value" = the approach score towards this player last turn. Used in the approach curve (part 11).
"Scratch value override" = an override for last turn's approach score. The overrides, instead of using last turn's value for the approach curve, use the specified value.
The scratch value overrides are meant to ensure that, for instance, an AI that has no valid attack target (step 75) doesn't declare war anyway because of the approach curve's slower decay.
Scratch value overrides are set to -1 by default. If set to a value of 0 or higher below, they will be used in the approach curve calculation.
74. No Valid Attack Target
If we don't have a valid attack target for this player:
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
- Set the scratch value override for the WAR approach to 0.
- Set the scratch value override for the HOSTILE approach to 0.
75. Can't Attack Us
If this player can't declare war on us:
- Set our AFRAID approach score to 0.
- Set the scratch value override for the AFRAID approach to 0.
76. Recent Peace Treaty
If we signed a Peace Treaty recently, war and hostility weight is removed for a time.
On Settler difficulty, WAR, HOSTILE and DECEPTIVE weights are set to 0 for 20 turns after a peace treaty is signed.
On difficulties above Settler, the AIDifficultyBonusBase (see AI and Difficulty) is subtracted from 20 to determine how many turns the AI has no WAR/HOSTILE/DECEPTIVE weight for.
The minimum is 11 turns.
While the weights are set to 0, the WAR, HOSTILE and DECEPTIVE scratch value overrides are also set to 0.
77. Resurrection Chill-ifier
If this player resurrected us:
- Set our HOSTILE approach score to 0.
- Set our scratch value override for the HOSTILE approach to 0.
78. Coop War Soon
If we promised this player to start a coop war against another civilization "soon" and we haven't started the war yet:
If they're not close to any victory condition OR victory competition has been disabled:
- Set our WAR approach score to 0.
- Set our scratch value override for the WAR approach to 0.
79. Recent Liberation
If this player has recently liberated a city from us (within the past 20 turns), and all of the following conditions are true:
- This player is not close to any victory condition OR victory competition has been disabled.
- This player does not currently own our original capital or Holy City.
- This player is not a backstabber.
Then:
- Set our WAR approach score to 0.
- Set our scratch value override for the WAR approach to 0.
80. Vassal of Someone Else
If they're a vassal of someone else...
If we're not at war with them:
- Set our WAR approach score to 0.
- Set our scratch value override for the WAR approach to 0.
If we are at war with them, we just started the war, and our approach score towards them last turn was 0:
- Set our scratch value override to the current WAR approach score for this turn.
81. Vassal of Our Team
If they're our vassal...
If they're a major competitor of ours (this bar is set very high for vassals) or they control other major civs' original capitals, skip this next step.
If we're going for or close to a Domination Victory and they still have their original capital, skip this next step.
Otherwise:
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
- Set our scratch value override for the WAR approach to 0.
- Set our scratch value override for the HOSTILE approach to 0.
82. We're Someone's Vassal
If we're someone's vassal...
If we're not at war with this player:
- Set our WAR approach score to 0.
- Set our scratch value override for the WAR approach to 0.
If we are at war with this player, we just started the war, and our approach score towards them last turn was 0:
- Set our scratch value override to the current WAR approach score for this turn.
If this player isn't our master or a backstabber, then:
- Set our HOSTILE approach score to 0.
- Set our scratch value override for the HOSTILE approach to 0.
83. Backstabbing is Bad
If we have a DoF with this player or we'd otherwise backstab a friend by going to war with them:
- Backstab a friend;
- Backstab a player we have a Defensive Pact with;
- Backstab a player we have an Opinion of ALLY towards;
- Break a military promise (not to declare war).
Then set our WAR approach score to 0 and our scratch value override for the WAR approach to 0.
84. War Disallowed By Game Options
If war against this player has been disabled in DiploAIOptions.sql:
- Set our WAR approach score to 0.
- Set our scratch value override for the WAR approach to 0.
[PART 11: THE APPROACH CURVE]
85. Make Approach Change Gradually
Approach scores change gradually from turn to turn to avoid rapid jumping between values, which would be erratic and exploitable.
For each of the approaches:
A. Retrieve the approach weight we had for this approach last turn, and store it for logging.
B. Check if there's a scratch value override for this approach with a value of 0 or higher. If so, set last turn's value to the scratch value override's value.
C. Calculate the "average" value of this turn's score and the last turn's score using this formula: (0.5 + (Approach Score * 0.10) + (Approach Score Last Turn * (1 - 0.10)))
D. Round down to remove any remainder.
E. If the average is the same as the value last turn, but the value this turn increased/decreased, then add/subtract 1 from the average so it changes by at least 1.
F. Set the approach value for this approach to the average value.
! EXCEPTION TO STEP 85: Players who have just been resurrected have outdated diplo approach values.
Therefore, the first time they update their approaches, they ignore steps 85C-E and instead use the current turn's value as last turn's value.
[PART 12: APPROACH SELECTION]
86. Select the Approach with the Highest Weight
Example: The GUARDED approach has 112 weight. The next highest approach, FRIENDLY, has 98 weight. Thus, GUARDED will be chosen.
If all approaches have 0 weight, NEUTRAL is chosen by default.
If several approaches are tied with > 0 weight, the order of priority is WAR, HOSTILE, DECEPTIVE, GUARDED, AFRAID, FRIENDLY, NEUTRAL.
87. "No Friendly" Override
If we've denounced them, they've denounced us, or they're a backstabber...
And our selected approach is FRIENDLY or DECEPTIVE, then:
- If our Opinion of them is ENEMY or UNFORGIVABLE, set our selected approach to GUARDED.
- Otherwise, set our selected approach to NEUTRAL.
88. Recent Liberation Override
If our selected approach is HOSTILE...
If this player has recently liberated a city from us (within the past 20 turns), and all of the following conditions are true:
- This player is not close to any victory condition OR victory competition has been disabled.
- This player does not currently own our original capital or Holy City.
- This player is not a backstabber.
Then set our selected approach to GUARDED.
89. War Face
If the selected approach is WAR, the AI is planning a war.
The AI will then pick a "War Face", which determines how it will act towards you until war is declared or WAR isn't the highest approach anymore.
If the selected approach is NOT the WAR approach, then it resets the War Face type (so that a new one can be decided on next time).
If the AI had a War Face last turn, it will use that one. Otherwise, it will figure out the next-highest approach score (after WAR), and based on the result, pick a war face.
If several next-highest approaches are tied, the order of priority is WAR, HOSTILE, DECEPTIVE, GUARDED, AFRAID, FRIENDLY, NEUTRAL.
If the next-highest approach score is:
HOSTILE
- AI will act HOSTILE to you until it's ready for war.
GUARDED
- AI will act GUARDED to you until it's ready for war.
DECEPTIVE
- AI will act NEUTRAL to you until it's ready for war.
AFRAID
- AI will act HOSTILE to you until it's ready for war.
FRIENDLY
- AI will act FRIENDLY to you until it's ready for war.
OTHERWISE
- AI will act NEUTRAL to you until it's ready for war.
90. War Face Overrides
If the "No Friendly" override is in place (step 87) and the selected War Face (whether or not it was changed this turn) is FRIENDLY:
- If our Opinion of them is ENEMY or UNFORGIVABLE, set our selected approach to GUARDED.
- Otherwise, set our selected War Face to NEUTRAL.
If they previously resurrected us and the currently-selected War Face is HOSTILE:
- Set our selected War Face to GUARDED.
91. Record Approach Weights
The approach weights for all seven approaches are recorded.
If this is the first pass of GetBestApproachTowardsMajorCiv for all civs, these recorded weights will be used in step 67 on the second pass.
92. Log and Update
If this is the second pass of GetBestApproachTowardsMajorCiv, then the approach has been updated, so:
- Update our approach towards this player.
- Update our War Face towards this player.
- If logging is enabled, the new approach, the approach weight, and the approach weight deltas.
93. Visible Approach
If at war, the message "WAR!" is shown in place of the approach.
If we just denounced this player, the message "DENOUNCING!" is shown in place of the approach.
If this player resurrected us this turn, the message "RECALLED TO LIFE" is shown in place of the approach.
If the true approach is DECEPTIVE, then the visible approach will be FRIENDLY.
If the true approach is WAR, then the visible approach will be the AI's War Face (step 89): HOSTILE, GUARDED, NEUTRAL or FRIENDLY.
Otherwise, the visible approach is the AI's true approach.
If the AI's visible Approach is something other than NEUTRAL, then a message explaining it can be seen in their Opinion modifiers.
---------
Special Case Approach Updates
Under specific circumstances when updating approaches towards major civs, the AI will (rather than go through the full two passes of GetBestApproachTowardsMajorCiv) use a simpler method of updating approaches to improve on performance and effectiveness.
These special case approach updates (if any) occur before the normal approach updates for the turn and are described in pseudocode below:
Code:
There are five SPECIAL CASES for approach updates:
TEAMMATES
- Have a FRIENDLY score of 9999 and a score of 0 for all other approaches.
- AI always adopts the FRIENDLY approach and NO_WAR_FACE_TYPE war face towards teammates.
PERMANENT WAR
- The "Always War" and "Permanent War or Peace" game options allow for permanent war. You can activate them with Really Advanced Setup.
- When at permanent war, AI has a WAR approach score of 9999 and a score of 0 for all other approaches.
- AI always adopts the WAR approach and NEUTRAL war face when at permanent war.
HUMAN SHADOW AI
- The human player has a shadow diplo AI. While it does not interact with other players, it still selects and updates approaches.
- Since doing a lengthy calculation would be wasteful, it uses the following simpler method.
[At War]
Approach = WAR
War Face = NEUTRAL
[Not At War]
Check if we agreed to a coop war "soon" against this player with any other player. If so, set Approach to WAR and bCoopWarAgainst to true.
If human denounced this player OR player currently owns human's original capital OR player currently owns human's Holy City:
- bCoopWarAgainst false: Set Approach to HOSTILE.
- bCoopWarAgainst true: Set War Face to HOSTILE.
If human was denounced by this player:
- bCoopWarAgainst false: Set Approach to GUARDED.
- bCoopWarAgainst true: Set War Face to GUARDED.
If human made a DoF with this player OR has a Defensive Pact with this player OR made a coop war promise "soon" to this player:
- bCoopWarAgainst false: Set Approach to FRIENDLY.
- bCoopWarAgainst true: Set War Face to FRIENDLY.
If none of these are true:
- bCoopWarAgainst false: Set Approach to NEUTRAL.
- bCoopWarAgainst true: Set War Face to NEUTRAL.
Set the selected approach's score to 5 and all other approach scores to 0.
AI HAS NO CAPITAL
- If the AI has no capital city (possible at game start or with the Complete Kills game option), then it selects and updates approaches towards all other players quickly.
[At War]
Approach = WAR
War Face = NEUTRAL
[Not At War]
Check if we agreed to a coop war "soon" against this player with any other player. If so, set Approach to WAR and bCoopWarAgainst to true.
If AI denounced this player OR player currently owns AI's original capital OR player currently owns AI's Holy City OR AI considers player a backstabber:
- bCoopWarAgainst false: Set Approach to HOSTILE.
- bCoopWarAgainst true: Set War Face to HOSTILE.
If AI was denounced by this player:
- bCoopWarAgainst false: Set Approach to GUARDED.
- bCoopWarAgainst true: Set War Face to GUARDED.
If AI made a DoF with this player OR has a Defensive Pact with this player OR made a coop war promise "soon" to this player OR was previously resurrected by this player:
- bCoopWarAgainst false: Set Approach to FRIENDLY.
- bCoopWarAgainst true: Set War Face to FRIENDLY.
If player has previously captured some of the AI's cities:
- bCoopWarAgainst false: Set Approach to GUARDED.
- bCoopWarAgainst true: Set War Face to GUARDED.
If none of these are true:
- bCoopWarAgainst false: Set Approach to NEUTRAL.
- bCoopWarAgainst true: Set War Face to NEUTRAL.
Set the selected approach's score to that approach's bias value and all other approach scores to 0.
TARGET PLAYER HAS NO CAPITAL
- Towards players that have no cities, a lengthy approach update is a waste of time, and may return erroneous results (e.g. due to their lack of military/economic strength).
- Players with no cities are disregarded for most diplomacy AI purposes, but approaches towards them will still be selected using this simple method.
[At War]
Approach = WAR
War Face = NEUTRAL
[Not At War]
Check if we agreed to a coop war "soon" against this player with any other player. If so, set Approach to WAR and bCoopWarAgainst to true.
If AI denounced this player OR AI considers player a backstabber:
- bCoopWarAgainst false: Set Approach to HOSTILE.
- bCoopWarAgainst true: Set War Face to HOSTILE.
If AI was denounced by this player:
- bCoopWarAgainst false: Set Approach to GUARDED.
- bCoopWarAgainst true: Set War Face to GUARDED.
If AI made a DoF with this player OR has a Defensive Pact with this player OR made a coop war promise "soon" to this player OR was previously resurrected by this player:
- bCoopWarAgainst false: Set Approach to FRIENDLY.
- bCoopWarAgainst true: Set War Face to FRIENDLY.
If none of these are true:
- bCoopWarAgainst false: Set Approach to NEUTRAL.
- bCoopWarAgainst true: Set War Face to NEUTRAL.
Set the selected approach's score to that approach's bias value and all other approach scores to 0.
Last edited: