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. Gidoza

    Gidoza Emperor

    Joined:
    Jul 26, 2013
    Messages:
    1,209
    I would say it ought to be removed; I agree in principle that losing TR is unrelated to the war overall.
     
    Heinz_Guderian likes this.
  2. Heinz_Guderian

    Heinz_Guderian Chieftain

    Joined:
    Jan 2, 2020
    Messages:
    82
    Location:
    Sweden
    I agree. Very unfun and unrelated to the war
     
  3. Moi Magnus

    Moi Magnus Emperor

    Joined:
    Mar 1, 2015
    Messages:
    1,867
    Just to make sure everyone in on the same page, the reason why TR are included for this computation is that this computation reuse functions from the warscore computation (Two exception being that (1) it doesn't normalize, so contrary to warscore where losing a knight is meaningless if you have a big army, here losing a knight is worth the same for everyone and (2) it doesn't decay with time), hence consider the same factors.

    So to peoples arguing it should be removed, do you consider it should be removed from warscore too? Edit: or just from the new function that evaluate the military rating of players between wars.
     
    Last edited: Feb 24, 2020
    JamesNinelives likes this.
  4. Gidoza

    Gidoza Emperor

    Joined:
    Jul 26, 2013
    Messages:
    1,209
    Wait, I'm confused - I thought we *were* talking about the war score. Hence, I will definitely say yes that it should be removed from the war score.
     
  5. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    17,869
    Gender:
    Male
    Location:
    Little Rock
    TR pillaging b eing a part of warscore is a useful abstraction of economic warfare. I'm reluctant to remove it.

    G
     
    JamesNinelives likes this.
  6. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    6,512
    This I agree with. Pillaging TRs is putting a hurt on your opponent, so factoring that in to warscore makes sense.

    But for military aptitude, the amount of TRs I've lost isn't really an indicator. It won't make one bit of difference how well my units do against his....which is the point of this new calculation.
     
  7. Gidoza

    Gidoza Emperor

    Joined:
    Jul 26, 2013
    Messages:
    1,209
    Moreover, I can build new TR and send them in a different direction to a different civ where they won't be plundered, thus restoring my economic state. Or use internal TR to bolster my military state with production. This isn't accounted for, so I don't see why losing TR to a particular player should be either.
     
  8. Kim Dong Un

    Kim Dong Un The One & Unly Supporter

    Joined:
    Dec 17, 2017
    Messages:
    668
    Gender:
    Male
    Location:
    Pyongyang
    I could also see it remain, but maybe have it factor the least compared to the other ways you gain/lose military score. This might already be the case; I'm not sure how the numbers set up.

    E.g., even if not proficient with war directly, you could be renowned as a pirate who specifically excels in plundering, hello Morocco, but the value should be small enough that you'd have to work for it and tally up a hefty number of routes pillaged (which would require you to be engaged in several wars anyways) before it would become tangible to actually serve as some kind of deterrent for the AI to not want war waged, for fear of knowing it might not lose many units, but instead may lose all of it's TR's which could be just as impactful.

    Honestly though, I'd probably just remove it from the calculations (not warscore!) for the reasons already stated.
     
  9. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    This is my own view as well. Affecting warscore is logical, but TR pillaging has little to no impact on global military aptitude.

    I didn't mean I intended to remove it from the warscore calculation, @Gazebo :)
     
  10. LarryAR

    LarryAR Chieftain

    Joined:
    Apr 6, 2016
    Messages:
    35
    Gender:
    Male
    Location:
    Tennessee-Kentucky Border
    and I'd hate to see it go away.

    I don’t know what’s in the “global military aptitude” code but I personally would prefer the ability to pillage trade routes for myself and adversary AI’s. It is a tool for both powerful and weak military.
     
  11. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    7,031
    Location:
    Malaga (Spain)
    Military aptitude is a new way for the AI to know how skilled a player is. So the AI will look at your territory, your known army strength and your military aptitude and then it will decide which approach is better.

    It is useless to attack with slightly bigger forces when AI attacks a human. AI needs more units to be on equal terms, but how many? That's what military aptitude will try to factor in.

    @HeathcliffWarriors, do you plan to give the human players a bigger military aptitude right from the start? We all know that humans are better commanders than the AI.
     
    JamesNinelives likes this.
  12. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    I am indeed considering this.

    An update on what I'm working on: currently the AI has a suboptimal order of picking approaches which doesn't make a whole lot of sense and results in the AI constantly focusing on the same players (thanks Firaxis).

    What I'm working on getting the AI to do is do a first pass of the approach function, rank all players' approach scores, and then prioritize the players with the highest scores in the second pass for all approaches except NEUTRAL.

    So for instance, if Persia's diplomacy AI had the following WAR approach scores towards other players after the first pass of the function:

    Egypt - 82
    India - 80
    Babylon - 63
    Siam - 30
    Carthage - 8

    Then Egypt would get no reduction to its WAR weight, India would get -1x Persia's WAR bias, Babylon would get -2x the bias, Siam -3x, and Carthage -4x.

    And the same would go for all approaches except NEUTRAL (the default).

    This should result in a wider variety of approaches being adopted, more strategy in how the AI selects friends and enemies, and more variance throughout a game (the AI can forgive things as the eras go by, friends can become enemies, enemies can become friends).

    And it will also be easier to make improvements to the AI this way, since it will be more consistently strategic rather than affected by the current order of priority system.

    The current order of priority is based on the AI's Opinion (worse opinions first) and secondly on the highest weight for *any* approach without caring about *what* it is. Players updated later are less likely to be DoW'ed. This is arbitrary rather than strategic and tends to result in the AI ganging up on the same players over and over.

    This system will be way better, as it doesn't matter in what order the players' approaches are updated, and it prioritizes players entirely on strategic considerations.

    I'm also rewriting the approach function entirely and aiming to improve the AI's strategy when choosing approaches. After that I will work on adding better debug/logging information.
     
  13. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    Upcoming diplomacy changes (not sure if it'll be done by next version, but I'll try):
    Code:
    Bugfixes
    - Fixed issue with captured city modifier (was inverting the military strength comparison by accident)
    - AI should no longer be attacking players they have a DP with in coop wars :)
    
    Significant improvements to GetBestApproachTowardsMajorCiv
    - AI prioritization order for updating approaches is now fixed to be more strategic (see https://forums.civfanatics.com/threads/diplomacy-ai-development.655040/page-4#post-15684545)
    - Improvements to strategic diplomacy & overall
    - Simplified proximity modifier
    - AI less aggressive to weak players when not in their own interests
    - Weight for competing/not competing with the AI for wonders, city-states, land now scales more strategically, based on the AI's pursued victory condition, leader traits and other factors
    - Added approach weight for tech difference (if you have a tech lead over the AI of 2 techs or more, they are more likely to hate you, scaling with how large the lead is and how much they care;
    if they have a tech lead they are more likely to be friendly - should help control runaways a bit)
    - Added opinion bonus (10) for not having more techs than a scientific civilization
    - Global politics now matters a lot more in the AI's approach selection
      - More weight for befriending the AI's friends, making DPs with the same players, denouncing their enemies (weight is now applied for each same DoF/denouncement/etc.)
      - Denouncing/warring with the AI's friends or befriending/making DPs with their enemies is also more impactful (weight is now applied each time as well)
      - Religion/ideology impact this as well (examples: if you, the AI and the other friend all have the same religion, +FRIENDLY weight;
    if you denounce a "heretic" (player with a different religion than the AI) and have the same religion as the AI, they will like you more, etc.)
    
    Performance improvements & code cleanup
    
     
    Last edited: Feb 25, 2020
    Heinz_Guderian, vyyt, tu_79 and 4 others like this.
  14. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    6,512
    I wanted to confirm, if another civ asks me for help (aka can you load me 7 GPT kind of thing), is that supposed to generate a positive diplomacy modifier?
     
    JamesNinelives likes this.
  15. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    It adds to the recent trade bonus ("We are trade partners.")
     
    JamesNinelives likes this.
  16. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    6,512
    I wouldn't think there should ever be a time the AI doesn't want to gain Open borders with me...

    Spoiler :


     

    Attached Files:

  17. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    They don't want to give you a Tourism bonus (or their approach is negative and they think you're trying to trap them).
     
    Carloshooter, Rekk and JamesNinelives like this.
  18. crdvis16

    crdvis16 Emperor

    Joined:
    May 2, 2013
    Messages:
    1,208
    Just finished a game as Egypt. Was close to winning a science vic (after having to give up on winning via tourism) but Pacal managed to rapid fire off his own spaceship parts and come from behind, presumably with superior production in his cities. In any case, Poland should have won this game. He beat all of us to the requisite spaceship techs via a 3 or 4 tech lead and got Hubble/Cern as well so he should have had a headstart on building parts. He was also wide so he would have presumably had lots of cities and production to beat us there. However, he seemed to be stuck on going for a diplo win and was aggressively proposing world ideology/united nations every chance he got (they never passed, though). It seemed like he should have switched gears or at least pursued both victory conditions and in doing so he would have beaten Pacal by maybe 20 turns or so (and me by probably 28 turns). My only thought on why he didn't was perhaps a lack of aluminum to make the parts? He was involved in a lot of war so perhaps the AI was looking out for its military interests at the cost of winning the game and he wasn't willing to disband units to build the parts.

    I'm not sure if victory conditions are part of what you look at @HeathcliffWarriors but if it is, there could be some tweaking in this sort of situation that could help the above. Then again, maybe it's more realistic for an empire to sometimes act stupidly :)
     
    vyyt and CrazyG like this.
  19. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    That's grand strategy AI, not diplo AI.
     
    crdvis16 likes this.
  20. Carloshooter

    Carloshooter Chieftain

    Joined:
    Apr 5, 2015
    Messages:
    29
    Location:
    Portugal
    Hi, I don't know if this is already fixed but I came across what I think is an error. I don't know if this is fixed yet, I had Marroco has a vassal and had a DOF with him and yet he was pillaging my every other traderoute. I'm still using the February patch. I don't think it makes much sense… :S

    PS: Thank you for this brilliant mod I play it for over 3 yeas now!
     

Share This Page