NOTICE
The information in this thread is outdated!
For current information on AI diplomacy in Vox Populi, please see the wiki article:
https://civ-5-cbp.fandom.com/wiki/Detailed_Guide_to_Diplomacy
If you have questions or comments on AI diplomacy in Vox Populi, please see this thread:
https://forums.civfanatics.com/threads/vox-populi-diplomacy-feedback.652134/
Thanks!
Recursive
Hello everyone,
I made a post like this last year and I remember it having a positive reception. That calculation is now obsolete with new updates to the diplomacy AI, so I figured I'd redo the "game code to plain text" translation for anyone who's interested, and go into more detail this time.
From my examination of the code, the function has been significantly simplified since last time.
This calculation aims to explain the 'Approach' and 'Opinion' mechanics which decide some aspects of how the AI treats you and other AIs. This might not be 100% accurate, but I've stared at the code for hours to make sure it's as accurate as I can make it, and I welcome any corrections.
Without further ado...
Approach = the AI's 'stance' towards you or another player, which is updated every turn. There are seven approaches: FRIENDLY, NEUTRAL, AFRAID, DECEPTIVE, GUARDED, HOSTILE and WAR. Each turn, AIs perform a number of calculations which add weight to each of the seven approach scores, and at the end of the calculations, the approach with the highest score is picked. Note that changes to approach happen gradually to prevent rapid jumping between values. Also note that the AI's true approach might be hidden under certain circumstances.*
Opinion = a number value which is a factor in influencing the AI's approach. This value is based on the positive and negative modifiers which can be seen when mousing over the leader's displayed approach (some of these modifiers can be hidden if the AI is FRIENDLY or pretending to be). The 'Transparent Diplomacy' option shows all modifiers regardless of approach as well as how much they change Opinion numerically.
---
*If an AI is currently at war with you, has just denounced you or been recalled to life, you will not be able to see their true approach.
Additionally, the DECEPTIVE approach shows up as FRIENDLY, and if an AI's approach is WAR - planning a war, that is, but not currently at war - they will display a "War Face" and pretend to be HOSTILE, GUARDED, NEUTRAL or FRIENDLY towards you while they make their war preparations.
AIs who are AFRAID are always being 100% honest with you, as are AIs that are currently at war with you; but otherwise, you can never be quite sure.
Ending a Declaration of Friendship with an AI (including by denouncing them) will set their approach to GUARDED for the remainder of the current turn (unless its approach is WAR, in which case it employs the GUARDED "War Face").
---
Approach
Important Note
Each leader, as part of their flavors, has a number value indicating their bias for each of the seven approaches.
The list of leaders and their respective biases is found here (note that these are only the base values, and they are randomized a bit between games):
In most of the calculations below, the randomized approach bias is added to its respective approach when a condition makes it more or less favorable to have that approach.
The higher a bias for an approach compared to other biases, the more likely the leader is to use that approach.
e.g. Warmongers have a higher war bias, will add more value than other leaders every time a condition makes going to war more favorable, and thus will favor going to war more often than other leaders.
The current calculation to determine approach (as of the 10-8-1 beta version hotfix) is below:
Last Updated: October 19 (no recent changes)
The information in this thread is outdated!
For current information on AI diplomacy in Vox Populi, please see the wiki article:
https://civ-5-cbp.fandom.com/wiki/Detailed_Guide_to_Diplomacy
If you have questions or comments on AI diplomacy in Vox Populi, please see this thread:
https://forums.civfanatics.com/threads/vox-populi-diplomacy-feedback.652134/
Thanks!
Recursive
I made a post like this last year and I remember it having a positive reception. That calculation is now obsolete with new updates to the diplomacy AI, so I figured I'd redo the "game code to plain text" translation for anyone who's interested, and go into more detail this time.
From my examination of the code, the function has been significantly simplified since last time.
This calculation aims to explain the 'Approach' and 'Opinion' mechanics which decide some aspects of how the AI treats you and other AIs. This might not be 100% accurate, but I've stared at the code for hours to make sure it's as accurate as I can make it, and I welcome any corrections.
Without further ado...
Approach = the AI's 'stance' towards you or another player, which is updated every turn. There are seven approaches: FRIENDLY, NEUTRAL, AFRAID, DECEPTIVE, GUARDED, HOSTILE and WAR. Each turn, AIs perform a number of calculations which add weight to each of the seven approach scores, and at the end of the calculations, the approach with the highest score is picked. Note that changes to approach happen gradually to prevent rapid jumping between values. Also note that the AI's true approach might be hidden under certain circumstances.*
Opinion = a number value which is a factor in influencing the AI's approach. This value is based on the positive and negative modifiers which can be seen when mousing over the leader's displayed approach (some of these modifiers can be hidden if the AI is FRIENDLY or pretending to be). The 'Transparent Diplomacy' option shows all modifiers regardless of approach as well as how much they change Opinion numerically.
---
*If an AI is currently at war with you, has just denounced you or been recalled to life, you will not be able to see their true approach.
Additionally, the DECEPTIVE approach shows up as FRIENDLY, and if an AI's approach is WAR - planning a war, that is, but not currently at war - they will display a "War Face" and pretend to be HOSTILE, GUARDED, NEUTRAL or FRIENDLY towards you while they make their war preparations.
AIs who are AFRAID are always being 100% honest with you, as are AIs that are currently at war with you; but otherwise, you can never be quite sure.
Ending a Declaration of Friendship with an AI (including by denouncing them) will set their approach to GUARDED for the remainder of the current turn (unless its approach is WAR, in which case it employs the GUARDED "War Face").
---
Approach
Important Note
Each leader, as part of their flavors, has a number value indicating their bias for each of the seven approaches.
The list of leaders and their respective biases is found here (note that these are only the base values, and they are randomized a bit between games):
Code:
[America]
Leader: WASHINGTON
WAR: 2
HOSTILE: 2
DECEPTIVE: 2
GUARDED: 2
AFRAID: 2
FRIENDLY: 8
NEUTRAL: 8
[Arabia]
Leader: HARUN AL-RASHID
WAR: 4
HOSTILE: 6
DECEPTIVE: 6
GUARDED: 4
AFRAID: 2
FRIENDLY: 6
NEUTRAL: 2
[Assyria]
Leader: ASHURBANIPAL
WAR: 8
HOSTILE: 6
DECEPTIVE: 2
GUARDED: 4
AFRAID: 1
FRIENDLY: 4
NEUTRAL: 4
[Austria]
Leader: MARIA THERESA
WAR: 2
HOSTILE: 4
DECEPTIVE: 6
GUARDED: 6
AFRAID: 6
FRIENDLY: 6
NEUTRAL: 2
[The Aztecs]
Leader: MONTEZUMA
WAR: 8
HOSTILE: 8
DECEPTIVE: 2
GUARDED: 2
AFRAID: 2
FRIENDLY: 2
NEUTRAL: 2
[Babylon]
Leader: NEBUCHADNEZZAR II
WAR: 2
HOSTILE: 2
DECEPTIVE: 8
GUARDED: 8
AFRAID: 4
FRIENDLY: 4
NEUTRAL: 6
[Brazil]
Leader: PEDRO II
WAR: 2
HOSTILE: 2
DECEPTIVE: 2
GUARDED: 2
AFRAID: 2
FRIENDLY: 6
NEUTRAL: 8
[Byzantium]
Leader: THEODORA
WAR: 1
HOSTILE: 4
DECEPTIVE: 8
GUARDED: 8
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 2
[Carthage]
Leader: DIDO
WAR: 6
HOSTILE: 2
DECEPTIVE: 8
GUARDED: 6
AFRAID: 4
FRIENDLY: 4
NEUTRAL: 4
[The Celts]
Leader: BOUDICCA
WAR: 8
HOSTILE: 6
DECEPTIVE: 8
GUARDED: 8
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 8
[China]
Leader: WU ZETIAN
WAR: 2
HOSTILE: 6
DECEPTIVE: 8
GUARDED: 6
AFRAID: 4
FRIENDLY: 6
NEUTRAL: 8
[Denmark]
Leader: HARALD BLUETOOTH
WAR: 10
HOSTILE: 8
DECEPTIVE: 1
GUARDED: 6
AFRAID: 1
FRIENDLY: 1
NEUTRAL: 5
[Egypt]
Leader: RAMESSES II
WAR: 2
HOSTILE: 2
DECEPTIVE: 2
GUARDED: 2
AFRAID: 2
FRIENDLY: 2
NEUTRAL: 8
[England]
Leader: ELIZABETH
WAR: 2
HOSTILE: 6
DECEPTIVE: 8
GUARDED: 8
AFRAID: 2
FRIENDLY: 2
NEUTRAL: 6
[Ethiopia]
Leader: HAILE SELASSIE
WAR: 4
HOSTILE: 6
DECEPTIVE: 2
GUARDED: 8
AFRAID: 6
FRIENDLY: 6
NEUTRAL: 6
[France]
Leader: NAPOLEON
WAR: 6
HOSTILE: 6
DECEPTIVE: 6
GUARDED: 4
AFRAID: 1
FRIENDLY: 6
NEUTRAL: 1
[Germany]
Leader: BISMARCK
WAR: 2
HOSTILE: 4
DECEPTIVE: 6
GUARDED: 6
AFRAID: 2
FRIENDLY: 6
NEUTRAL: 9
[Greece]
Leader: ALEXANDER
WAR: 8
HOSTILE: 6
DECEPTIVE: 8
GUARDED: 2
AFRAID: 2
FRIENDLY: 2
NEUTRAL: 2
[The Huns]
Leader: ATTILA
WAR: 9
HOSTILE: 8
DECEPTIVE: 2
GUARDED: 3
AFRAID: 1
FRIENDLY: 1
NEUTRAL: 1
[The Inca]
Leader: PACHACUTI
WAR: 2
HOSTILE: 2
DECEPTIVE: 6
GUARDED: 7
AFRAID: 4
FRIENDLY: 7
NEUTRAL: 4
[India]
Leader: GANDHI
WAR: 1
HOSTILE: 1
DECEPTIVE: 1
GUARDED: 8
AFRAID: 8
FRIENDLY: 8
NEUTRAL: 1
[Indonesia]
Leader: GAJAH MADA
WAR: 6
HOSTILE: 2
DECEPTIVE: 2
GUARDED: 6
AFRAID: 4
FRIENDLY: 4
NEUTRAL: 4
[The Iroquois]
Leader: HIAWATHA
WAR: 1
HOSTILE: 2
DECEPTIVE: 8
GUARDED: 8
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 4
[Japan]
Leader: ODA NOBUNAGA
WAR: 6
HOSTILE: 6
DECEPTIVE: 7
GUARDED: 8
AFRAID: 2
FRIENDLY: 3
NEUTRAL: 3
[Korea]
Leader: SEJONG
WAR: 1
HOSTILE: 1
DECEPTIVE: 4
GUARDED: 8
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 8
[The Maya]
Leader: PACAL
WAR: 2
HOSTILE: 2
DECEPTIVE: 6
GUARDED: 8
AFRAID: 6
FRIENDLY: 6
NEUTRAL: 6
[Mongolia]
Leader: GENGHIS KHAN
WAR: 8
HOSTILE: 8
DECEPTIVE: 2
GUARDED: 4
AFRAID: 1
FRIENDLY: 4
NEUTRAL: 5
[Morocco]
Leader: AHMAD AL-MANSUR
WAR: 1
HOSTILE: 1
DECEPTIVE: 1
GUARDED: 8
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 2
[The Netherlands]
Leader: WILLIAM
WAR: 4
HOSTILE: 4
DECEPTIVE: 2
GUARDED: 2
AFRAID: 5
FRIENDLY: 8
NEUTRAL: 5
[The Ottomans]
Leader: SULEIMAN
WAR: 6
HOSTILE: 4
DECEPTIVE: 4
GUARDED: 6
AFRAID: 2
FRIENDLY: 6
NEUTRAL: 4
[Persia]
Leader: DARIUS I
WAR: 4
HOSTILE: 6
DECEPTIVE: 6
GUARDED: 8
AFRAID: 6
FRIENDLY: 4
NEUTRAL: 4
[Poland]
Leader: CASIMIR III
WAR: 6
HOSTILE: 4
DECEPTIVE: 4
GUARDED: 6
AFRAID: 6
FRIENDLY: 4
NEUTRAL: 4
[Polynesia]
Leader: KAMEHAMEHA
WAR: 1
HOSTILE: 1
DECEPTIVE: 6
GUARDED: 6
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 8
[Portugal]
Leader: MARIA I
WAR: 2
HOSTILE: 4
DECEPTIVE: 2
GUARDED: 6
AFRAID: 6
FRIENDLY: 2
NEUTRAL: 8
[Rome]
Leader: AUGUSTUS CAESAR
WAR: 9
HOSTILE: 2
DECEPTIVE: 2
GUARDED: 2
AFRAID: 2
FRIENDLY: 2
NEUTRAL: 8
[Russia]
Leader: CATHERINE
WAR: 2
HOSTILE: 2
DECEPTIVE: 6
GUARDED: 4
AFRAID: 2
FRIENDLY: 6
NEUTRAL: 6
[The Shoshone]
Leader: POCATELLO
WAR: 3
HOSTILE: 5
DECEPTIVE: 6
GUARDED: 8
AFRAID: 6
FRIENDLY: 2
NEUTRAL: 6
[Siam]
Leader: RAMKHAMHAENG
WAR: 2
HOSTILE: 6
DECEPTIVE: 7
GUARDED: 6
AFRAID: 6
FRIENDLY: 4
NEUTRAL: 8
[Songhai]
Leader: ASKIA
WAR: 8
HOSTILE: 8
DECEPTIVE: 8
GUARDED: 8
AFRAID: 2
FRIENDLY: 2
NEUTRAL: 2
[Spain]
Leader: ISABELLA
WAR: 8
HOSTILE: 6
DECEPTIVE: 4
GUARDED: 8
AFRAID: 6
FRIENDLY: 4
NEUTRAL: 6
[Sweden]
Leader: GUSTAVUS ADOLPHUS
WAR: 7
HOSTILE: 2
DECEPTIVE: 2
GUARDED: 4
AFRAID: 2
FRIENDLY: 5
NEUTRAL: 5
[Venice]
Leader: ENRICO DANDOLO
WAR: 3
HOSTILE: 3
DECEPTIVE: 4
GUARDED: 8
AFRAID: 6
FRIENDLY: 8
NEUTRAL: 6
[The Zulus]
Leader: SHAKA
WAR: 9
HOSTILE: 6
DECEPTIVE: 4
GUARDED: 4
AFRAID: 1
FRIENDLY: 1
NEUTRAL: 3
In most of the calculations below, the randomized approach bias is added to its respective approach when a condition makes it more or less favorable to have that approach.
The higher a bias for an approach compared to other biases, the more likely the leader is to use that approach.
e.g. Warmongers have a higher war bias, will add more value than other leaders every time a condition makes going to war more favorable, and thus will favor going to war more often than other leaders.
The current calculation to determine approach (as of the 10-8-1 beta version hotfix) is below:
Code:
What is the best approach to take towards this player?
Run through the following steps in order.
///////////////////////////////
1. Default Weights
Add our NEUTRAL bias to the NEUTRAL approach.
If our approach last turn was WAR and we were preparing a war against this player last turn, 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.
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 we're going for domination victory, then add our WAR bias to the WAR approach.
2. City-State Diplomacy Mod Additions
For each City-State:
- If the City-State has a quest for us to declare war on this player, add our WAR bias to the WAR approach.
- If the City-State has a quest for us to liberate a city this player owns, add our WAR bias to the WAR approach.
- If the City-State has a quest for us to capture a city this player owns, add our WAR bias to the WAR approach.
3. 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.
4. 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.
5. Co-op War Request Refusal
They refused to start a co-op war with us at least once:
- Add our DECEPTIVE bias plus the # of times they refused the request to the DECEPTIVE approach.
*Note:* NumTimesCoopWarDenied:
- goes up by one every time you refuse to start a coop war with this AI;
- goes up by two every time you select "Impossible. You go too far." with this AI, warning the target AI of the war plans;
- goes up by two every time you break a promise to start a coop war with this AI;
- goes down by one (if above zero) every time you successfully start a coop war with this AI;
- is set to zero if you resurrect them or they become your vassal through capitulation.
6. Resurrection
If this player resurrected us ("You restored their civilization after they were annihilated!"):
- Add our FRIENDLY bias 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.
7. Denunciations
We've currently denounced this player!
- Add our WAR bias to the WAR 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.
8. Untrustworthy Friends
If one of the following conditions are true:
- This player betrayed us (denounce/DoW) while we had a Declaration of Friendship;
- This player has DoWed any of their friends;
- This player has denounced at least 2 of their friends;
- This player has ended a DoF prematurely with any of their friends (including by denouncing them)*;
And the following condition is not true:
- This player is currently a vassal;
Then:
- 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.
* This penalty is nullified if the AI who the DoF was broken with is killed by having all of their cities captured (or if Complete Kills is enabled, all of their units as well).
The penalty will return if the AI is resurrected.
This penalty is erased entirely if the AI who the DoF was broken with, on any turn, has an opinion of the former friend of FRIEND or higher (requires -70 or lower opinion), and they're not at war with them.
Thus, if you end a DoF with a player, and on any turn they're not at war with you, they have a total of at least 70 positive opinion of you, the penalty with all AIs
for being an untrustworthy friend will be removed, assuming you don't meet one of the other conditions.
So be careful about ending Declarations of Friendship early!
9. Military Threat
What is this player's military threat level? (GetMilitaryThreat function)
CRITICAL
- Add our WAR bias to the WAR approach.
- Add our AFRAID bias to the AFRAID approach.
- Add our GUARDED bias to the GUARDED approach.
SEVERE
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE 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.
10. 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.
11. Victory Competitiveness Level
How competitive are we over the same victory condition? (GetVictoryDisputeLevel function)
FIERCE COMPETITION
Opinion Indicator: "They know you are competing with them, and they hate it!"
- Add our HOSTILE bias to the HOSTILE approach.
- Add our GUARDED bias to the GUARDED approach.
- Add our WAR bias to the WAR approach.
STRONG COMPETITION
Opinion Indicator: "They suspect you are competing with them."
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our GUARDED bias to the GUARDED approach.
WEAK COMPETITION
Opinion Indicator: "They fear you are competing with them."
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NO COMPETITION
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
12. 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)
FIERCE DESIRE
Opinion Indicator: "Your behavior infuriates them."
- Add our GUARDED bias to the GUARDED approach.
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
STRONG DESIRE
Opinion Indicator: "Your behavior angers them."
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our GUARDED bias to the GUARDED approach.
WEAK DESIRE
Opinion Indicator: "Your behavior worries them."
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NO DESIRE
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
13. Wonder Competitiveness Level
How much are we competing with this player for World Wonders? (GetWonderDisputeLevel function)
Opinion Indicator: "You are competing for World Wonders."
FIERCE COMPETITION
- Add our GUARDED bias to the GUARDED approach.
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
STRONG COMPETITION
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our GUARDED bias to the GUARDED approach.
WEAK COMPETITION
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NO COMPETITION
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
14. City-State Competitiveness 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 City-States in the game, or they haven't met any, no bonus or penalty will be added for this.
Opinion Indicator: "You are competing for the favor of the same City-States!"
FIERCE COMPETITION
- Add our GUARDED bias to the GUARDED approach.
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
STRONG COMPETITION
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our GUARDED bias to the GUARDED approach.
WEAK COMPETITION
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NO COMPETITION
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
15. Land Dispute Level
How much do we covet their lands? (GetLandDisputeLevel function)
FIERCE DISPUTE
Opinion Indicator: "Territorial disputes strain your relationship."
- Add our GUARDED bias to the GUARDED approach.
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
STRONG DISPUTE
Opinion Indicator: "Territorial disputes strain your relationship."
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our GUARDED bias to the GUARDED approach.
WEAK DISPUTE
Opinion Indicator: "Territorial disputes strain your relationship."
- Add our NEUTRAL bias to the NEUTRAL approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
NO DISPUTE
Opinion Indicator: "You have no contested borders."
- Add our FRIENDLY bias to the FRIENDLY approach.
- Add our NEUTRAL bias to the NEUTRAL approach.
16. Are Either Of Us Close to Winning the Game?
If we or the other player are close to any victory conditions, alter our behavior accordingly!
Note that this function doesn't check whether the AI is currently going for the victory condition they're close to.
They're close to a Domination Victory
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our GUARDED bias to the GUARDED approach.
We're close to a Domination Victory
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
We have at least 2 original capitals (not counting our own capital)
- Add our WAR bias plus the number of original capitals we control (not counting our own capital) to the WAR approach.
- Add our HOSTILE bias plus the number of original capitals we control (not counting our own capital) to the HOSTILE approach.
They're close to a Space Victory
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
We're close to a Space Victory
- Add our FRIENDLY bias to the FRIENDLY approach.
They're close to a Diplomatic Victory
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
We're close to a Diplomatic Victory
- Add our FRIENDLY bias to the FRIENDLY approach.
They're close to a Cultural Victory
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
We're close to a Cultural Victory
If they're the civ we have the lowest influence towards and their military strength compared to us is below average:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the WAR approach.
Otherwise:
- Add our FRIENDLY bias to the FRIENDLY approach.
17. Only War? ONLY WAR!!
If Space, Cultural and Diplomatic Victories are all disabled:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
18. We're Cramped (Surrounded/Can't Expand)
- Add our WAR bias to the WAR approach.
- Add our GUARDED bias to the GUARDED approach.
19. 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.
20. Nukes
If the other player is a human, 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 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 our WAR bias to the WAR approach.
- Add 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 our AFRAID bias to the AFRAID approach.
- Add our GUARDED bias to the GUARDED approach.
We both have nukes, and their probability of nuking us is greater than 25%
- Add our GUARDED bias to the GUARDED approach.
21. Current Wars
For each other player (not on this player's team) 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.
22. Global Politics
Run these checks for each other player in the game:
22A. Current Wars
If we're planning war against this other player OR are planning to demand from this other player OR our approach towards them is WAR or HOSTILE:
- Add our FRIENDLY bias to the FRIENDLY approach, and also see below;
If the person whose approach we're deciding right now is our neighbor (proximity CLOSE or NEIGHBORS), we want them on our good side (since we're being hostile to the other guy):
- Add our FRIENDLY bias to the FRIENDLY approach.
Is the other player close or a neighbor? If we're being hostile to a neighbor, we need to be more friendly to others:
- Add our FRIENDLY bias to the FRIENDLY approach.
22B. Approaches towards other civs
Try to limit our strongest feelings for the civs who deserve it the most.
If our approach towards the other player is HOSTILE:
- Add our NEUTRAL bias to the NEUTRAL approach.
If our approach towards the other player is AFRAID:
- Add our FRIENDLY bias to the FRIENDLY approach.
If our approach towards the other player is DECEPTIVE:
- Add our FRIENDLY bias to the FRIENDLY approach.
If our approach towards the other player is GUARDED:
- Add our NEUTRAL bias to the NEUTRAL approach.
22C. Defensive Pacts
Other player has a defensive pact with the player we're looking at
If the other player's military strength is greater than or equal to ours:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
22D. Other Player's War Situation
If the other player is at war with the player we're looking at:
Is the other player our biggest competitor? Yay! We like this guy!
- Add our FRIENDLY bias to the FRIENDLY approach.
Is the other player our most valuable friend? Then we hate this guy!
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If the other player isn't our most valuable friend, are they our most valuable Defensive Pact? Then we hate this guy!
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
23. Trade value
- Multiply the total gold we're getting from this player by 100.
- Multiply the total culture we're getting from this player by 100.
- Multiply the total science we're getting from this player by 100.
- Add these values together to get the current trade value IN.
- Multiply the total gold we're sending to this player by 100.
- Multiply the total culture we're sending to this player by 100.
- Multiply the total science we're sending to this player by 100.
- Add these values together to get the current trade value OUT.
- Multiply the GPT we're getting each turn *from our cities only* by 100. This is the GDP estimate.
- If the GDP estimate is less than 1, use 1 as the estimate in the formula below.
- Calculate the trade delta using the following formula:
Trade Delta = (5 * (Current Trade Value In - Current Trade Value Out)) / GDP Estimate
- If the trade delta is greater than 0, then add the trade delta to the FRIENDLY approach.
24. Vassalage
If the player we're looking at (or his team) has vassals, what do we think of them?
For each of their vassals:
If our approach towards them is HOSTILE
- Add our HOSTILE bias to the HOSTILE approach.
If our approach towards them is WAR
- Add our WAR bias to the WAR approach.
If our approach towards them is DECEPTIVE
- Add our DECEPTIVE bias to the DECEPTIVE approach.
If our approach towards them is GUARDED
- Add our GUARDED bias to the GUARDED approach.
If the other player is *our* vassal, or our team's vassal, then:
Check if either of the following conditions are true:
- The vassal possesses any player's original capital (including their own)
- The vassal is close to space, cultural or diplomatic victory
If neither of them are true, then we like our vassal, so:
- Set our HOSTILE approach score to 0.
- Set our WAR approach score to 0.
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 vassal:
- Add our FRIENDLY bias to the FRIENDLY approach.
CONTENT
Add our FRIENDLY bias to the FRIENDLY approach.
Add our NEUTRAL bias to the NEUTRAL approach.
Subtract our HOSTILE bias from the HOSTILE approach.
Subtract our GUARDED bias from the GUARDED approach.
DISAGREE
Add our NEUTRAL bias to the NEUTRAL approach.
Add our HOSTILE bias to the HOSTILE approach.
Add our GUARDED bias to the GUARDED approach.
MISTREATED
Add our NEUTRAL bias to the NEUTRAL approach.
Add our HOSTILE bias to the HOSTILE approach.
Add our GUARDED bias to the GUARDED approach.
UNHAPPY
Subtract our FRIENDLY bias from the FRIENDLY approach.
Subtract our NEUTRAL bias from the NEUTRAL approach.
Add our HOSTILE bias to the HOSTILE approach.
Add our GUARDED bias to the GUARDED approach.
ENSLAVED
Subtract our FRIENDLY bias from the FRIENDLY approach.
Subtract our NEUTRAL bias from the NEUTRAL approach.
Add our HOSTILE bias to the HOSTILE approach.
Add our GUARDED bias to the GUARDED approach.
They were our vassal and they declared their independence by force:
- Add 4 to the WAR approach.
- Subtract 10 from the DECEPTIVE approach.
- Subtract 10 from the FRIENDLY approach.
We were their vassal and they gave us our independence peacefully:
- Subtract 4 from the WAR approach.
- Add 2 to the DECEPTIVE approach.
- Add 5 to the FRIENDLY approach.
25. 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 our WAR bias to the WAR approach.
- Add 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 our AFRAID bias to the AFRAID approach.
- Add our FRIENDLY bias to the FRIENDLY approach.
26. Target Value
Our assessment of this player's value as a military target (based on city strength and other things) (GetPlayerTargetValue function)
SOFT
- Add our HOSTILE bias to the HOSTILE approach.
- Add 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.
27. Military Aggressive Posture
How much threat is posed by their military deployment near our borders? (GetMilitaryAggressivePosture function)
INCREDIBLE
- Add our HOSTILE bias to the HOSTILE approach.
- Add our WAR bias to the WAR approach.
MEDIUM or HIGH
- Add our GUARDED bias to the GUARDED approach.
- Add our DECEPTIVE bias to the DECEPTIVE approach.
LOW
- Add our NEUTRAL bias to the NEUTRAL approach.
NONE
- Add our FRIENDLY bias to the FRIENDLY approach.
28. Reckless Expansion
If this player is a reckless expander:
Opinion Indicator: "They believe we are building new cities 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.
29. 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.
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 other warring player's war projection of the ongoing war against our potential victim is GOOD or better;
- Our victory dispute level against the target is STRONG or higher;
- Our victory block level against the target is STRONG or higher;
And the following is NOT true:
- Our war projection against the other warring player (the person we'd be ganging up with) is STALEMATE or worse
i.e. we don't want them to sweep over us after finishing with this guy
Then add the integer values of the other warring player's war projection, our victory dispute level, our victory block level, and our war projection against the other warring player together.
Divide this value by 2, then add it to the WAR and HOSTILE approach scores.
30. Vassalage Penalty
If this player is not our master and they have vassals:
For each vassal that we've met, increase our WAR and GUARDED approach scores by 10%.
1 vassal = 110%, 2 vassals = 120%, etc.
31. Recent Peace Treaty
If we've gone to war with this player before, and we signed a peace treaty less than 25 turns ago:
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
32. Duel
If there's only two major civilizations remaining:
- Add our WAR bias to the WAR approach.
If we're aiming for a Domination Victory, add the bias twice:
- Add our WAR bias to the WAR approach.
33. Coop War
If we're locked into a coop war against this player:
- Add our WAR bias to the WAR approach.
34. Defensive Pact
This player's team has a defensive pact with us:
- Add our FRIENDLY bias to the FRIENDLY approach.
35. Military Promise
We recently promised this player that our troops weren't on their borders for war:
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
36. Agreed to Remove Troops
We recently accepted this player's request to remove our troops from their borders:
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
37. Can We Declare War on this Player?
They're someone else's vassal, and we aren't already at war:
- Set our WAR approach score to 0.
We aren't already at war, and we're not able to declare war on them:
- Set our WAR approach score to 0.
If neither of the above two conditions are true:
- Add our WAR bias to the WAR approach.
38. Distance
(Less likely to want to attack targets that are far away, more likely to want to attack targets that are closer.)
If we're not currently at war with them and our WAR or HOSTILE approach score is > 0, do the following function, otherwise skip:
If we can't reach the target by land, by sea or with a naval invasion, abort!
- Set our WAR approach score to 0.
- Set our HOSTILE approach score to 0.
Before they're able to embark over oceans, the AI strongly prefers to start wars with neighbors and close targets, and prefers land-based attacks.
After they're able to embark over oceans, AIs that are going for Domination Victory treat far and distant targets as if they were neighbors and close targets, respectively.
(Polynesia can embark over oceans from the start of the game and is thus more aggressive sooner)
PLAYER PROXIMITY CHECK (if we can't cross oceans yet)
Target is a NEIGHBOR and we can reach them by land:
- Increase WAR approach score by 100%.
- Increase HOSTILE approach score by 100%.
Target is CLOSE and we can reach them by land:
- Increase WAR approach score by 50%.
- Increase HOSTILE approach score by 50%.
PLAYER PROXIMITY CHECK (if we can cross oceans)
Target is a NEIGHBOR:
- Increase WAR approach score by 100%.
- Increase HOSTILE approach score by 100%.
Target is CLOSE:
- Increase WAR approach score by 50%.
- Increase HOSTILE approach score by 50%.
Target is FAR and we're not going for Domination Victory:
- No change.
Target is FAR and we are going for Domination Victory:
- Increase WAR approach score by 100%.
- Increase HOSTILE approach score by 100%.
Target is DISTANT and we're not going for Domination Victory:
- Decrease WAR approach score by 50%.
- Decrease HOSTILE approach score by 50%.
Target is DISTANT and we are going for Domination Victory:
- Increase WAR approach score by 50%.
- Increase HOSTILE approach score by 50%.
39. Unique Unit
We have a unique unit tech unlocked, and at least one of them active:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
We have a unique unit tech unlocked, but none currently active:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
- Add our WAR bias to the WAR approach.
We don't have a unique unit tech unlocked, but we will have one soon:
- Add our DECEPTIVE bias to the DECEPTIVE approach.
40. Most Important Players
If this player is our biggest competitor:
- Add our WAR bias to the WAR approach.
- Add our HOSTILE bias to the HOSTILE approach.
If this player is our most valuable friend:
- Add our FRIENDLY bias to the FRIENDLY approach.
If this player is our most valuable Defensive Pact:
- Add our FRIENDLY bias to the FRIENDLY approach.
41. Domination Victory Disabled
If Domination Victory is disabled as a victory type:
- Divide our WAR approach score by 2.
- Divide our HOSTILE approach score by 2.
42. Opinion
Opinion is applied as a +/- % modifier to Approach scores after 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 20 (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 -20 (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 -20 TO 20 RANGE (Neutral)
Increase neutrality:
- Multiply NEUTRAL approach score by (100 + NeutralMod).
- Divide NEUTRAL approach score by 100.
43. Same Team
If we're on the same team as this player, set FRIENDLY approach score to 100 and all others to 0.
44. Make Changes in Approach Gradual
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. 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)))
B. Set the approach score to this "average" value.
45. Pick a War Face If Going to War
If the highest approach score after all these calculations is WAR (therefore the AI is planning a war), the AI will pick a "War Face", which determines how it will act towards you until WAR isn't the highest approach anymore. Note that being at war overrides the War Face.
If the AI's highest 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 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.
46. Decide What Approach to Show to the Player
The AI picks its highest approach and uses that towards you. If all approach scores are 0, it will use the NEUTRAL approach.
If the AI is planning war with you, they will use their War Face (see #42 above).
If the AI's approach towards you is DECEPTIVE, it will show up as FRIENDLY.
If the AI is currently at war with you, the message WAR! is shown in place of their usual approach.
If the AI has just denounced you, the message DENOUNCING! is shown in place of their usual approach.
If the AI has just been resurrected, the message RECALLED TO LIFE is shown in place of their usual approach.
Otherwise, the approach shown to you is the AI's approach towards you.
Last Updated: October 19 (no recent changes)
Last edited: