Diplomacy AI Development

Okay, played some more in another game, hopefully I can refine my feedback so it's more useful:

1. AI player seem to focus on score more than anything. In my playthrough, India had churned out a ton of wonders, which earned him universal scorn—despite that he had only 3 cities, none of which were coastal, and started no wars. Though he was technologically advanced, I guess he was "peaceful" and a non-expansionist. This meant that I (along with the Shosone to a much greater extent) were able to wage a few wars without much consequence. Eventually, I was able to eliminate India, which meant every AI, including previously friendly ones, immediately turned on me. Including AI's who were being actively being conquered by the Shosone.

2. World Congress seems... slightly imbalanced. If you vassalize a civ with a lot of WC votes, they'll nearly always propose Global Liberation, if available. It's more effective to wipe these civs out completely rather than let them capitulate, since they'll become hostile/afraid once they're freed. And then might even declare war. Despite having been conquered once already. I'd suggest that vassals must vote according to how the master civ votes, and cannot propose liberation in the WC.

3. Some WC proposals should be tweaked, or at least the AI's reasoning to propose them. Sanctions are weird, in that they're much too punishing (no diplomacy options at all, permanently) for AI civs, but for players, you can easily circumvent this by waging wars and having nearby AI's capitulate. Further, AI's that trade with you for or depend on your strategic/luxury resources will propose sanctions regardless. Sanctions/Open Door/Sphere of Influence should have a turn limit, bare minimum. I'd further suggest that sanctions be adjusted so that breaking them is possible for non-vassalized civs.

4. Again on the topic of the WC, the United Nations proposal is rarely, if ever, passed. Perhaps because it's a requisite for a diplomatic victory, but it's just unintuitive; World Religion not passing is understandable (despite not having a religious victory possible), but the UN seems to have no transparent reasoning. These two also allow for some meta-gaming strats with the WC.

5. War-mongering diplomacy penalties are both confusing and predictable at the same time: predictable in that, if there's a more hated civ (i.e., one with a greatly higher score) you can get away with conquering some other civilizations with little penalty. However, should you take out the highest scoring civilization, the other AI's will never be grateful, but instead turn against you. It turns into a game of hot-potato, essentially. Civs you give cities back to will also never be thankful, so long as your score is much higher than theirs.

6. War-mongering diplomatic penalties seem entirely based on conquering cities, and the penalties are incredibly high and take much too long to decay. When coupled with the score based system of AI opinion, this leads to bizarre scenarios where one civ will denounce you and/or go to war with you, despite another civ having taken over some their cities and potentially about to conquer them entirely. Shared religions/ideologies do very little to prevent this, either.

7. There's a meta-game tactic to prevent the penalties from conquering cities, which is allowing allied city-states to take them instead after you knock the cities health to 0 or enough to where they can conquer it. You can cripple other civs this way, and since city-states are "neutral," these same AI players won't attempt to reconquer city-state controlled cities.

8. Unintuitively, civs that are Afraid of you will not (or usually cannot because they won't establish an embassy) willingly become a vassal. I've a civ become a vassal willingly once, but that required friendly relations and trading a tech. Despite that you can obliterate them to the point where they fear you, they somehow think they have a chance at winning.

9. I know I've seen this mentioned before, but there are way too many "impossible" trades. Then, without reason, some of these impossible trades suddenly become possible. Then impossible again. Trading cities is one of these, vassal state is another. A weird quirk of this is that only AI players can propose Declarations of Friendships. Even if one expired and you try to renew it, they'll refuse until it's their turn. Other friendly civs will also avoid DoFs despite having all modifiers in the green, being Friendly, and not having had made DoFs with a denounced AI.

Basic summary, I guess, is that the AI prioritizes winning much higher than surviving. If the AI prioritized setting up a stable, secure civilization over meeting win conditions, then that would pose more of a challenge than the prioritizing victory first. Score-based victory should be heavily discounted by AI, since it ends with the AI sacrificing themselves while being entirely predictable. This doesn't mean that AI players need to be passive, but just more conservative at estimating their chances for victory, and willing to sacrifice victory if it means compromising their civilization stability. Essentially, the AI should generally prefer peaceful solutions, while being aggressive if the situation warrants it. Allowing short wars would also be useful (being able to negotiate peace without a turn minimum), since both players and AI can wage strategic wars to take over/raze a city (e.g., you use a citadel to take over a strategic resource or vital luxury such that it disrupts the AI, they should immediately declare war and attempt to capture or raze your city, then negotiate peace or play defensively if the player doesn't accept). Once you have a war score of 100 (or -100), you should be able to negotiate peace instantly.
 
Thanks for the code, Recursive.
To put things in perspective, how high can the other victory-related penalties scale? E.g. warmongering, being too ahead in science or in WC votes? I'd argue the scaling and caps should be similar for each in general. So it shouldn't be possible to get -200 due to Wonders if you can never get that due to e.g. delegates.

