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

Typo Affecting AI Yields

Discussion in 'Civ6 - General Discussions' started by isau, Mar 15, 2018.

  1. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,932
    Gender:
    Male
    Hmmm, so in that context, let's look at the yield modifications that are meant to be in place and presumably will start to have effect once this is corrected:

    Production +25: the AI will make more Industrial Zones and be better able to produce stuff. The "best" Civ players eschew IZ's except for possibly one central one. The AI will likely be able to recognize the best place to put an IZ if it has already built mines, but if it hasn't built mines yet may put the IZ in the wrong place. And the most critical factor is I doubt the AI will recognize that it should build an IZ in a central city to subsequently benefit from a Factory. So expect lots of relatively inefficient IZs/Workshops, but if you play slow the AI may have bigger armies and get more districts out in total.

    Gold +20: Lower than production, but what does it use for a relative weighting? 2:1? i.e. would it normally consider 2 gold equal to 1 production before this factor, or 1 gold equal to 1 production? If the base is 1:1, then this is likely fine. If the base is 2:1, then it means a relative preference for local production over centralized buying power. I'd argue that Gold is more valuable than Production for a human, but the AI tends to like to trade it's Gold away, so maybe it's best if the AI sticks to local production.

    Science +10/Culture +10: Uh oh. This is a lower weighting than either Production or Gold. Campuses usually come before IZs and CH's, so the AI may be more likely to get one out early, which would help, but afterwards this seems to lend a bias towards building what you know now versus investing in the future. Which if it makes the AI better to defend itself and to maintain it's early start bonuses, may be okay. The longer the game goes on, though, the more underweighting science/culture versus production/gold may hurt the AI.

    Faith -25: Good for most civs. May lead to more early Campuses, fewer early Holy Sites. What will this do to religion-oriented civs? Crimp them, or help them by making them more balanced?
     
    Last edited: Mar 16, 2018
    SammyKhalifa likes this.
  2. acluewithout

    acluewithout Deity

    Joined:
    Dec 1, 2017
    Messages:
    3,361
    If the AI prioritises Production, does that mean it'll build more mines?
     
  3. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,932
    Gender:
    Male
    I assume so. Or at least earlier.

    Since the Food modifier is 0, the AI may now prioritize every yield except Faith higher than Food.

    That may cut down on the Farm-spamming the AI loves, but no guarantee. If it has a Builder and no other tiles to improve, it may still build Farms on every plains and grassland tile. But it may be somewhat more inclined to build Mines and Lumber Mills first, before Farms.
     
  4. bite

    bite Unofficial Civilization Cartographer Moderator

    Joined:
    Jun 20, 2004
    Messages:
    4,298
    this is why I could never be a coder
     
    craney1987, Tech Osen and Victoria like this.
  5. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    The yield values actually seem to have very little impact on improvement picks. I'm not entirely sure why, but while trying to get gilgamesh to stop building ziggurats, even insanely high values (+10000 on food etc.) didn't seem to affect whether he build them.

    And when it comes to districts, I've had much more success tweaking their desires by changing the great person point pseudoyields than I have with changing the yield values (possibly because the districts themselves have no yields). The yield values seem to mostly affect building choices, but on higher difficulties they usually get them all pretty fast anyway. It may also be using them for policy/belief choices, but I haven't extensively tested that.
     
    Art Morte and PYITE like this.
  6. PYITE

    PYITE Prince

    Joined:
    Dec 14, 2016
    Messages:
    392
    Gender:
    Male
    That is exactly what I have seen as well when doing tests.

    I think I have had success making the AI build more mines by putting mines in an AI preference list for improvements. I put it in the major.xml file so it affects all major civs.
     
    Siesta Guru likes this.
  7. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,932
    Gender:
    Male
    Hmmm. So it seems this particular set of modifiers is used exclusively/primarily for impacting production choices by cities? Then it really won't have much impact, since those choices are primarily dependent on the districts that have already been placed, i.e. the AI may now prefer to build a Workshop over a Shrine, but only if it has a choice between the two.

    Any sense of whether these modifiers also influence worker placement preferences? i.e. will this make it more likely that the AI puts people to work in a mine instead of Crater Lake for its 4 Faith? That may have a little bit more impact.
     
  8. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    Oh interesting, there's a system for improvements? I hadn't seen that in the base files



    No idea, haven't even seen a way to figure out which tiles are being worked. (It's probably possible through lua somehow)
    It could I suppose, but I'm suspicious since the system is probably the same system as the human players default citizen distribution system. It would be odd if that were affected by internal AI yield desires
     
    Last edited: Mar 17, 2018
  9. sonicmyst

    sonicmyst Emperor

    Joined:
    Aug 9, 2016
    Messages:
    1,236
    Location:
    Philippines
    I just got a new game playing against Germany. They expanded so quickly swallowing up Rome and Sumer. Im scared as s***.
     
    isau likes this.
  10. isau

    isau Deity

    Joined:
    Jan 15, 2007
    Messages:
    3,068

    I think you're probably right that the AI uses the same automated system as players. I wonder though if the AI also uses the "preferences" buttons. E.g. "I like Production so let's hit the max Production button." I haven't seen evidence the AI actually does this but since the code is basically there it wouldn't totally shock me. It would explain how the AI suddenly gets much less Faith when the YEILD typo is fixed even if the AI isn't making big changes in the Districts or Improvements it builds.
     
    Last edited: Mar 17, 2018
  11. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    It's possible. There's an <AiBuildSpecializations> thing in leaders.xml, which could be used for that. Additionally, it could be choosing policies differently, which would also have a big effect.
     
  12. SaMatra

    SaMatra Chieftain

    Joined:
    Sep 1, 2016
    Messages:
    47
    Tried the fix. Getting prophet on Deity is very easy now as many civs simply don't care about religion anymore. Also seen some insane GPP numbers, looks like they're really prioritizing now.
     
  13. Katakanja

    Katakanja Emperor

    Joined:
    Oct 17, 2016
    Messages:
    1,258
    Yes, that seems to be the main impact. There are enough civs that no longer bother generating any GPP at all that it's normally possible to grab a late prophet if you wish, unless you get unlucky and wind up in a game with Saladin + a stack of other religious-focused leaders.

    I wonder if that change from an earlier patch where they made certain leaders ignore religion is only now functioning correctly as a consequence of fixing the typo?
     
  14. Art Morte

    Art Morte Prince

    Joined:
    Jan 26, 2017
    Messages:
    494
    Gender:
    Male
    What a mess. I'll try the fix.
     
  15. Olleus

    Olleus Deity

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    England
    Does that mean that there were no foreign key checks in the AI sql schema? That seems like a hilariously stupid thing to not do.
     
  16. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    This particular field could refer to a lot of different things, yields, buildings, buildspecializations, victories, and lots more. They're all in different tables and many are initiated after these. So it makes some sense. It is strange though that they didn't think of logging anything when it can't find anything to match during execution (or that they somehow never checked the logs for months).
     
    Olleus likes this.
  17. UWHabs

    UWHabs Deity

    Joined:
    Oct 10, 2008
    Messages:
    4,454
    Location:
    Toronto
    XML loading always has a ton of junk with it, that it's very easy to simply ignore any tags that you don't recognize. The number of false positives you would get in a system this sized means it's very likely they would simply not bother logging errors.
     
  18. isau

    isau Deity

    Joined:
    Jan 15, 2007
    Messages:
    3,068
    I can see how they missed it. There are 523 entries in AIFavoredItems. Only some of them refer to a Yield. It would be crazy impressive if they somehow accounted for where all 523 of those references resolved.

    Also the spelling is correct in the section where they seem to be referring to the preference within specific eras. I assume these combine somehow with the defaults to determine final yields.

    upload_2018-3-18_21-15-54.png

    The only section that is messed up is the "default" one.



    There's at least one other system that behaves similarly without any checks: the Value field on the ModifierArguments table. That one is spectacularly easy to flub. I haven't caught any errors on Firaxis' part there yet (maybe they have a better system than modders do to spot check it?) but it's another area where references are not enforced. In some cases, such as putting a Value of a Modifier that does not exist into the ModifierArgument of a ATTACH Modifier, you can actually cause the game to crash to desktop without reporting anything wrong in the data. Just how it goes with some large datasets.
     
  19. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,932
    Gender:
    Male
    I'm pleased to see the Victory and leader-specific modifiers. It suggests some specialization that should improve the AI's ability to win and differentiate civ behaviours.

    Although if all these do is affect production preferences and not district choices, improvement choices or worker placement, the impact would be muted.
     
  20. acluewithout

    acluewithout Deity

    Joined:
    Dec 1, 2017
    Messages:
    3,361
    I am reading this all with considerable interest. Hopefully catching and fixing this error will result in a more competitive AI.

    But it does leave me with another question: what exactly should the AI be doing?

    There are some very specific things I wish the AI would not do (prioritise religion, or build cities, districts or some wonders in bad spots) and a handful of very specific things I wish it would do (build its unique units, build cultural specific wonders). But otherwise I don't really know what specifically I should expect the AI to do other than just 'do things better'.

    e.g. Does the AI need to build more mines and IZs? Just build more troops overall, or a particular mix of troops?
     

Share This Page