Diplomacy AI Development

Want me to post a thread with a poll for greater visibility? I agree you're probably not getting a representative sample in this thread on page 19.

Sure, that sounds good! I'd like to get more thoughts on this. :)

@Recursive There is one possibility. It is also how defense pacts usually worked historically in real life. It would also let to more sensible, consistent diplomacy and alliances. Make them specific to an enemy. I other words make them not general, triggered when anyone declares on one of them, but respective to and triggered only if their mutual enemy or power which they fear declares. It would be more the reversal of do you want to declare on someone. But I don't think it's possible to change so I don't dare to ask for it. Just reducing the number should suffice.

Possible, yes. But a big challenge to implement. Modifying the UI in this game is a giant pain.

I used a sort of hack to count the opener as a Social Policy, because Firaxis decided not to include openers in the policy table - I just created a new function with an LUA hook specifically for UI display of the Social Policy count. It's so much easier for me to work with CPP files! Unfortunately, that wouldn't work for the trade screen.

Also not sure if that'd be the best approach. The deal AI already has many issues with agreements and interactions and this could exacerbate them.
 
i like the way the DPs add these complexities to decisions as the game wears on, though i agree they can be too automatic and gamey feeling sometimes

would be nice if player had a choice to opt out when the war dec really wasnt in their interests, and maybe suffer penalty similar to how backing out of a 10 turn war promise might result... or some mechanism (ie bribes) to encourage player to leave DP.. i can appreciate that this is easier said then done, though, and that the balance here would be tricky at best.

as human player i generally enter into DP's to counter a specific player or group of players, but sometimes things go sideways and end up in completely unintended wars etc.. does make the game more interesting and unpredictable though
 
Temporary sanctions make it too much like a timeout instead of a serious punishment for angering other civs. It makes the optimal strategy “wait it out” instead of trying to power through it or get it overturned in the WC. It’s a diplomatic weapon and weakening it indirectly nerfs diplomacy by nerfing the resolution itself, but also by forcing the proposal to be voted on multiple times instead of advancing the game by voting on other resolutions. WC is already bogged down enough with repeated votes on big proposals because they are hard to pass.

Actually, I think that a time limited sanctions would help with the bogged down nature of the WC. If it wasn't such a huge deal, then the AI could be adjusted to not care so much about it. Right now, it seems like the AI will go out of their way to vote against sanctions, even if they aren't trading with the sanctions target. If sanctions are less severe, then the AI wouldn't (shouldn't?) vote against unless they stand to lose trade routes or very high value deals.

A "smaller", less game-warping sanction would make diplomacy more nuanced and interesting. That's what I meant in my original comment, making most diplo actions overall shorter would allow for more variance and help with that bogged down feeling
 
Actually, I think that a time limited sanctions would help with the bogged down nature of the WC. If it wasn't such a huge deal, then the AI could be adjusted to not care so much about it. Right now, it seems like the AI will go out of their way to vote against sanctions, even if they aren't trading with the sanctions target. If sanctions are less severe, then the AI wouldn't (shouldn't?) vote against unless they stand to lose trade routes or very high value deals.

A "smaller", less game-warping sanction would make diplomacy more nuanced and interesting. That's what I meant in my original comment, making most diplo actions overall shorter would allow for more variance and help with that bogged down feeling
I've found that the AI has been voting for sanctions well, not too much or too little. Are you playing on 6-9-2? I believe it was adjusted on how the AI would vote.
 
Has something changed with how AI votes for the host? INB4 all AIs votes always for themselves, so when I had less votes that Austria, I voted for Russia, so sum of our votes is more than Austria votes and Russia becomes a host instead of Austria. However, what was unexpected, 5 other civs voted for me to be a host and I became the host. I didn't have any DoFs or DP with any civs. The reason could be that I were proposing popular resolutions, with the exception of banning Austria monopoly resource. It's my first game in a year, so maybe there were changes during that time?
 
