VP Diplomacy - AI Approach & Opinion Demystified

Recursive

Already Looping
Moderator
Supporter
Joined
Dec 19, 2017
Messages
4,698
Location
Antarctica
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. :scan:

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:
For easy reference, I've also included the factors which increase or decrease each of the seven approach scores in this handy list. Note that the list is a simplified summary; for the full details, see the main approach calculation.

List is current as of the 10-8-1 beta version hotfix.

Factors affecting the WAR approach
Code:
AI is more likely to adopt the WAR approach towards a player ("the target") if...
- Its approach last turn was WAR and they were preparing a war against the target.

- They're going for Domination Victory, and they're either not at war with the target, or they are at war and it's a stalemate or better.

- City-States have given them quests to declare war against the target, liberate cities they've captured, or capture their cities.

- They've denounced the target.

- Target betrayed them personally (denounced or declared war while they had a DoF), or they're an untrustworthy friend. Untrustworthy friends are players who have DoWed any of their friends or denounced at least 2 of them.

- Target's military threat level is SEVERE or CRITICAL.

- Target's warmonger threat level is SEVERE or CRITICAL.

- They have a FIERCE victory block level, i.e. desire to stop the target from winning. This is indicated by "Your behavior infuriates them."

- They have a FIERCE competition level with the target over World Wonders, over City-State friendship, over the same victory condition, or over land.

- They're close to a Domination Victory.

- They're close to a Cultural Victory, the target is the person they have the lowest influence on, and they have a stronger military than them.

- AI has at least 2 original capitals, not counting their own.

- Target is close to a Space, Diplomatic or Cultural victory.

- Space, Cultural and Diplomatic victories are all disabled victory types.

- The AI is cramped.

- They have nukes and the target does not.

- Target is at war with their most valuable friend or Defensive Pact.

- Target has a vassal that the AI's approach towards is WAR.

- Target was their vassal, and they declared their independence by force.

- War projection against the target is GOOD or VERY GOOD.

- Target's military target value (city defense/etc.) is FAVORABLE or SOFT.

- Target is posing an extreme threat with their military deployment near the AI's borders.

- Target is a reckless expander.

- Target is at war with another major civilization and the AI wants to dogpile. See #26 in approach calculation.

- Target has vassals and the AI isn't one of them.

- There's only two major civilizations remaining. Double increase if this AI is going for domination victory.

- They're locked into a coop war against the target.

- The AI can't embark over oceans, the target can be reached by land, and they're close or a neighbor.

- The AI can embark over oceans, the target is close or a neighbor, or the AI is going for domination victory and the target is far or distant.

- The AI has a unique unit tech unlocked.

- Target is the AI's biggest competitor.

- The AI has a negative opinion of the target that is above 20 (competitor).



AI is less likely to adopt the WAR approach towards a player ("the target") if...
- They have a research agreement with the target.

- They have a Declaration of Friendship with the target.

- The target resurrected them.

- They are the target's master AND the target does not own any original capitals AND the target is not close to a space, cultural or diplomatic victory.

- Target was their master and granted them their independence peacefully.

- A peace treaty was signed recently (less than 25 turns ago).

- They made a promise recently that their troops were not on the target's borders for war.

- They recently agreed to remove their troops from the target's borders.

- They have no way to reach the target in any way, whether by land, by sea or with a naval invasion.

- Target's proximity is distant and the AI is not going for domination victory.

- Domination Victory is disabled as a victory type.

- The AI has a positive opinion of the target that is below -20 (favorable).



AI will never adopt the WAR approach towards a player ("the target") if...
- Target is a vassal that they aren't already at war with.

- They're not able to declare war on the target.

