So I've seen a fair number of complaints about the current mechanics for the AI requesting that you move your troops from their borders.
I'll post the current code here, translated into plaintext. If you have any suggestions on how to improve the mechanic, I'd love to hear any replies.
The AI will send a request that you move your troops from their borders if the following conditions are met:
Military aggressive posture is determined by the following function:
NOTES
- You are supposed to be able to request that the AI move their troops if you are not at war with them, you have not requested this within the past 30 turns, and the AI's aggressive posture towards you is at least MEDIUM.
- If aggressive posture towards the AI is at least LOW, you will see the opinion modifier "Your military deployment is threatening."
- If it is at least HIGH, you will see the opinion modifier "Your military deployment is extremely threatening."
I'll post the current code here, translated into plaintext. If you have any suggestions on how to improve the mechanic, I'd love to hear any replies.
The AI will send a request that you move your troops from their borders if the following conditions are met:
Code:
CvDiplomacyAI::DoAggressiveMilitaryStatement
(note: Player = the player whose troops are near the AI's borders)
Check if *one* of these two conditions are true:
- Player has a military aggressive posture of HIGH this turn and they didn't last turn
- Player has a military aggressive posture of MEDIUM this turn, and last turn they had a posture of NONE
If either condition is true, then send the statement, unless one of these is true:
- Player is already at war with this AI;
- Player is not able to declare war on this AI;
- Player resurrected this AI;
- Player and this AI have a Declaration of Friendship;
- AI has given this player Open Borders in AI's lands;
- Player and this AI are at war with any common foe;
- Player is at war with any of this AI's neighbors (player proximity NEIGHBORS);
- AI has already sent this message within the past 40 turns.
If none of the above conditions are true, the message is sent.
Military aggressive posture is determined by the following function:
Code:
CvDiplomacyAI::DoUpdateOnePlayerMilitaryAggressivePosture
1. Don't run this function for teammates, unmet players, dead players, players with 0 cities, and Barbarians.
2. Don't run this function for players that AI has a Declaration of Friendship with or has given Open Borders to.
3. Store the military aggressive posture last turn, before we update it for this turn.
4. Loop through all of this player's units.
4a. If the unit is a non-combat or scouting unit, ignore it.
4b. If the unit is on a plot that we can't see, ignore it.
4c. Assume the unit has 2 movement. If it can't reach any of our cities within 4 turns of movement, ignore it.
4d. Assume the unit has 2 movement. If the player who owns the unit is at war with another player, AND this unit could reach one of that player's cities within 4 turns of movement, AND that other player is alive, then ignore it.
5. If we got here, then the unit is threatening to us. Add 10 threat value.
6. If the unit is within the player's own borders, halve the threat value to 5 (since they may just be defending their own lands).
7. If threat value is...
80 or higher: Aggressive posture is INCREDIBLE.
50-75: Aggressive posture is HIGH.
30-45: Aggressive posture is MEDIUM.
10-25: Aggressive posture is LOW.
0-5: Aggressive posture is NONE.
NOTES
- You are supposed to be able to request that the AI move their troops if you are not at war with them, you have not requested this within the past 30 turns, and the AI's aggressive posture towards you is at least MEDIUM.
- If aggressive posture towards the AI is at least LOW, you will see the opinion modifier "Your military deployment is threatening."
- If it is at least HIGH, you will see the opinion modifier "Your military deployment is extremely threatening."
Last edited: