Which file governs AI Difficulty bonuses?

Joined
Apr 11, 2015
Messages
438
I was thinking of making a custom difficulty level between Emperor and Immortal, but have been unable to locate the file that governs AI production/science bonuses etc.

The file that gives the AI extra units at different difficulty levels appears to be Eras.XML
 
Looks like it might be the Leaders.XML file.

These appear to be the lines specifically relating to the bonuses I'm after:
Code:
        <Row>
            <ModifierId>HIGH_DIFFICULTY_SCIENCE_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>8</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_SCIENCE_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_SCIENCE</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_CULTURE_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>8</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_CULTURE_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_CULTURE</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_PRODUCTION_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>20</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_PRODUCTION_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_PRODUCTION</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_GOLD_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>20</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_GOLD_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_GOLD</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_FAITH_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>8</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_FAITH_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_FAITH</Value>
        </Row>
I'm not certain, but my reading is that this means that at Default difficulty of Prince, the values are 0, and each difficulty level above increases it in scalar fashion by the amount specified.

Science: 8
Culture: 8
Production: 20
Gold: 20
Faith: 8

This would correlate with the table from the Wiki, which I've reproduced below:


Source: https://civilization.fandom.com/wiki/Difficulty_level_(Civ6)

The Wiki table shows these numbers as representing percentage points, although the XML file doesn't mention this. Will assume Wiki is correct on this.

So if I wanted the AI bonuses to be between Emperor and Immortal, I would want AI Science/Culture/
Faith bonuses at + 20 (%), and Production/Gold at + 50 (%). To affect this change, I would presumably change the <Extra></Extra> values of Science/Culture/Gold from 8 to 10, and the Production/Gold <Extra></Extra> values from 20 to 25.

Apart from the free starting Techs/Civics and units, what's left are the AI Combat and XP bonuses. The AI Combat bonus goes up by 1 each difficulty level. So, between Emperor and Immortal, it would be + 2.5. That would mean a scale value of 1.25, rather than 1. Not sure if the game could handle non-whole numbers, but I could test it out.
 
Check out Smoother Difficulty for guidance.
Thanks, I had a look at it. I'm using another mod - No AI Start Advantage - to remove bonus starting units and tech/civic boosts. The modifications I've made are calibrated to add a level between Emperor and Immortal, while the Smoother Difficulty mod adds extra levels at higher difficulties. The Smoother Difficulty mod does have one major difference - that "science and culture bonus for high difficulty AI increase with era" - so that will be something to consider.

With regard to the testing I did on the modifications I made, increasing AI Combat Bonus from a scale of 1 to a scale of 1.25 gave a combat bonus of +2.75 at level between Emperor and Immortal, rather than the intended +2.5, but I'm fine with that. I'm not sure how the game handles non-whole numbers, but the game didn't crash and it looked as if it was working when testing.
 
I haven't messed around with the difficulty scaling since the September patch, but if I recall correctly, for any of the yields (including Combat Strength), the "Value" for any "HIGH_DIFFICULTY_" ModifierId is given as a flat bonus if the AI is Prince or above. The "Extra" is multiplied by the amount of difficulty levels above Prince, with Prince still getting 1x of the Extra yield.

Prince: Value + Extra
King: Value + Extra*2
Emperor: Value + Extra*3
Immortal: Value + Extra*4
Deity: Value + Extra*5

The wiki is actually incorrect, as this means the AI does get some bonuses on Prince Difficulty. You can test this by going into a normal game on Prince difficulty with "Show Yields on HUD Ribbon" turned on in Options=>Interface. If the AI got 0% gold bonus, for example, then on Turn 2, the AI is expected to have 10+5 gold (10 starting gold + 5 GPT from palace), but it instead has 6, which is 20% more than expected. Likewise, on Deity, the AI gets 100% more Gold per turn instead of 80%.

In your case, on Emperor, if you left the default "HIGH_DIFFICULTY_COMBAT_SCALING" Value at -1, then you would get (-1)+1.25*3=2.75. Setting the "Value" to equal the negative of "Extra" at -1.5 would give you your intended +2.5 on Emperor, as well as cause the two to cancel each other out on Prince Difficulty to 0.
 
I haven't messed around with the difficulty scaling since the September patch, but if I recall correctly, for any of the yields (including Combat Strength), the "Value" for any "HIGH_DIFFICULTY_" ModifierId is given as a flat bonus if the AI is Prince or above. The "Extra" is multiplied by the amount of difficulty levels above Prince, with Prince still getting 1x of the Extra yield.

Prince: Value + Extra
King: Value + Extra*2
Emperor: Value + Extra*3
Immortal: Value + Extra*4
Deity: Value + Extra*5

The wiki is actually incorrect, as this means the AI does get some bonuses on Prince Difficulty. You can test this by going into a normal game on Prince difficulty with "Show Yields on HUD Ribbon" turned on in Options=>Interface. If the AI got 0% gold bonus, for example, then on Turn 2, the AI is expected to have 10+5 gold (10 starting gold + 5 GPT from palace), but it instead has 6, which is 20% more than expected. Likewise, on Deity, the AI gets 100% more Gold per turn instead of 80%.

In your case, on Emperor, if you left the default "HIGH_DIFFICULTY_COMBAT_SCALING" Value at -1, then you would get (-1)+1.25*3=2.75. Setting the "Value" to equal the negative of "Extra" at -1.5 would give you your intended +2.5 on Emperor, as well as cause the two to cancel each other out on Prince Difficulty to 0.
Thanks.

Regarding the Combat Scaling, if I have it set at 1.25, should the 'Value' not be changed from -1 to -1.25, rather than -1.5? If I set it at -1.5, would I not get an AI Combat Bonus of +2.25, rather than +2.5?

I've been playing a game with the settings outlined in this thread and it seems to have had the desired effect of making Emperor difficulty more difficult.
 
Looks like it might be the Leaders.XML file.

These appear to be the lines specifically relating to the bonuses I'm after:
Code:
        <Row>
            <ModifierId>HIGH_DIFFICULTY_SCIENCE_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>8</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_SCIENCE_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_SCIENCE</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_CULTURE_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>8</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_CULTURE_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_CULTURE</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_PRODUCTION_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>20</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_PRODUCTION_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_PRODUCTION</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_GOLD_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>20</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_GOLD_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_GOLD</Value>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_FAITH_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>8</Extra>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_FAITH_SCALING</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_FAITH</Value>
        </Row>
I'm not certain, but my reading is that this means that at Default difficulty of Prince, the values are 0, and each difficulty level above increases it in scalar fashion by the amount specified.

Science: 8
Culture: 8
Production: 20
Gold: 20
Faith: 8

This would correlate with the table from the Wiki, which I've reproduced below:


Source: https://civilization.fandom.com/wiki/Difficulty_level_(Civ6)

The Wiki table shows these numbers as representing percentage points, although the XML file doesn't mention this. Will assume Wiki is correct on this.

So if I wanted the AI bonuses to be between Emperor and Immortal, I would want AI Science/Culture/
Faith bonuses at + 20 (%), and Production/Gold at + 50 (%). To affect this change, I would presumably change the <Extra></Extra> values of Science/Culture/Gold from 8 to 10, and the Production/Gold <Extra></Extra> values from 20 to 25.

Apart from the free starting Techs/Civics and units, what's left are the AI Combat and XP bonuses. The AI Combat bonus goes up by 1 each difficulty level. So, between Emperor and Immortal, it would be + 2.5. That would mean a scale value of 1.25, rather than 1. Not sure if the game could handle non-whole numbers, but I could test it out.
how would i change the yeilds? what would i need to edit and where?
 
Top Bottom