(note that in these two cases, it's still possible for the WAR approach to be adopted because of how approach changes gradually, but the score for the current turn is set to 0)

- They're on the same team as the target.

Factors affecting the HOSTILE approach
Code:
AI is more likely to adopt the HOSTILE approach towards a player ("the target") if...
- Its approach last turn was HOSTILE and they were planning to make a demand of the target.

- Target betrayed them personally (denounced or declared war while they had a DoF), or they're an untrustworthy friend. Untrustworthy friends are players who have DoWed any of their friends or denounced at least 2 of them.

- Target's military threat level is SEVERE.

- Target's warmonger threat level is SEVERE or CRITICAL.

- They have a FIERCE victory block level, i.e. desire to stop the target from winning. This is indicated by "Your behavior infuriates them."

- They have a FIERCE competition level with the target over World Wonders, over City-State friendship, over the same victory condition, or over land.

- They're close to a Domination Victory.

- They're close to a Cultural Victory, the target is the person they have the lowest influence on, and they have a stronger military than them.

- AI has at least 2 original capitals, not counting their own.

- Target is close to a Space, Diplomatic or Cultural victory.

- Space, Cultural and Diplomatic victories are all disabled victory types.

- They have nukes and the target does not.

- Target is at war with their most valuable friend or Defensive Pact.

- Target has a vassal that the AI's approach towards is HOSTILE.

- Target is their master, and they aren't CONTENT with how the master is treating them.

- War projection against the target is VERY GOOD.

- Target's military target value (city defense/etc.) is SOFT.

- Target is posing an extreme threat with their military deployment near the AI's borders.

- Target is a reckless expander.

- Target is at war with another major civilization and the AI wants to dogpile. See #26 in approach calculation.

- The AI can't embark over oceans, the target can be reached by land, and they're close or a neighbor.

- The AI can embark over oceans, the target is close or a neighbor, or the AI is going for domination victory and the target is far or distant.

- The AI has a unique unit tech unlocked and at least one of them active.

- Target is the AI's biggest competitor.

- The AI has a negative opinion of the target that is above 20 (competitor).



AI is less likely to adopt the HOSTILE approach towards a player ("the target") if...
- They have a research agreement with the target.

- They have a Declaration of Friendship with the target.

- The target resurrected them.

- They are the target's master AND the target does not own any original capitals AND the target is not close to a space, cultural or diplomatic victory.

- The target is their master and they're content with how they've been treated.

- A peace treaty was signed recently (less than 25 turns ago).

- They made a promise that their troops were not on the target's borders for war.

- They agreed to remove their troops from the target's borders.

- They have no way to reach the target in any way, whether by land, by sea or with a naval invasion.

- The target's proximity is distant and the AI is not going for domination victory.

- Domination Victory is disabled as a victory type.

- The AI has a positive opinion of the target that is below -20 (favorable).


AI will never adopt the HOSTILE approach towards a player ("the target") if...
- They're on the same team as the target.

Factors affecting the GUARDED approach
Code:
AI is more likely to adopt the GUARDED approach towards a player ("the target") if...
- Target betrayed them personally (denounced or declared war while they had a DoF), or they're an untrustworthy friend. Untrustworthy friends are players who have DoWed any of their friends or denounced at least 2 of them.

- Target has denounced them.

- Target's military threat level is MAJOR, SEVERE or CRITICAL.

- Target's warmonger threat level is MAJOR, SEVERE or CRITICAL.

- They have a STRONG or FIERCE victory block level, i.e. desire to stop the target from winning. This is indicated by "Your behavior angers/infuriates them."

- They have a STRONG or FIERCE competition level with the target over World Wonders, over City-State friendship, over the same victory condition, or over land.

- Target is close to a Domination Victory.

- The AI is cramped.

- Target has nukes and the AI does not + they're more than 50% likely to nuke the AI (100% for humans)

- Both AI and target have nukes + they're more than 25% likely to nuke the AI (100% for humans)

- Target has a vassal that the AI's approach towards is GUARDED.

- Target is their master, and they aren't CONTENT with how the master is treating them.

- War projection against the target is DEFEAT.

- Target is posing a medium to high threat with their military deployment near the AI's borders.

- Target has vassals and the AI isn't one of them.

- The AI has a negative opinion of the target that is above 20 (competitor).



AI is less likely to adopt the GUARDED approach towards a player ("the target") if...
- The target is their master and they're content with how they've been treated.

- The AI has a positive opinion of the target that is below -20 (favorable).



AI will never adopt the GUARDED approach towards a player ("the target") if...
- They're on the same team as the target.

Factors affecting the DECEPTIVE approach
Code:
AI is more likely to adopt the DECEPTIVE approach towards a player ("the target") if...
- Target refused the AI's requests to start a co-op war at least once.

- Target's military threat level is MINOR or MAJOR.

- Target's warmonger threat level is MINOR or MAJOR.

- They have a WEAK or STRONG victory block level, i.e. desire to stop the target from winning. This is indicated by "Your behavior worries/angers them."

- They have a WEAK or STRONG competition level with the target over World Wonders, over City-State friendship, over the same victory condition, or over land.

- Target is close to a Domination Victory.

- Target has a Defensive Pact with another player, and this other player's military strength is greater than or equal to the AI's.

- Target has a vassal that the AI's approach towards is DECEPTIVE.

- Target was their master and granted them their independence peacefully.

- War projection against the target is DEFEAT.

- Target's military target value (city defense etc.) is AVERAGE or FAVORABLE.

- Target is posing a medium to high threat with their military deployment near the AI's borders.

- Target is a reckless expander.

- The AI has a unique unit tech unlocked but none of them active, or will have a unique unit tech unlocked soon.

- The AI has a negative opinion of the target that is above 20 (competitor).



AI is less likely to adopt the DECEPTIVE approach towards a player ("the target") if...
- The target resurrected them.

- The target was their vassal and declared their independence by force.

- The AI has a positive opinion of the target that is below -20 (favorable).



AI will never adopt the DECEPTIVE approach towards a player ("the target") if...
- They're on the same team as the target.

Factors affecting the AFRAID approach
Code:
AI is more likely to adopt the AFRAID approach towards a player ("the target") if...
- Target's military threat level is CRITICAL.

- Target's warmonger threat level is CRITICAL.

- Target has nukes and the AI does not + they're more than 50% likely to nuke the AI (100% for humans)

- War projection against the target is DEFEAT or DESTRUCTION.

- The AI has a negative opinion of the target that is above 20 (competitor).


AI is less likely to adopt the AFRAID approach towards a player ("the target") if...
- The AI has a positive opinion of the target that is below -20 (favorable).


AI will never adopt the AFRAID approach towards a player ("the target") if...
- They're on the same team as the target.

Factors affecting the NEUTRAL approach
Code:
Note that all AIs start with a default weight towards being NEUTRAL regardless of other circumstances.

AI will always adopt the NEUTRAL approach towards a player if...
- All approach scores are at zero.

AI is more likely to adopt the NEUTRAL approach towards a player ("the target") if...
- Target's military threat level is LOW.

- Target's warmonger threat level is LOW.

- They have a WEAK or NO victory block level, i.e. desire to stop the target from winning. If WEAK, this is indicated by "Your behavior worries them."

- They have a WEAK or NO competition level with the target over World Wonders, over City-State friendship, over the same victory condition, or over land.

- AI is very unhappy and has more than 0 war weariness.

- AI is at war with other players, and the current state of the war is CALM or a STALEMATE.

- AI has already adopted the HOSTILE or GUARDED approach towards other players.

- The target is their master and they're content with how they've been treated.

- War projection against the target is STALEMATE or UNKNOWN.

- Target's military target value (city defense etc.) is BAD or AVERAGE.

- Target is posing a low threat with their military deployment near the AI's borders.

- The AI has an opinion of the target that is neither above 20 (competitor) nor below -20 (favorable).



AI is less likely to adopt the NEUTRAL approach towards a player ("the target") if...
- Target is their master, and they feel UNHAPPY or ENSLAVED by their master's treatment of them.

- The AI has a negative opinion of the target that is above 20 (competitor) or a positive opinion of the target that is below -20 (favorable).



AI will never adopt the NEUTRAL approach towards a player ("the target") if...
- They're on the same team as the target.

Factors affecting the FRIENDLY approach
Code:
AI will always adopt the FRIENDLY approach towards a player ("the target") if...
- They're on the same team as the target.

AI is more likely to adopt the FRIENDLY approach towards a player ("the target") if...
- They have a research agreement with the target.

- They have a Declaration of Friendship with the target.

- The target resurrected them.

- Target's military threat level is NONE.

- Target's warmonger threat level is NONE.

- They have NO victory block level, i.e. desire to stop the target from winning.

- They have NO competition level with the target over World Wonders, over City-State friendship, over the same victory condition, or over land.

- They're close to a space or diplomatic victory.

- They're close to a cultural victory, and either the player is not the civ they have the lowest influence towards, or they are but their military strength compared to the AI is average or higher.

- AI is very unhappy and has more than 0 war weariness.

- AI is at war with other players, and the current state of the war is DEFENSIVE or NEARLY DEFEATED.

- AI is planning war with other players, is planning to demand from other players, or has already adopted the WAR or HOSTILE approach towards them. Additional increase if either the target or the other player they're being hostile to is in close proximity or a neighbor.

- AI has already adopted the AFRAID or DECEPTIVE approaches towards other players.

- Target is at war with AI's biggest competitor.

- AI is receiving a substantial amount of yields (gold, culture, science) from trade with this player. See #20 in approach calculation.

- Target is their master and they're a voluntary vassal.

- Target is their master and AI is content with how they've been treated.

- Target was their master and they gave this AI independence peacefully.

- War projection against the target is DESTRUCTION.

- Target's military target value (city defense etc.) is IMPOSSIBLE or BAD.

- Target is posing no threat with their military deployment near the AI's borders.

- They have a Defensive Pact with the target.

- Target is AI's most valuable friend.

- Target is AI's most valuable Defensive Pact.

- The AI has a positive opinion of the target that is below -20 (favorable).



AI is less likely to adopt the FRIENDLY approach towards a player ("the target") if...
- They've denounced the target.

- Target betrayed them personally (denounced or declared war while they had a DoF), or they're an untrustworthy friend. Untrustworthy friends are players who have DoWed any of their friends or denounced at least 2 of them.

- Target has denounced them.

- Target is their master, and they feel UNHAPPY or ENSLAVED by their master's treatment of them.

- Target was their vassal and declared their independence by force.

- The AI has a negative opinion of the target that is above 20 (competitor).
 
Last edited:
Reserved for when I figure out the individual mechanics for each of the opinion modifiers :)