Has something changed with how AI votes for the host? INB4 all AIs votes always for themselves, so when I had less votes that Austria, I voted for Russia, so sum of our votes is more than Austria votes and Russia becomes a host instead of Austria. However, what was unexpected, 5 other civs voted for me to be a host and I became the host. I didn't have any DoFs or DP with any civs. The reason could be that I were proposing popular resolutions, with the exception of banning Austria monopoly resource. It's my first game in a year, so maybe there were changes during that time?

I often get people voting for me, seems normal IMO. Really depends on your relationships with other civs though; who do they think will propose things that are in their interest or trying to prevent one of their main rivals from gaining power etc.
 
upload_2020-6-28_23-57-57.png

The unlikely friendship. Well they aren't neighbours but it's still only turn 89...
 
As of today, I've officially started my major rework of many diplomacy-related things. :)

I'll be posting progress updates in this thread. My first priority is the diplo AI's abysmal memory system, which I've spent the past 14 hours working on making easier to use (and I'm not done yet - not even close).
 
As of today, I've officially started my major rework of many diplomacy-related things. :)

I'll be posting progress updates in this thread. My first priority is the diplo AI's abysmal memory system, which I've spent the past 14 hours working on making easier to use (and I'm not done yet - not even close).
Memory like RAM, or memory like "I'll remember this..."?
 
Memory like RAM, or memory like "I'll remember this..."?

In the case of the diplo AI, both! It tracks and stores a lot of data on other players, like whether a DoF is accepted, if you've asked them not to settle near you, or how much damage you've taken in a war for the war score calculation.

Firaxis, according to Gazebo, implemented "the worst of two memory management systems" when coding the diplomacy AI. And I can attest to how badly it's coded.

Because there might be invisible code outside of the GameCoreDLL that could interfere with stability, I won't be eliminating all the unnecessary duplication (yet) but I'm making it far more organized and easy to use, as well as trimming away unnecessary/unused values.

This'll be very helpful in my changes thereafter.
 
Temporary sanctions make it too much like a timeout instead of a serious punishment for angering other civs. It makes the optimal strategy “wait it out” instead of trying to power through it or get it overturned in the WC. It’s a diplomatic weapon and weakening it indirectly nerfs diplomacy by nerfing the resolution itself, but also by forcing the proposal to be voted on multiple times instead of advancing the game by voting on other resolutions. WC is already bogged down enough with repeated votes on big proposals because they are hard to pass.

Yes I agree with you and understand what you're saying. It would need a lot of work on the AI to make the temporary sanction a viable thing :undecide: But on the other hand I notice that there are not so much "good" things to vote for in the late game. I see the (only) good side of making it a temporary thing.
I think it's really interesting how some of us experience so diferently the exact same features of this mod! That's why i love it!
Conclusion: don't fix something that isn't broken XD
 
@Recursive On defensive pacts I would say there are slightly too many of them and AIs seem a little to keen to pact each other especially around medieval/renaissance, though I wouldn't say they cause a huge problem as there is usually some kind of work around to get the war you want. Also it's very rare that a human can use DPs on high difficulties as either you are weak so need a pact but noone will pact with you, or you are strong so people want to but then you are probably planning on killing them anyways/don't need their help.

Also on the Deity Snowballers thread you said AIs were being increased in aggression in early game. Not sure I agree with that as in my recent Korea game the AIs around me spent most of the early/mid game attacking me for no real reason (understandable as I had Rome and Greece next to me). But then nobody attacked me later on when I was considerably in the lead and clearly close to a science victory. Also at that point I had a pretty big warmonger penalty so was extra strange.
Game is here if you want to see what I mean: https://www.youtube.com/playlist?list=PLW3mHgkBrOX2eOjeKMjoe-5I8lx0kh3RO .
Also in a game as Spain the AIs kept telling me they were afraid of me even though my army wasn't actually that big so perhaps the AIs are overestimating human strength on Deity slightly too much? Perhaps this is what happened in Korea game too.

Appreciate the work btw man:)
 