My gut feeling is that 20 / Wonder seems like a lot, even with the new threshold, but we'll see once you answer the above.
 
I agree, 20 per Wonder seems too heavy by half, at least, but the proof will be in the playing.
 
Interesting note. In the last 6 games I've played, I have always been declared on between Turn 270 and 276. Like clockwork.
 
I agree, 20 per Wonder seems too heavy by half, at least, but the proof will be in the playing.

It can be nerfed again if it's too heavy - just trying to find a proper balance of aggression here.
 
Thanks for the code, Recursive.
To put things in perspective, how high can the other victory-related penalties scale? E.g. warmongering, being too ahead in science or in WC votes? I'd argue the scaling and caps should be similar for each in general. So it shouldn't be possible to get -200 due to Wonders if you can never get that due to e.g. delegates.

My gut feeling is that 20 / Wonder seems like a lot, even with the new threshold, but we'll see once you answer the above.

Science: -10 to -30, only applies to scientific civs
WC votes: no specific penalty
Victory Dispute: +25/+35/+45 for WEAK/STRONG/FIERCE, +3 per era, x2 if other player is close to any victory condition
Victory Block: +15/+25/+35 for WEAK/STRONG/FIERCE, +3 per era, x2 if other player is close to any victory condition
Warmongering: no cap

Having a lot of WC delegates doesn't make you a big, juicy target like building lots of Wonders while devoting less attention to military/buildings/science/etc does, though. This penalty applies mostly to neighbors - and again, aggression has been tweaked. The AI is more aggressive about the penalty if they view you as weak in addition to being a "wonder spammer".
 
Interesting note. In the last 6 games I've played, I have always been declared on between Turn 270 and 276. Like clockwork.

There's nothing special about turn 270-276. Coincidence. :)
 
I will say that although I am not seeing the endless dogpile like I was seeing a few versions ago, I am seeing the endless "roulette of war", in which every AI proceeds to declare on me in turn.

1) A declares
2) B declares
3) A peaces
4) C declares

etc etc.

This last game I didn't actively convert and was very peaceful. Global Peace Accords were up. I never attacked, really didn't do much of anything other than build wonders and take high score. That is probably the dominant factors driving these late game wars.
 
Would it be possible to increase the maximum value for certain diplomacy actions? I think the "we are trade partners" modifier caps at 40, it would be nice if it could go up to 60 to maintain diplomacy with civs that you can't spread religion to or to overcome contested borders
 
Would it be possible to increase the maximum value for certain diplomacy actions? I think the "we are trade partners" modifier caps at 40, it would be nice if it could go up to 60 to maintain diplomacy with civs that you can't spread religion to or to overcome contested borders

It is possible - I've considered it.
 
It is possible - I've considered it.

Are trade routes calculated into this? The AI seems to disregard their caravans/cargo ships when declaring war, so I'll often get a lot of gold from caravans/cargo ships already in my territory.

Hostile or guarded AI's should avoid trading with players or sending trade caravans to their cities (not sure if this is case, but I've definitely had hostile/guarded AI attempt to trade for luxuries or resources). If they are forced to trade with the player, then their opinion should also be forced to go up. Tweaking the values for balance might need some tinkering, but I'd like to see the AI more aggressive with trade routes (and trading in general). They should avoid depending on any one civ for trade/income or civs they dislike, but if they have to trade heavily with you (either trade routes or luxuries/resources), their opinion should be forced to go up to Friendly after a long enough time.

I bring this up since there's very little incentive to trade with AI's once you're seen as a potential victor. The AI does not seem to realize this, however.
 
Are trade routes calculated into this? The AI seems to disregard their caravans/cargo ships when declaring war, so I'll often get a lot of gold from caravans/cargo ships already in my territory.

Hostile or guarded AI's should avoid trading with players or sending trade caravans to their cities (not sure if this is case, but I've definitely had hostile/guarded AI attempt to trade for luxuries or resources). If they are forced to trade with the player, then their opinion should also be forced to go up. Tweaking the values for balance might need some tinkering, but I'd like to see the AI more aggressive with trade routes (and trading in general). They should avoid depending on any one civ for trade/income or civs they dislike, but if they have to trade heavily with you (either trade routes or luxuries/resources), their opinion should be forced to go up to Friendly after a long enough time.

I bring this up since there's very little incentive to trade with AI's once you're seen as a potential victor. The AI does not seem to realize this, however.

The AI adds weight to the FRIENDLY approach from trade routes and trade deals with you already, and is disincentivized from declaring war if it would go bankrupt from doing so.

It does not, however, factor in the position of its trade units at the time of declaring war.
 
Does the World Wonder penalty count congress project wonders and corporations? IMO they shouldn't count.
 
Does the World Wonder penalty count congress project wonders and corporations? IMO they shouldn't count.

World Congress projects, no. Corporations, not sure.
 
