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

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    Yeah, that is strange. @Recursive IMHO a civ shouldn't want to pass this resolution if the civ controls less than average of natural wonders. What do you think?
     
  2. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,219
    Gender:
    Male
    What if it would help an ally that's opposed to the civ's enemy? That's the issue with the World Congress..you can't just think about yourself. :)
     
    Carloshooter and JamesNinelives like this.
  3. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    Oh ok. I thought that AIs like this resolution no matter what.
     
  4. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,219
    Gender:
    Male
    I'm not sure, I still need to take a detailed look at voting logic. My point is just that it isn't quite that simple!
     
  5. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,577
    Gender:
    Male
    Location:
    Australia
    Yeah. I assume there's also 'does it help my enemy/enemies?' or something like that.
     
    Carloshooter likes this.
  6. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,219
    Gender:
    Male
    I looked at the logic for this and it's quite simplistic - it just checks how many World/Natural Wonders the player has.

    Code:
        // Cultural Heritage Sites
       if (pProposal->GetEffects()->iCulturePerWonder != 0)
       {
           int iNumWonders = GetPlayer()->GetNumWonders();
           int iTempScore = -50;
           if (iNumWonders > 0)
           {
               int iFactor = bSeekingCultureVictory ? 5 : 2;
               iTempScore += iNumWonders * iFactor;
           }
           iScore += iTempScore;
           iScore = MIN(70, iScore);
       }
       // Natural Heritage Sites
       if (pProposal->GetEffects()->iCulturePerNaturalWonder != 0)
       {
           int iNumNaturalWonders = GetPlayer()->GetNumNaturalWondersInOwnedPlots();
           int iTempScore = -35;
           if (iNumNaturalWonders > 0)
           {
               int iFactor = bSeekingCultureVictory ? 20 : 15;
    #if defined(MOD_BALANCE_CORE)
               if (MOD_BALANCE_CORE) {
                   iFactor = bSeekingCultureVictory ? 50 : 30;
               }
    #endif
               iTempScore += iNumNaturalWonders * iFactor;
           }
           iScore += iTempScore;
           iScore = MIN(70, iScore);
       }
    
     
    JamesNinelives likes this.
  7. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    Ok, so AI doesn't look at others for this proposal. It only counts how many World and Natural Wonders it has. Therefore AI could vote for it even if it would get the least from that, making its situation relatively worse. I would vote otherwise in that case.
     
  8. Carloshooter

    Carloshooter Chieftain

    Joined:
    Apr 5, 2015
    Messages:
    37
    Location:
    Portugal
    I think you're taking this too literally, usually i play with comunitas with all (8)civs in one big continent and another unexplored continent, so there are a lot of natural wonders sometimes we get to Modern Era and there are still 1/2 Natural Wonders to settle, what I mean is, it would be dumb if just because the AI doesn't have a NaturalW when the voting occurs doesn't mean it's smart to vote against it...
    If there are no more possible NaturalW to settle than it's only logical for the AI to vote against that if it doens't have any. That's my take on it :undecide:

    EDIT: I had a few ortographic mistakes ahah
     
  9. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,577
    Gender:
    Male
    Location:
    Australia
    Seems a bit of a niche situation. In games I've played if you have a natural wonder it's usually in your interest to vote for that resolution. Having more than one is kinda rare.
     
    vyyt and Carloshooter like this.
  10. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    What do you mean I take this code too literally? Should I read between the lines? It's not exactly a poem :D
    I'm not saying that AI should vote against that. AI shouldn't vote for it when it would benefit the least from that resolution, no? (It could vote for it just to improve relations with others, but it's not in the code that was pasted here)
    It's not rare at all at that stage, when some civs conquer territories. Also not only Natural Wonders count, but World Wonders too and disparity here is almost always.
     
    Carloshooter likes this.
  11. Recursive

    Recursive Covets Lands That You Currently Own Moderator

    Joined:
    Dec 19, 2017
    Messages:
    2,219
    Gender:
    Male
    I'll revise WC logic as part of my interaction rework.
     
  12. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,577
    Gender:
    Male
    Location:
    Australia
    Natural Wonders and World Wonders belong to different congress resolutions though?

    Looks like Recursive is looking into it anyway :).
     
    Carloshooter and CppMaster like this.
  13. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    Ok, you're right! My bad. Still, I don't consider having more than 1 Natural Wonder as a rare case.
     
  14. wobuffet

    wobuffet Barbarian

    Joined:
    Jun 27, 2011
    Messages:
    1,247
    Tend to agree. Theoretically the logic should overweight Civs who are rivals and/or who are winning the game.

    I always thought it was silly that everyone always loved the Natural Wonder resolution — although arguably there's a place for people-pleaser resolutions too, I guess.
     
    Carloshooter and CppMaster like this.
  15. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    If that's the intention then it's doing the job
     
    JamesNinelives likes this.
  16. JamesNinelives

    JamesNinelives Emperor

    Joined:
    Mar 16, 2019
    Messages:
    1,577
    Gender:
    Male
    Location:
    Australia
    I very much agree. Things like arts agreements and scholars in residence tend to be good for garnering (and bostlering) weaker allies :).
     
    Carloshooter and wobuffet like this.
  17. Carloshooter

    Carloshooter Chieftain

    Joined:
    Apr 5, 2015
    Messages:
    37
    Location:
    Portugal
    I thought you were talking about something else not the code ahah (sorry). The way you wrote it(or I read it) I understood that you wanted to say that they "needed" to vote against. I totally agree with you, they should not vote in favour of something that they would not benefit in any way, unless their vote is bought of course :thumbsup:
     
    JamesNinelives and CppMaster like this.
  18. wobuffet

    wobuffet Barbarian

    Joined:
    Jun 27, 2011
    Messages:
    1,247
    I think @CppMaster 's point is that if your yields increase by (say) 1% and every other player's benefits by 5%, then you don't actually "benefit" in the sense that Civ is a game where only one player can win.
     
    CppMaster and Carloshooter like this.
  19. InkAxis

    InkAxis Prince

    Joined:
    Feb 24, 2020
    Messages:
    380
    Gender:
    Male
    But if one of those civs that benefits a lot is your ally, then that would also change things. It seems even a fairly simple proposal is more complicated than it seems :crazyeye:.
     
    Carloshooter and JamesNinelives like this.
  20. CppMaster

    CppMaster Emperor

    Joined:
    Feb 13, 2018
    Messages:
    1,205
    Gender:
    Male
    Location:
    Poland
    Yeah, but does AI consider it? It's not evident from this code.
     

Share This Page