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

    LifeOfBrian Warlord

    Joined:
    Aug 21, 2019
    Messages:
    207
    Great to hear about more aggression!

    Copied from my report in the version thread:

    "What helped me was also that the world never banded together against me even when I clearly pulled ahead. Russia and Egypt only declared war on me once in Medieval era, China in the Renaissance, and only Carthage and Mongolia declared on me later (due to bribes, but never mounted a serious attack). I was DoW-ed quite a few times in the Classical era, but never really faced a big army or navy. They never proposed sanctions on me, Siam never broke its DoF with me, they all (even after denouncing it) were happily selling me luxuries for around 10 gpt. The game could have been harder if there was a big runaway, but even then I'd be confident in winning because of the AIs passivity in religion and banding together against the leader. I also don't know what the AI is doing about counter-spying, but I didn't lose a single spy in this game (which was helped because I avoided spying on rationalism civs)."

    I understand the limitations of code and other factors, so I'm grateful for any improvement that can be done. Thanks!
     
    vyyt likes this.
  2. Zanteogo

    Zanteogo Prince

    Joined:
    Nov 13, 2015
    Messages:
    566
    (I haven't read any of the posts between the first land last.. apologies if this has been covered)

    One pet peve I have with the diplomatic AI is that way too often a trade is "impossible". Even if the trade is clearly better for the AI, "impossible". I've noticed and posted in the beta thread that the AI will even find trading it's cities back to them.. for free.. "impossible".

    It honestly seems off.. and "unfun". That the AI will just not have a price for deals that clearly will help them or even for deals that are neutral to them..
     
  3. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    This is actually the deal AI, not the diplomacy AI - but I do intend on working on that too as it's a diplomacy mechanic.

    I intend to reduce the number of "IMPOSSIBLE" deals and generally make significant improvements to deal logic; this will take some time, however.
     
  4. ryanmusante

    ryanmusante Regular Supporter

    Joined:
    Jan 4, 2018
    Messages:
    1,087
    Like no zero value trade items by default.
    Code:
                <Where Name="AI_NO_ZERO_VALUE_TRADE_ITEMS"/>
                <Set Value="1"/>
     
    vyyt likes this.
  5. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    7,031
    Location:
    Malaga (Spain)
    From the changelog you have published in the current beta thread.

    Maybe just counting cities is not the right metric. There are two problems with this.
    1. The map could just be very empty. Usually we have room for settling 8-9 cities per player, but we can play on more space scarce maps, or the opposite. This means that maybe having 2 more cities than your neighbour is less an issue in more empty maps. Instead of fixed numbers, you could use relative values so it can adapt to whatever we might be playing. The AI could, for example, be concerned every 10% more cities the other civ has.
    2. Tall civs may not have that many cities, but can cover a lot of territory. A wide civ typically settles every 3 tiles. This makes the civ quite strong very early, making conquering easier in Classical/Medieval. A tall civ can settle anywhere from 5 to 6 tiles and still claim the territory, it just takes a little longer. What I mean is that maybe claimed territory should be included in this evaluation. Or perhaps claimed territory as observed by the AI.
     
  6. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    You need to meet 3 conditions:
    - More cities than the other AI
    - Your city count is at least 2x the global average of major civs
    - Military strength compared to the other AI is less than AVERAGE

    It's specifically meant to punish the cheesy strategy of expanding/conquering everywhere without leaving adequate defenses in place.

    Your idea does have merit, though, and it is possible to count the amount of land the player has...you can view it in the score calculation...

    I could implement this, but I'm not sure what a fair metric would be. 2x the number of global average plots might be too punishing. And wide civs settling every 3 tiles would cover a lot of land too.
     
    JamesNinelives likes this.
  7. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    7,031
    Location:
    Malaga (Spain)
    I'm not suggesting you to do exactly this, you are doing a fine work. But I want you to be aware of the issue in case you can do something about it before getting too committed to a solution. Whenever I show something to Gazebo, he almost always find a creative solution on his own, if he deem that is a problem worth addressing.

    Wide civs settling every 3 tiles cover a lot of land if they settle many cities. Otherwise, tall civs with the same number of cities just cover more land. See this as a human player. Who will pose a bigger threat to you? A civ with many cities? A civs that has covered too much land? A mix of both things?
     
    Maxxim69 and JamesNinelives like this.
  8. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    Well, as I changed the wording from "They believe we are building new cities too aggressively!" to the suitably inclusive "They believe we are expanding our empire too aggressively!" this could work; I'd have the reckless expansion flag check for "too many cities OR too much land".

    I'm just wondering how many owned plots would be excessive compared to the global average, without resulting in the AI being stupidly aggressive (keeping in mind there are things like Ancient Ruins or Events that can result in a bunch of early land). It does make sense that the AI would focus fire on a widespread empire with poor military defenses, even with a low city count.

    Any thoughts on what a fair ratio could be? It's currently 200% for cities.
     
    JamesNinelives likes this.
  9. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    Is that not the default?
     
  10. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    830
    Gender:
    Male
    I think the Shoshone will get ganged up on super early if the ratio is too low, and @JamesNinelives won't like it.
     
    JamesNinelives likes this.
  11. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,188
    Gender:
    Male
    Location:
    Australia
    I play a difficulty higher when I play Shoshone, so I don't mind a challenge XD. It might hit the Shoshone AI pretty hard though, which would be sad. And I do love territory whoever I play (e.g. try to build Angkor Wat and Forbidden Palace).

    I don't know what an appropriate ratio would be (maybe 250%), but I'm happy to playtest and find out :).
     
  12. Aenigmata

    Aenigmata Chieftain

    Joined:
    Mar 15, 2020
    Messages:
    11
    I was going over the Diplo Type changes posted in the beta thread and it sounds great! I'm not knowledgeable on how the current 'victory competitiveness' score works for the AI, but I dislike that it doesn't seem to kick in till later in the game and overall doesn't feel very effective in what it aims to accomplish. Diplo types sounds like a much needed expansion on this type of behavior. Kind of makes you wonder why it wasn't in the game to begin with but hey..

    A tiny concern though

    Cultural - While more than a few wonders take the forefront in tourism generation and at least a handful should be required, many wonders don't and should actually be avoided due to the scaling cost. Cultural GP's play a big factor as well and great people overall are in a similar boat as wonders in their lead-up to a historic event. And they don't suffer from less is more. Then again there's about dozens of other ways to get tourism but wonders are it's pinnacle (not to mention easier to quantify) so.. I guess what I'm really saying here is Wonder competition should do it's job, but that the wonder spamming -diplo modifier should be about 10x it's current value, great nonetheless :goodjob:

    However! I have to wonder how this plays with civs like France & Japan who yeah, rely a lot on those fantastical great people but also effectively bypass these diplo penalties because conquering is the best way to do everything, and conquered wonders are a competition you lost out on and (now) don't count towards wonder spam? A Cultural civ still may not seem them as a threat via 'strategically placed war declarations' when in fact they are probably the biggest.
     
  13. Zuizgond

    Zuizgond Prince

    Joined:
    Oct 24, 2016
    Messages:
    493
    Sorry if it is not the right thread to ask this, but does the "You are competing for World Wonders" modifier decays over time? I built 5 wonders and almost all civs have between -60 and -100 against me now. Needless to say I am in a perma-war since then.
     
    Recursive likes this.
  14. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    It shouldn't be possible to have 60-100 penalty for that modifier - are you combining it with the "They believe we are building World Wonders too aggressively!" modifier?

    Neither of them decay over time, but the second one will fade if you let other civs build more Wonders.

    If the threshold (3 Wonders above the average of Wonder building civs) is too aggressive you can adjust the threshold value in DiploOpinionWeights.sql.
     
    JamesNinelives likes this.
  15. Zuizgond

    Zuizgond Prince

    Joined:
    Oct 24, 2016
    Messages:
    493
    Yes right it was "They believe we are building World Wonders too aggressively", sorry.

    I guess I'll focus a bit less on wonders then. Thanks!
     
    JamesNinelives likes this.
  16. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    The wonder spamming modifier applies to all civs, it's just larger for cultural civs (for Tourism competition) and warmonger civs (who see a juicy target full of Wonders they don't have to construct themselves).

    Cultural civs, beginning in the Renaissance era, are more responsive to Influence levels as well when selecting their approach - both yours and theirs.
     
  17. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    830
    Gender:
    Male
    Two things in 3-1 version early game (not sure how much was changed in 3-15):

    1. As noticed by lots of other people, the AIs are way too passive and completely ignore my lack of army. All 3 civs that I've found are now friends with me, and I'm just building wonder after wonder.
    2. I declared war on Persia for a CS quest, and only sent a scout to pillage his luxuries and horses. He tried to chase my scout, but didn't send anything towards my territory. (To be fair Ethiopia was between us.) After eventually making peace, he sent a DoF request 2 turns later, despite I'm friends with his enemy Ethiopia.
     
  18. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    Both of these should be better in 3-15.

    Also, had an "aha" moment - the reckless expander calculation was accidentally factoring dead players into the global average, bringing it down.

    I'm looking at tweaking reckless expander and wonder spammer mods by having them consider the median values rather than the averages (or in addition to the averages).
     
    vyyt likes this.
  19. SilentReply

    SilentReply Chieftain

    Joined:
    Jan 13, 2020
    Messages:
    55
    Gender:
    Male
    Is the wonder spam penalty a flat penalty or does it scale with how far above the mean? I tried out a Deity game on the 3-1 beta and had a Morocco runaway - just as some others have reported. They entered modern era turn 220 and had >20 wonders and still churning them out if I remember correctly, yet there had been little backlash from the other AI's besides a few denouncements.
     
  20. Recursive

    Recursive Emperor

    Joined:
    Dec 19, 2017
    Messages:
    1,572
    Gender:
    Male
    The opinion penalty scales, the approach penalty does not (yet).
     

Share This Page