Help with XP/Promoting

Joined
Apr 11, 2015
Messages
438
With my "Tough AI" mod, I feel that maybe the human player's units are getting promoted faster than I would like.

The reason for this, I am presuming, is that because the AI units, with the mod, take less damage, through having increased AI Combat Strength, it therefore means that the human player's units need to attack the AI units more times to destroy them, which gives them more opportunities to gain XP.

I have been doing some analysis, having human Warrior units attack AI Warrior units with no other combat modifiers. The human unit/AI unit post-damage data in the table are presumed averages, which look to roughly correlate with actual observed combat results.

xI34mDk.png


The human unit received the same XP in battle at each difficulty level, 4XP, suggesting it is the quantity of battles that is affecting XP gain. XP in combat is calculated from Base Strength, not difficulty-modified total strength.

The final column in the table is the number of attacks it would take for an AI Warrior to be destroyed if it was attacked each time by a 100%-healthy human Warrior.

I think this might be a good scale to aim for. I play on Immortal with "Tough A.I." mod, so that would mean roughly halving the current rate of promoting at that level.

Any thoughts?

Now, I've got to try and figure out what is actually possible to do with the code.

ETA: The final column is the amount of damage a human Warrior can do to an AI Warrior, divided by 100 (Hit Points).

Prince: -33 = 3.03 attacks
King: -28 = 3.6 attacks
Emperor: -23 = 4.3 attacks
Immortal: -18 = 5.5 attacks
Deity: -13 = 7.7 attacks
 
Last edited:
Okay, I've had some success, I think.

I tried changing HIGH_DIFFICULTY_UNIT_XP_SCALING from affecting the AI to affecting the human player, and I set it at a negative number.

In a test I just did on Deity, the Warrior v Warrior only generated 1XP, rather than 4XP. So that could be calibrated to give the right effect.

There is an issue, though, in that it that the HIGH_DIFFICULTY_UNIT_XP_SCALING by default is used by the AI (to give them increased XP gain at higher difficulty levels). So I can create a new entry for the human, but both of them lead to the same Modifier, and the AI needs the Extra value to be positive, while the human player needs the Extra value to be negative.

So that means using one or the other, unless there's a way to create a separate HIGH_DIFFICULTY_UNIT_XP_SCALING Modifier, one for the human and one for the AI.

However, it may be okay and not necessary, because the AI will also be getting more XP due to the increased number of battles, just like the human player. So I think that HIGH_DIFFICULTY_UNIT_XP_SCALING for the AI player could be set the same as the human player, as a negative number.

It would effectively mean that the AI gets no bonus XP gain at high levels.

The counter to that, though, is that the effect of combat scaling is curved, not straight and would therefore be compensated that way. Tougher AI units are also more likely to survive battle.
4WD3wHQ.png
 
Here are the relevant bits of code in Leaders.XML
Code:
        <Row>
            <ModifierId>HIGH_DIFFICULTY_UNIT_XP_SCALING</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_EXPERIENCE_MODIFIER</ModifierType>
            <OwnerRequirementSetId>PLAYER_IS_HIGH_DIFFICULTY_AI</OwnerRequirementSetId>
        </Row>
        <Row>
            <ModifierId>LOW_DIFFICULTY_UNIT_XP_SCALING</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_EXPERIENCE_MODIFIER</ModifierType>
            <OwnerRequirementSetId>PLAYER_IS_LOW_DIFFICULTY_HUMAN</OwnerRequirementSetId>
        </Row>



        <Row>
            <ModifierId>HIGH_DIFFICULTY_UNIT_XP_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>10</Extra>
        </Row>
        <Row>
            <ModifierId>LOW_DIFFICULTY_UNIT_XP_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>-15</Extra>
            <SecondExtra>DIFFICULTY_PRINCE</SecondExtra>
        </Row>
I can get HIGH_DIFFICULTY_UNIT_XP_SCALING to work for the human player by changing owner requirement:
Code:
            <OwnerRequirementSetId>PLAYER_IS_HIGH_DIFFICULTY_HUMAN</OwnerRequirementSetId>
But that there's only one HIGH_DIFFICULTY_UNIT_XP_SCALING parameter.
 
Can I create a new ModifierId like this, by creating duplicates of the two bits of code, and changing the ModifierId name?
Code:
        <Row>
            <ModifierId>HIGH_DIFFICULTY_UNIT_XP_SCALING</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_EXPERIENCE_MODIFIER</ModifierType>
            <OwnerRequirementSetId>PLAYER_IS_HIGH_DIFFICULTY_AI</OwnerRequirementSetId>
        </Row>
        <Row>
            <ModifierId>HIGH_DIFFICULTY_UNIT_XP_SCALING_FOR_HYOOMAN</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_EXPERIENCE_MODIFIER</ModifierType>
            <OwnerRequirementSetId>PLAYER_IS_HIGH_DIFFICULTY_HUMAN</OwnerRequirementSetId>
        </Row>
 

       <Row>
            <ModifierId>HIGH_DIFFICULTY_UNIT_XP_SCALING</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>10</Extra>
        </Row>
       <Row>
            <ModifierId>HIGH_DIFFICULTY_UNIT_XP_SCALING_FOR_HYOOMAN</ModifierId>
            <Name>Amount</Name>
            <Type>LinearScaleFromDefaultHandicap</Type>
            <Value>0</Value>
            <Extra>-10</Extra>
        </Row>

ETA: Just thought of a complicating factor. If I set the AI's XP the same rate as the human player, then AI v AI wars will not produce as much XP. Not sure if AI bonus XP gain at higher difficulties is only gained when fighting against human player, or across the board.
 
Last edited:
Hopefully this is the right code. Bottom half is new, to recalibrate XP.

Code:
<GameInfo>
     <ModifierArguments>
        <Update>
            <Where ModifierId="HIGH_DIFFICULTY_COMBAT_SCALING"/>
            <Set Value="-5" Extra="5"/>
        </Update>
    </ModifierArguments>
    <TraitModifiers>
        <Row TraitType="MINOR_CIV_DEFAULT_TRAIT" ModifierId="HIGH_DIFFICULTY_COMBAT_SCALING"/>
        <Row TraitType="TRAIT_LEADER_BARBARIAN" ModifierId="HIGH_DIFFICULTY_COMBAT_SCALING"/>
    </TraitModifiers>
    <Modifiers>
        <Update>
            <Where ModifierId="HIGH_DIFFICULTY_UNIT_XP_SCALING"/>
            <Set OwnerRequirementSetId="PLAYER_IS_HIGH_DIFFICULTY_HUMAN"/>
        </Update>
    </Modifiers>
    <ModifierArguments>
        <Update>
            <Where ModifierId="HIGH_DIFFICULTY_UNIT_XP_SCALING"/>
            <Set Value="0" Extra="-15"/>
        </Update>
    </ModifierArguments>
</GameInfo>
 
I was up all night working on and testing XP scaling.

Here's my eventual table:

jO4x9Ap.png


Due to rounding of numbers, there isn't a perfect fit.

XP scaling has been applied to the human player of -15% per difficulty level.
 
Back
Top Bottom