Editing the DifficultyMod

Dawnpromise

Prince
Joined
Oct 4, 2016
Messages
422
I've finally decided to edit the DifficultyMod located in CBO BalanceChanges/Difficulty folder in the interest of tweaking minor aspects of the AI difficulty to my liking. Since I have little to no idea what I'm doing I'm just going document what in here so someone can tell me what I'm doing wrong and hopefully anyone else who's interesting in mucking with the difficulty settings can learn from my example/mistakes.

Always remember to make a backup copy before changing anything!

They've got the difficulties fairly clearly labeled in here but I'm unclear what HANDICAP_AI_DEFAULT refers to. I'm guessing it's the base handicaps the AI plays by when the difficulty setting doesn't override it.

No idea what StartingLocPercent or AdvancedStartPointsMod mean so I'm not touching that.

HappinessDefault I'm going to guess means the base happiness civs get at the start of the game.

NumCitiesUnhappinessMod and PopulationUnhappinessMod I'm guessing the is percentage of Unhappiness gained from # of cities and population respectively. I'll assume 100 means you get the normal rate unhappiness while higher numbers increase unhappiness and lower numbers decrease it.

Gold and GoldFreeUnits I'm going to guess refers to starting gold and maintenance free units.

The ProductionFreeUnits section I have no idea what it's referring to. Not touching.

The CostPercent section I guess is a percent scaler of how much of production or gold is required to produce a unit or building. Not sure what RouteCost percent means though.

ResearchPercent and PolicyPercent refers to how much of a science or culture discount the AI gets I assume.

ImprovementCostPercent is how fast workers improve tiles.

The NumOptionsConsidered section is for how many options go onto the AI's decision roulette starting with what is considered most optimal by the AI in descending order, right? I think G mentioned this somewhere before.

AttitudeChange no idea. Diplomatic modifier maybe?

NoTechTradeModifier I'm guessing determines how hesitant the AI is to trade techs when tech trading is enabled.

Whole section of Barbarian stuff here ranging from CS bonuses to how early they get loosed to pillage stuff and how far they'll go in search of stuff to pillage and even how much gold you get for clearing a camp.

AIDeclareWarProb is how likely an AI likely to commit to declaring war when it thinks it's a good idea. Higher numbers make it more likely.

Lot of AI specific details in the next section which I guess refer mostly to it's handicaps in reduced Unhappiness as well as it's Growth and Production bonuses based on percentage bonus.

AIUnitSupplyPercent this MIGHT be what I came in here looking for. I think this refers to how much free supply the AI gets towards the supply cap. If I set this to 0 will that mean the AI will have to play by the same supply cap rules as the player?

AIFreeXP I guess is bonus XP the AI units get upon creation.

No idea what AIInflationPercent does or AIPerEraModifier or DifficultyBonus

Also I'm assuming the various AIStartingUnits refers to the additional Units AI players get at the start of the game?

I think that's all I can figure out for now. Hopefully someone can clarify what I'm messing with here.
 
They've got the difficulties fairly clearly labeled in here but I'm unclear what HANDICAP_AI_DEFAULT refers to. I'm guessing it's the base handicaps the AI plays by when the difficulty setting doesn't override it.
That's mostly the idea. An AI is considered as a "playing at difficulty 'AI_DEFAULT' " when it is needed. For exemple, the difficulty you chose determine your starting happiness, but does not say anything about AI's happiness, values in 'AI_DEFAULT' are used for that.

No idea what StartingLocPercent or AdvancedStartPointsMod mean so I'm not touching that.
Don't know the exact formulas, but it is here to make sure that the AI does not have an unlucky start. The player can (and will) start a new game if the game is lost, the AI does not have this opportunity.
The bigger those numbers are, the better will be the starting positions of the civilisations.

HappinessDefault I'm going to guess means the base happiness civs get at the start of the game.

NumCitiesUnhappinessMod and PopulationUnhappinessMod I'm guessing the is percentage of Unhappiness gained from # of cities and population respectively. I'll assume 100 means you get the normal rate unhappiness while higher numbers increase unhappiness and lower numbers decrease it.

Gold and GoldFreeUnits I'm going to guess refers to starting gold and maintenance free units.
Correct
The ProductionFreeUnits section I have no idea what it's referring to. Not touching.
I think it is a base supply cap, but not sure about that.

