1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Diplomacy AI Development

Discussion in 'Community Patch Project' started by Recursive, Feb 14, 2020.

  1. ElliotS

    ElliotS Warmonger

    Joined:
    Jun 13, 2013
    Messages:
    2,868
    Gender:
    Male
    Location:
    Tampa, Florida
    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.
     
  2. Cokolwiek

    Cokolwiek Prince

    Joined:
    Dec 17, 2019
    Messages:
    512
    Gender:
    Male
    @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.
     
    JamesNinelives likes this.
  3. Recursive

    Recursive Deity

    Joined:
    Dec 19, 2017
    Messages:
    2,160
    Gender:
    Male
    Sure, that sounds good! I'd like to get more thoughts on this. :)

    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.
     
    JamesNinelives likes this.
  4. Tekamthi

    Tekamthi Prince

    Joined:
    Aug 12, 2016
    Messages:
    476
    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
     
    DeAnno and JamesNinelives like this.
  5. ElliotS

    ElliotS Warmonger

    Joined:
    Jun 13, 2013
    Messages:
    2,868
    Gender:
    Male
    Location:
    Tampa, Florida
  6. Bromar1

    Bromar1 King

    Joined:
    Feb 26, 2015
    Messages:
    855
    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
     
  7. InkAxis

    InkAxis Prince

    Joined:
    Feb 24, 2020
    Messages:
    368
    Gender:
    Male
    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.
     
    Recursive and JamesNinelives like this.
  8. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    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?
     
  9. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,573
    Gender:
    Male
    Location:
    Australia
    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.
     
    CppMaster and vyyt like this.
  10. Recursive

    Recursive Deity

    Joined:
    Dec 19, 2017
    Messages:
    2,160
    Gender:
    Male
    @CppMaster AI can vote for civs other than themselves for host now.
     
    vyyt, JamesNinelives and CppMaster like this.
  11. azum4roll

    azum4roll Emperor

    Joined:
    Jul 17, 2018
    Messages:
    1,304
    Gender:
    Male
    upload_2020-6-28_23-57-57.png
    The unlikely friendship. Well they aren't neighbours but it's still only turn 89...
     
    JamesNinelives and Recursive like this.
  12. Recursive

    Recursive Deity

    Joined:
    Dec 19, 2017
    Messages:
    2,160
    Gender:
    Male
    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).
     
  13. ElliotS

    ElliotS Warmonger

    Joined:
    Jun 13, 2013
    Messages:
    2,868
    Gender:
    Male
    Location:
    Tampa, Florida
    Memory like RAM, or memory like "I'll remember this..."?
     
    JamesNinelives likes this.
  14. Recursive

    Recursive Deity

    Joined:
    Dec 19, 2017
    Messages:
    2,160
    Gender:
    Male
    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.
     
  15. Carloshooter

    Carloshooter Chieftain

    Joined:
    Apr 5, 2015
    Messages:
    33
    Location:
    Portugal
    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
     
    JamesNinelives and Vhozite like this.
  16. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,573
    Gender:
    Male
    Location:
    Australia
    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.
     
    Carloshooter likes this.
  17. Milae

    Milae Warlord

    Joined:
    Dec 17, 2019
    Messages:
    193
    Gender:
    Male
    @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:)
     
  18. Recursive

    Recursive Deity

    Joined:
    Dec 19, 2017
    Messages:
    2,160
    Gender:
    Male
    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.
     
  19. Kim Dong Un

    Kim Dong Un The One & Unly Supporter

    Joined:
    Dec 17, 2017
    Messages:
    810
    Gender:
    Male
    Location:
    Pyongyang
    @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: Jul 2, 2020
    Recursive and JamesNinelives like this.
  20. wobuffet

    wobuffet Barbarian

    Joined:
    Jun 27, 2011
    Messages:
    1,247
    All of this looks fantastic! Very excited to try when the next beta drops.
     

Share This Page