I'll put them all in a table here, with associated explanations.

For now, remember that you can see all of the opinion modifiers affecting your relationship with an AI leader - and their numeric values - by enabling the "Transparent Diplomacy" option. This will show all of them, even if they're FRIENDLY (real or faking it).

(Transparent Diplomacy shows positive modifiers as positive numbers and negative modifiers as negative numbers; it's reversed in the code, but this isn't important to the average player's understanding)
 
At one point I was really curious what the different factors were so I could try to play around them better. After reading about halfway through what affects one of 7 approaches, I am no longer curious.

Thanks for the breakdown though, very informative on just how much goes into the AI's decision making and what general guidelines to follow for certain treatment.
 
I just have one question: how is each Bias defined? Is there a fixed value for each Leader? Or can it change given specific circumstances?
Or is not Leader-dependent?
 
I just have one question: how is each Bias defined? Is there a fixed value for each Leader? Or can it change given specific circumstances?
Or is not Leader-dependent?

Updated answer: My first post now has the list of biases for each leader.

It is a fixed value for each approach for each leader, although they are randomized a bit each game like other flavors (by +/- 2, I believe).

To my knowledge the approach bias values were not changed from BNW and you can find them on a leader flavor chart.

https://www.reddit.com/r/civ/comments/1hju7a/new_ai_bias_chart_including_brave_new_world_civs/

 
Last edited:
How is military threat level calculated across difficulties? I remember reading on the forums that on higher difficulties the AI by default assumes that your military is more threatening (the logic being that a higher level player is more skilled at warfare) on higher difficulties which might help explain some of the posts here and on Reddit about constant AI aggression on lower difficulties.
 
Its truly incredible how many factors go in to the AIs decision making, just shows the complexity that has evolved over the years!
 
How is military threat level calculated across difficulties? I remember reading on the forums that on higher difficulties the AI by default assumes that your military is more threatening (the logic being that a higher level player is more skilled at warfare) on higher difficulties which might help explain some of the posts here and on Reddit about constant AI aggression on lower difficulties.

Maybe, but there is significantly less AI supply on Settler than Diety, so they do need to adjust their perceptions with difficulty otherwise Settler AI would be terrified of everything or Diety would constantly underestimate player militaries.
 
I just have one question: how is each Bias defined? Is there a fixed value for each Leader? Or can it change given specific circumstances?
Or is not Leader-dependent?

The approaches? The AI subfolder of VP.

Updated the first post with the list of approach biases for each leader, thanks G for the correction :)
 
Top Bottom