Another error affecting AI (Medieval error)

Discussion in 'Civ6 - General Discussions' started by FearSunn, Mar 20, 2018.

  1. FearSunn

    FearSunn Warlord

    Joined:
    Dec 10, 2017
    Messages:
    277
    Gender:
    Male
    There is an error in game code where AI Strategy Medieval Changes requires wrong era condition - Classical instead of Medieval era.

    Due to this error AI Medieval Strategy preferences is now not working in the base game. Instead all Medieval era priorities stack together with Classical era priorities and as a result AI follows some mixture of both during Classical era and no specific strategy during Medieval era.

    File error is in Victories.xml
    Code:
    <Row StrategyType="STRATEGY_CLASSICAL_CHANGES" ConditionFunction="Is Classical"/>
    <Row StrategyType="STRATEGY_CLASSICAL_CHANGES" ConditionFunction="Is Not Major" Disqualifier="true"/>
    <Row StrategyType="STRATEGY_MEDIEVAL_CHANGES" ConditionFunction="Is Classical"/>
    <Row StrategyType="STRATEGY_MEDIEVAL_CHANGES" ConditionFunction="Is Not Major" Disqualifier="true"/>

    I've already fixed this error with this mod:
    https://forums.civfanatics.com/resources/ai-strategy-conditions-fix.26760/
    Steam:
    http://steamcommunity.com/sharedfiles/filedetails/?id=1333457772
     
    Last edited: Mar 20, 2018
  2. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,959
    Gender:
    Male
    Thanks for letting us know about this!
     
  3. Stringer1313

    Stringer1313 Emperor

    Joined:
    Sep 10, 2014
    Messages:
    1,134
    Whew... can someone translate into plain English what the implications of this change are?
     
    Tech Osen and jddods like this.
  4. kaspergm

    kaspergm Deity

    Joined:
    Aug 19, 2012
    Messages:
    5,254
    This seems quite clear?
     
  5. craney1987

    craney1987 Warlord

    Joined:
    Nov 14, 2016
    Messages:
    234
    Gender:
    Male
    Is this vanilla and r&f?
    Do you think it's been affecting the game from day 1 or only recent?
    How has AI behaviour changed in your mod?
     
  6. FearSunn

    FearSunn Warlord

    Joined:
    Dec 10, 2017
    Messages:
    277
    Gender:
    Male
    Specific numbers (dont know how post tables here...)

    STRATEGY_CLASSICAL_CHANGES
    Food 15
    Gold 20
    Science 10
    Faith 20
    GPP_Merchant 20

    STRATEGY_MEDIEVAL_CHANGES
    Food 25
    Production 20
    Gold 15
    Faith -25
    Culture 10
    GPP_Merchant 20
    GPP_Engineer 20
    GPP_Scientist 30

    RESULT:
    (Mixture during Classical Era)
    Food 40 (instead of 15)
    Production 20 (0)
    Gold 35 (20)
    Faith -5 (20)
    Culture 10 (0)
    GPP_Merchant 40 (20)
    GPP_Engineer 20 (0)
    GPP_Scientist 30 (0)

    But the bigger problem is that during Medieval era strategy modifiers are not applied at all.
    And for example instead of nerfing Religion by -25 it is now actually boost it by +5 in comparison with previous era.
     
    Last edited: Mar 20, 2018
  7. FearSunn

    FearSunn Warlord

    Joined:
    Dec 10, 2017
    Messages:
    277
    Gender:
    Male
    I know exactly when this error appeared - with 2017 Autumn patch.
    And it is still here with RF.
     
    craney1987 likes this.
  8. Toofou

    Toofou Chieftain

    Joined:
    Feb 8, 2018
    Messages:
    10
    Gender:
    Male
    Maybe obvious but better asking ;) Does the fix consists in putting "Is Medieval" instead ?
     
  9. chazzycat

    chazzycat Deity

    Joined:
    Oct 13, 2010
    Messages:
    2,918
    Trying to make sense of this, but I feel like I'm missing something. Is my interpretation of the results below correct?

    1) ancient era, no faith modifiers at all? (as should be)
    2) classical era, -5 faith modifier (should be 20, difference of -25 from intended)
    3) medieval era, no modifiers at all (should be -5, difference of +5 from intended)
     
  10. WillowBrook

    WillowBrook Lurker

    Joined:
    Sep 12, 2004
    Messages:
    3,453
    Location:
    Chicagoland
    Not at all. What does it mean for the AI to have a strategy, regardless of era? Is it trying to achieve these yields per turn? Are these bonuses to the AI?
     
  11. Stringer1313

    Stringer1313 Emperor

    Joined:
    Sep 10, 2014
    Messages:
    1,134
    No I mean an explanation like: What this means is, whereas before, the AI would do X during __________ era. With this fix, the AI should do Y during _________ era. I would love for someone to explain X and Y in plain English.
     
    WillowBrook and MaryKB like this.
  12. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,959
    Gender:
    Male
    To put this issue in context, I suggest you review this thread first: https://forums.civfanatics.com/threads/typo-affecting-ai-yields.630239/

    The modifiers listed above appear to be era-specific adjustments to these "basic" yield weightings discussed above.

    The numbers aren't absolute, they're relative. So if the combined factor for Food is 40 and the combined factor for Production is 20, then the AI is expected to prefer to generate Food yields rather than Production yields. How much more it prefers them, I don't know. My (pure guess) is that it would multiply the possible Food yield by 140% and the possible Production yield by 120% and then compare before deciding, but that is just a guess.

    Critically, the base modifiers from the thread above are believed to affect AI decision making only when deciding which of multiple possible buildings to produce, and not affect their choice of districts to build, choice of improvements to place with Builders, or choice of which tiles to have their population work. That's the base modifiers. Whether these era-specific modifiers apply in only this one situation or also affect other AI decisions, I do not know.

    EDIT: Here's a table showing the current relative values and what they "should be" if both the Medieval and "Yeild" errors were corrected. In the Classical Era, often the two errors offset each other. It's the Medieval era where the two errors could be expected to have the biggest effect:

    Classical Medieval
    Now Should Be Now Should Be
    Food 40 15 0 25
    Production 20 25 0 45
    Gold 35 40 0 35
    Faith -5 -5 0 -50
    Culture 10 10 0 20
    Science 10 20 0 10

    EDIT #2: Shoot. Thought I had that formatted to display right, but obviously not.
     
    Last edited: Mar 20, 2018
  13. 54teltakt

    54teltakt Chieftain

    Joined:
    Aug 1, 2017
    Messages:
    23
    table attached

     

    Attached Files:

    • civ.jpg
      civ.jpg
      File size:
      75.9 KB
      Views:
      1,532
    PeterChu, Turrdy and Trav'ling Canuck like this.
  14. Cagarustus

    Cagarustus Prince

    Joined:
    Mar 9, 2017
    Messages:
    386
    So, does this make the AI more challenging?
     
  15. FearSunn

    FearSunn Warlord

    Joined:
    Dec 10, 2017
    Messages:
    277
    Gender:
    Male
    Let me try to explain a little bit how strategic AI works.

    On strategic level (not tactical and not operational) AI follows predefined "grand" strategies. There are 13 AI strategies in total (4 victory strategies and 9 grand strategies):

    "VICTORY_STRATEGY_CULTURAL_VICTORY"
    "VICTORY_STRATEGY_MILITARY_VICTORY"
    "VICTORY_STRATEGY_RELIGIOUS_VICTORY"
    "VICTORY_STRATEGY_SCIENCE_VICTORY"
    "STRATEGY_EARLY_EXPLORATION"
    "STRATEGY_RAPID_EXPANSION"
    "STRATEGY_NAVAL"
    "STRATEGY_CLASSICAL_CHANGES"
    "STRATEGY_MEDIEVAL_CHANGES"
    "STRATEGY_RENAISSANCE_CHANGES"
    "STRATEGY_INDUSTRIAL_CHANGES"
    "STRATEGY_MODERN_CHANGES"
    "STRATEGY_DARKAGE"

    For each strategy to start (or to stop) AI checks against certain predefined conditions listed in StartegyConditions table. For example for AI to start following Early Exploration strategy it should have "Fewer Cities". For Naval Strategy condition "Is On Island" should be satisfied and so on.

    After AI starts following certain strategy Strategy_Priorities table kick in. It contains so called ListTypes where all necessary changes to AI behavior are listed.

    Lets take strategy "Medieval Changes". This strategy has 3 ListTypes associated with it:
    MedievalYields
    MedievalPseudoYields
    MedievalSensitivity

    Specific changes to AI behavior are predefined in AiFavoredItems table where each this list sets certain specific changes to AI behavior.
    MedievalPseudoYields for example makes AI to favor more some GreatPerson types (Engineer, Merchant and Scientist). Where MedievalYields encourage AI to favor food, gold and production and nerfs religion.

    In Victories.xml author of the code explained it with following comment line:
    <!-- The AI will increase or decrease the value of these yields while running the appropriate strategy -->

    This is actually all we know at the moment about this yields impact on AI.
    Exact calculations and formulas are not available for general public at the moment.
     
    Noble Zarkon, Spicer, Bosque and 6 others like this.
  16. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,959
    Gender:
    Male
    Thanks for the clear explanation, FearSunn. Very helpful!!

    Since these modifiers are called "CHANGES" and described by an "ERA" name, I would assume that these modify rather than replace the yield preferences of the other strategies. In other words, regardless of what other Strategy the AI is currently following, it will also apply the Medieval_Changes preferences if in the Medieval era (or in the Classical era, as currently written in the code.) This would also be consistent with the ConditionFunction="Is Not Major" Disqualifier="true" line, which may be saying that this is not a major strategy (replacing other major strategies), but an additive one.
     
  17. FearSunn

    FearSunn Warlord

    Joined:
    Dec 10, 2017
    Messages:
    277
    Gender:
    Male
    Right!

    Wrong!
    ConditionFunction="Is Not Major" Disqualifier="true" means this strategy applies only to Major civs and not to CityStates or FreeCities.
     
    Trav'ling Canuck and PeterChu like this.
  18. Stringer1313

    Stringer1313 Emperor

    Joined:
    Sep 10, 2014
    Messages:
    1,134
    Thanks all. So my oversimplified interpretation of this is -- Whereas before, the AI would not really make any modifications to its grand strategy in the Medieval Era (all zeros), now the AI will boost its prioritization of production (45) and gold (35) and deprioritize faith (-50) in the Medieval era. And whereas before, the AI's modifications to its grand strategy in the Classical Era more strongly emphasized food (40) and gold (35) , now the AI will more strongly emphasize gold (40) mainly in Classical Era.

    Does that sound right?
     
  19. Trav'ling Canuck

    Trav'ling Canuck Deity

    Joined:
    Feb 7, 2018
    Messages:
    2,959
    Gender:
    Male
    If these two errors are corrected in the next patch, yes. I believe they've confirmed they will fix the "YEILD" error. I don't think they've said (nor would I expect them to) whether they will also deal with this Medieval issue. They may well not, as their prioritization of what things to fix in the code is often no more transparent than the AI's decision making tree. They may be too busy nerfing England again to deal with this line of code :)
     
  20. Xur

    Xur Prince

    Joined:
    Sep 13, 2016
    Messages:
    448
    I really dont understand why Firaxis sticks to the quarterly patch and claiming that it is better (testing/quality etc). I'd understand it if these silly errors weren't present. This isn't a bug you'd find by playtesting (I assume). I'd much rather have hotfixes instead of needing a ton of mods to fix the game. I am honestly put off playing now...
     

Share This Page