The AI adds weight to the FRIENDLY approach from trade routes and trade deals with you already, and is disincentivized from declaring war if it would go bankrupt from doing so.

It does not, however, factor in the position of its trade units at the time of declaring war.

Maybe adding a check to the effect of something like (I don't know code too well, so I'll write it out semi-formally): "If number of trade units in player territory > 25% of max trade units OR if number of active player trade units in territory <= number of trade of units in player territory, THEN don't declare war, ELSE declare war."

That's probably too simplistic, and 1/4 of all trade units is probably too low a number, but the basic logic is to avoid the AI declaring war if they have a lot of active trade units in player territory unless they can plunder can equal amount of trade units. I mean, it is quite nice of the AI to help my fund war effort against it with a bunch of caravans, though if I'm going to war against the AI I try to avoid being that kind to them.
 
Science: -10 to -30, only applies to scientific civs
WC votes: no specific penalty
Victory Dispute: +25/+35/+45 for WEAK/STRONG/FIERCE, +3 per era, x2 if other player is close to any victory condition
Victory Block: +15/+25/+35 for WEAK/STRONG/FIERCE, +3 per era, x2 if other player is close to any victory condition
Warmongering: no cap

Having a lot of WC delegates doesn't make you a big, juicy target like building lots of Wonders while devoting less attention to military/buildings/science/etc does, though. This penalty applies mostly to neighbors - and again, aggression has been tweaked. The AI is more aggressive about the penalty if they view you as weak in addition to being a "wonder spammer".

OK. It makes sense to me that "major" modifiers would have similar scales, i.e. cap at similar amounts, so that they remain balanced with one another. Hence I would put a cap on warmongering and on wonders, and raise the cap on Science... but you know the code (not just the letter, but the spirit of it) a million times better than I do.
There'll definitely be the cases where a civ has 10 or 15 more Wonders than another one. So what would the impact of the resulting ~140 or ~240 modifier be? Wouldn't it automatically lead to War, regardless of other modifiers?
 
OK. It makes sense to me that "major" modifiers would have similar scales, i.e. cap at similar amounts, so that they remain balanced with one another. Hence I would put a cap on warmongering and on wonders, and raise the cap on Science... but you know the code (not just the letter, but the spirit of it) a million times better than I do.
There'll definitely be the cases where a civ has 10 or 15 more Wonders than another one. So what would the impact of the resulting ~140 or ~240 modifier be? Wouldn't it automatically lead to War, regardless of other modifiers?

Unless you have 10 or 15 more Wonders than the median (not just the other civ) and are nearby or they're cultural and have enough war weight - no.

Reckless expander, wonder spammer, and warmongering are all kind of in the same category, IMO, and none of them have a cap because they scale with the punished activity.
 
Yes, my post was overly simplified but I did read and understand the code you posted.
However, in my experience in later eras there are between 1 to 4 civ which will pull away from the pack... Hence if there are just or 1 or 2, the Wonders will be heavily concentrated, and the median will be between 2 and 5 while the leaders have 15+ Wonders.
Basically, an example Wonder distribution with 8 civ could be: 0, 1, 2, 2, 3, 7, 15, 20 for a median of 2.5.

After writing this, I figured a real example would be better: here are the counts at the end of my Arabia game. A civ got eliminated, and this is representative of Wonders owned, not built, but it gives a fairly good idea +/- 2 or 3:
1,1,3,4,6,21,22
so the median is 4.
This is so you can get an idea of what the penalty will look like in a game. :)

By the way, what is the definition of CLOSE proximity?
 
Yes, my post was overly simplified but I did read and understand the code you posted.
However, in my experience in later eras there are between 1 to 4 civ which will pull away from the pack... Hence if there are just or 1 or 2, the Wonders will be heavily concentrated, and the median will be between 2 and 5 while the leaders have 15+ Wonders.
Basically, an example Wonder distribution with 8 civ could be: 0, 1, 2, 2, 3, 7, 15, 20 for a median of 2.5.

After writing this, I figured a real example would be better: here are the counts at the end of my Arabia game. A civ got eliminated, and this is representative of Wonders owned, not built, but it gives a fairly good idea +/- 2 or 3:
1,1,3,4,6,21,22
so the median is 4.
This is so you can get an idea of what the penalty will look like in a game. :)

By the way, what is the definition of CLOSE proximity?

Mmmm, you have a point. Thank you for the feedback. :)

Do you have any suggestions on how it could be done better, then? I'm open to ideas.

(Note that the median factors in eliminated civs.)

NEIGHBORS = closest city within 8 tiles
CLOSE = closest city within 16 tiles
FAR = closest city within 24 tiles
DISTANT = farther

There is an exception for embarkation in the proximity calculation - if a civ cannot embark, they will treat all civs on other continents (even small islands nearby) as DISTANT, and if they cannot cross oceans, they will treat all civs on other continents as being one level farther.
 
Back
Top Bottom