The CostPercent section I guess is a percent scaler of how much of production or gold is required to produce a unit or building. Not sure what RouteCost percent means though.
Route cost is for maintenance. I think the others are for maintenance too.

ResearchPercent and PolicyPercent refers to how much of a science or culture discount the AI gets I assume.

ImprovementCostPercent is how fast workers improve tiles.
Correct

The NumOptionsConsidered section is for how many options go onto the AI's decision roulette starting with what is considered most optimal by the AI in descending order, right? I think G mentioned this somewhere before.
I'm not sure it works. The value is always 3, while it should scale with difficulty. G should confirm this point.

AttitudeChange no idea. Diplomatic modifier maybe?
Depreciated. G confirmed that this parameter was no longer used.

NoTechTradeModifier I'm guessing determines how hesitant the AI is to trade techs when tech trading is enabled.

Whole section of Barbarian stuff here ranging from CS bonuses to how early they get loosed to pillage stuff and how far they'll go in search of stuff to pillage and even how much gold you get for clearing a camp.

AIDeclareWarProb is how likely an AI likely to commit to declaring war when it thinks it's a good idea. Higher numbers make it more likely.

Lot of AI specific details in the next section which I guess refer mostly to it's handicaps in reduced Unhappiness as well as it's Growth and Production bonuses based on percentage bonus.
Correct. As a remark, you can see that the AI does not have any discount on World Wonders.

AIUnitSupplyPercent this MIGHT be what I came in here looking for. I think this refers to how much free supply the AI gets towards the supply cap. If I set this to 0 will that mean the AI will have to play by the same supply cap rules as the player?
Don't know

AIFreeXP I guess is bonus XP the AI units get upon creation.
Correct

No idea what AIInflationPercent does or AIPerEraModifier or DifficultyBonus
AIInflactionPercent is depreciated and has no effect.
AIPerEraModifer correspond to bonses the AI win at each change of era. (Goal is no spread AI bonuses on the game.
Don't know for DifficultyBonus

Also I'm assuming the various AIStartingUnits refers to the additional Units AI players get at the start of the game?
Correct
 
That's mostly the idea. An AI is considered as a "playing at difficulty 'AI_DEFAULT' " when it is needed. For exemple, the difficulty you chose determine your starting happiness, but does not say anything about AI's happiness, values in 'AI_DEFAULT' are used for that.


Don't know the exact formulas, but it is here to make sure that the AI does not have an unlucky start. The player can (and will) start a new game if the game is lost, the AI does not have this opportunity.
The bigger those numbers are, the better will be the starting positions of the civilisations.


Correct

I think it is a base supply cap, but not sure about that.


Route cost is for maintenance. I think the others are for maintenance too.


Correct


I'm not sure it works. The value is always 3, while it should scale with difficulty. G should confirm this point.


Depreciated. G confirmed that this parameter was no longer used.


Correct. As a remark, you can see that the AI does not have any discount on World Wonders.


Don't know


Correct


AIInflactionPercent is depreciated and has no effect.
AIPerEraModifer correspond to bonses the AI win at each change of era. (Goal is no spread AI bonuses on the game.
Don't know for DifficultyBonus


Correct

Thanks for the clarification. Mostly I'm just trying to make the AI play by the same supply cap rules as the player without hampering their other handicaps. I know the AI needs handicaps to play properly but the mass unit warfare is just boring. I wonder which is more important to the AI's military play: FreeXP or FreeSupply?
 
Balance is made around king difficulty, so unless you go under king values, the AI will be able to play correctly.

FreeXP is here to compensate the fact that the AI is not able to prioritize correctly the survival of its strongest units. So if you delete it, you will basically never encounter logistics or range enemies. However the high difficulty XP bonus is pretty stupid, so reducing it is not a problem. Putting a lot of free XP is a way of increasing the AI's units CS in a more elegant way that just saying "+30% CS for difficulty level".

Free supply is probably what you want to reduce, since it is the main observable difference between AI and Player.
 
The NumOptionsConsidered section is for how many options go onto the AI's decision roulette starting with what is considered most optimal by the AI in descending order, right? I think G mentioned this somewhere before.
I'm not sure it works. The value is always 3, while it should scale with difficulty. G should confirm this point.
G confirmed that this value should be 3 for low difficulty, 2 for medium difficulties, and 1 for high difficulties. Will be fixed in upcomming version.
 
Back
Top Bottom