@Recursive On defensive pacts I would say there are slightly too many of them and AIs seem a little to keen to pact each other especially around medieval/renaissance, though I wouldn't say they cause a huge problem as there is usually some kind of work around to get the war you want. Also it's very rare that a human can use DPs on high difficulties as either you are weak so need a pact but noone will pact with you, or you are strong so people want to but then you are probably planning on killing them anyways/don't need their help.

Also on the Deity Snowballers thread you said AIs were being increased in aggression in early game. Not sure I agree with that as in my recent Korea game the AIs around me spent most of the early/mid game attacking me for no real reason (understandable as I had Rome and Greece next to me). But then nobody attacked me later on when I was considerably in the lead and clearly close to a science victory. Also at that point I had a pretty big warmonger penalty so was extra strange.
Game is here if you want to see what I mean: https://www.youtube.com/playlist?list=PLW3mHgkBrOX2eOjeKMjoe-5I8lx0kh3RO .
Also in a game as Spain the AIs kept telling me they were afraid of me even though my army wasn't actually that big so perhaps the AIs are overestimating human strength on Deity slightly too much? Perhaps this is what happened in Korea game too.

Appreciate the work btw man:)

Re: Approach, the aggression increase is throughout the game. Early game just has an additional bonus if you're considered an "early game competitor".

Re: DPs, I corrected a bug for next version that was causing the AI to make too many DPs (and DoFs).

Re: Strength estimates, I also rewrote the code for this - let's see how things are in the next version.
 
@RecursiveHere's a brief update for you (sorry, no transparent diplo on this time...) through my 250 turns on v6/19 hotfix - Indonesia / Standard / Continents / King (edited difficultyxml to make AI select best choices) / Progress, Fealty, Imperialism:
  • 130 turns with no war despite authority Aztecs right above me and me settling my second city underneath his capital (although he did denounce me before I kept a promise to him to stop buying land). Inca authority forward settle me to my east after we made early DoF, and I accept a joint war proposal as well as a DoF from authority Zulu once the Incan DoF expires. I take 2 Incan cities before peacing, while Zulu makes no ground and doesn't sniff capturing an Incan city.
    Spoiler :
    Screenshot (344).png
  • Some turns later, with the religion game having established (Carthage, Aztecs, Inca, and I all found) and the Inca vulnerable, both Zulu and Dido (who also befriended me after my initial victory against the Inca) simultaneously propose a war against Pacha. I accept and proceed to use both my UU's (using 3/4 UC mod) to claim my rightful land; Zulu again makes no ground, while Dido almost takes Tiwanaku before I vassal Pacha.
  • Near the end of the Incan war, the Zulu (despite being nowhere near Monty, maybe he wants me distracted in order to backstab me?) ask me for another joint war, this time against the Aztecs. I tell him to give me 10 turns.
    Spoiler :
    Screenshot (347).png
    Right as the Inca capitulate to me, Dido and Zulu form a DP with one another as I encroach on their borders, and then to my pleasant surprise, Dido also asks me for assistance in approaching Monty. I tell her to wait another 10 turns so I can recover a bit after the Incan conquests, but it was kind of inconvenient to disappoint Shaka and take a negative hit when he asked if I was ready to go, and of course I couldn't tell him "chill bro, just give me 5 more turns and Dido will declare with us!".
    Spoiler :
    Screenshot (350).png
  • I warred Monty with Dido (Shaka never did end up declaring war on Monty, as it would have been a pointless war), using her support to move in and systematically take his cities and neighboring CS allies one-by-one; Orders with Crusader Spirit (alongside my festivals/tithe/theocratic rule) has really helped my conquests.
  • By this point I discovered all civs (Dido and Germany had tech leads on me, but my Prau did their jobs effectively scouting) and passed Casus Belli overwhelmingly, despite me only having 2 initial votes - I actually waited multiple turns before annexing Monty's capital (I left him with 2 cities in tact, one of them his holy city) in the hopes that the proposal would pass in the first congress, so that the negative diplo of my conquests would be softened. Dido was able to grab one of his cities just before he capitulated to me.
    Spoiler :
    Screenshot (364).png

  • With my power on full display in culmination of my war and the first world congress, I had some surprise visitors...
    Spoiler :
    Screenshot (353).png
    Spoiler :
    Screenshot (362).png
    Spoiler :
    Screenshot (363).png
  • At this point Dido has taken Imperialism with a decent culture lead, while Germany was starting to pop out some wonders and increase his tech lead slightly - Rome had warned me that Bismark was planning to attack us (and we're now instead just about to engage in a joint war against him!). But before that goes down as I recommence my game, what's this...?
    Spoiler :
    Screenshot (366).png
    Spoiler :
    Screenshot (369).png
  • Behold! To any doubters of the glorious diplo that may be achieved, bask in the greatness that is my abundance of DoF's and DP's, despite being the aggressor! I'm interested to see how the rest plays out as I attempt to now hold onto relations for as long as I can. I know there will always be tinkering (and I agree that early game authority civs need to be more ruthless), but I just wanted to show that a lot of the work is in fact coming to fruition and making my games more enjoyable. Keep it up!
    Spoiler :
    Screenshot (368).png
 
Last edited:
Upcoming diplomacy changes for next hotfix/version:
Code:
AI aggression substantially increased (may need additional tweaking; please provide feedback on this)
- Especially increased for Authority/Imperialism/Autocracy AIs and at higher difficulties
- Additional bonus for the early game

Fixed an issue causing the AI to exceed the Declaration of Friendship / Defensive Pact "want" limit and overcommitting (please provide feedback on this)

Improvements to AI approach logic when considering Defensive Pacts, teammates, and coop wars
- AIs that have support will be less afraid/guarded, AIs that have offensive support will be more aggressive (scaling with the strength of the supporting player and their proximity to the evaluated player)
- Other player's Defensive Pacts are only factored in if not already at war with the player being evaluated OR if at war with the Defensive Pact player
- Other player's teammates are now factored in

When war is declared between major civs:
- The attacking major civ will immediately reevaluate its approach towards all other major civs
- All other major civs will immediately reevaluate their approach towards the attacking major civ
- When approach is "reevaluated", AI gets no bonuses to certain approaches based on current/last turn approach, and it sets this turn's approach values as the new average rather than gradually increasing the value

Improved AI military strength estimations (please give feedback on this)
- Humans now get a boost to perceived military strength based on difficulty
- Defensive Pacts are only factored in to a player's military strength estimate if not already at war with the player being evaluated OR if at war with the Defensive Pact player
- Slight adjustments to military skill rating system & bugfix

Reduced warmongering penalties for declaring war by roughly half (base modifier is now 100 + num players we've seen this player attack + 25 or 50 based on military strength, so 100 less)
- Warmongering should mostly be accumulated by conquering cities

Cleaned up warmongering penalty code and fixed several bugs
- Original capital modifier for capturing/liberating cities now works properly
- Fixed decay rate for warmongering (now a minimum of -1 warmonger amount per turn, Casus Belli/Global Peace Accords function properly)
- Using nukes now applies a warmonger penalty with all AI civs, instead of a bugged massive penalty with one civ

Various bugfixes

As usual, all things diplomacy can be discussed in the dedicated thread: https://forums.civfanatics.com/threads/diplomacy-ai-development.655040/
All of this looks fantastic! Very excited to try when the next beta drops.
 
@RecursiveHere's a brief update for you (sorry, no transparent diplo on this time...) through my 250 turns on v6/19 hotfix - Indonesia / Standard / Continents / King (edited difficultyxml to make AI select best choices) / Progress, Fealty, Imperialism:
  • 130 turns with no war despite authority Aztecs right above me and me settling my second city underneath his capital (although he did denounce me before I kept a promise to him to stop buying land). Inca authority forward settle me to my east after we made early DoF, and I accept a joint war proposal as well as a DoF from authority Zulu once the Incan DoF expires. I take 2 Incan cities before peacing, while Zulu makes no ground and doesn't sniff capturing an Incan city.
  • Some turns later, with the religion game having established (Carthage, Aztecs, Inca, and I all found) and the Inca vulnerable, both Zulu and Dido (who also befriended me after my initial victory against the Inca) simultaneously propose a war against Pacha. I accept and proceed to use both my UU's (using 3/4 UC mod) to claim my rightful land; Zulu again makes no ground, while Dido almost takes Tiwanaku before I vassal Pacha.
  • Near the end of the Incan war, the Zulu (despite being nowhere near Monty, maybe he wants me distracted in order to backstab me?) ask me for another joint war, this time against the Aztecs. I tell him to give me 10 turns.Right as the Inca capitulate to me, Dido and Zulu form a DP with one another as I encroach on their borders, and then to my pleasant surprise, Dido also asks me for assistance in approaching Monty. I tell her to wait another 10 turns so I can recover a bit after the Incan conquests, but it was kind of inconvenient to disappoint Shaka and take a negative hit when he asked if I was ready to go, and of course I couldn't tell him "chill bro, just give me 5 more turns and Dido will declare with us!".
  • I warred Monty with Dido (Shaka never did end up declaring war on Monty, as it would have been a pointless war), using her support to move in and systematically take his cities and neighboring CS allies one-by-one; Orders with Crusader Spirit (alongside my festivals/tithe/theocratic rule) has really helped my conquests.
  • By this point I discovered all civs (Dido and Germany had tech leads on me, but my Prau did their jobs effectively scouting) and passed Casus Belli overwhelmingly, despite me only having 2 initial votes - I actually waited multiple turns before annexing Monty's capital (I left him with 2 cities in tact, one of them his holy city) in the hopes that the proposal would pass in the first congress, so that the negative diplo of my conquests would be softened. Dido was able to grab one of his cities just before he capitulated to me.
  • With my power on full display in culmination of my war and the first world congress, I had some surprise visitors...
  • At this point Dido has taken Imperialism with a decent culture lead, while Germany was starting to pop out some wonders and increase his tech lead slightly - Rome had warned me that Bismark was planning to attack us (and we're now instead just about to engage in a joint war against him!). But before that goes down as I recommence my game, what's this...?
  • Behold! To any doubters of the glorious diplo that may be achieved, bask in the greatness that is my abundance of DoF's and DP's, despite being the aggressor! I'm interested to see how the rest plays out as I attempt to now hold onto relations for as long as I can. I know there will always be tinkering (and I agree that early game authority civs need to be more ruthless), but I just wanted to show that a lot of the work is in fact coming to fruition and making my games more enjoyable. Keep it up!

Thank you for the detailed feedback! I'm glad you're enjoying diplomacy :)
 
I'm kinda curious, what do you consider the best things to propose? I always have a lot of things that I want to pass in the World Congress lol.

It depends on a lot of things but normaly I like to play with the diplomacy mechanis a lot, love the way it feels and is getting better and better each patch. Assuming i'm the one with more votes,I really go out of my way to be ahah
So with that in mind I try to flip frienships by trying to pass things that I like, the ones with wonders(when i'm the 1st in manufacturer goods, they all love that), the natural wonders one(normally they all love that too), the one that opens doors with some city state i'm never getting allied because some diplomat spammer is their neighbor and I don't remember much more but there are at least 3 more that I like to play with and vote. The way I try to manipulate the world tensions is by making my spies into embassador in other people capitals and pay them to vote against their "Friend or the one they have a defensive pact with(assuming their friend doesn't want that "law" to get passed)" and make sure that passes by using my votes.
I love the way they start to get mad with each other and their DoF start to fall apart and I start a world war where I ultimately benefit by attacking strategically some other civ without them all beginning to hate me, it's easy when they all hate on each other ;)
So I try to prioritise the things that
1st Benefits me
2nd Fragments the world powers
3rd Ultimately wins me the game or not AHAH

Sometimes I get caught up in playing the game like it were "sim city meets some world politics game" and get destroyed by some civ who gets away with the game ahah I lose more than I win but it's fun anyway
Sorry for being a bit vague and trying a bit much to explain my plays ahah
I don't know if that answer your question but I tried to explain it briefly, hope I have explained myself good enough. If you have any question in particular just ask ;)
 
Back
Top Bottom