Does the AI assess military strength correctly?

solohard1011

Chieftain
Joined
Mar 27, 2021
Messages
17
Playing the March beta (3-2), Emperor, all victory types but Time are disa.

Could someone clarify please what is used in the AIs assessment? Could there be something skewing the calculation for it to think that it is much stronger? E.g. promotions..

My neighbor Siam attacks me (for the second time) despite having 2 units less (checked in the ingame editor).

I (Morocco) have 18 units, of them 1 pathfinder and the rest are a mix of spearmen and bowmen.
He (Siam) has 16 units, of them 2 scouts, 2 horses, 1 swordsman, the rest are spearmen and bowmen.
In the score description, I (Morocco) get 7 military score, and he (Siam) gets 10.

Thank you!

Screenshot of him

upload_2021-3-27_20-39-12.png
 
Playing the March beta (3-2), Emperor, all victory types but Time are disa.

Could someone clarify please what is used in the AIs assessment? Could there be something skewing the calculation for it to think that it is much stronger? E.g. promotions..

My neighbor Siam attacks me (for the second time) despite having 2 units less (checked in the ingame editor).

I (Morocco) have 18 units, of them 1 pathfinder and the rest are a mix of spearmen and bowmen.
He (Siam) has 16 units, of them 2 scouts, 2 horses, 1 swordsman, the rest are spearmen and bowmen.
In the score description, I (Morocco) get 7 military score, and he (Siam) gets 10.

Thank you!

Screenshot of him

View attachment 591715

AI is less likely to attack if their evaluation says you're at least twice as strong as them, and very unlikely to attack if thrice or more. But even then it's still possible in rare circumstances.

Point is, AI doesn't need to have more units than you to attack. Not a bug. :)

n.b. If you're within 75-125% of the AI's strength you're considered "average". Humans get an additional increase to their strength perception based on difficulty level.
 
Last edited:
I think its calculated on defensive value which means bowmen and skirmishers provide less, similar to when you tribute CS.
This could possibly be a reason, the horses and swordman also adds a bit more compared to spearmen.
 
I think its calculated on defensive value which means bowmen and skirmishers provide less, similar to when you tribute CS.
This could possibly be a reason, the horses and swordman also adds a bit more compared to spearmen.

Nope, ranged units use RCS. I think there is a very slight difference for ranged vs. melee but the multiplier is like x1.45 instead of x1.5, should not have much impact on that small a scale.

Code:
/// Current power of unit (raw unit type power adjusted for health)
int CvUnit::GetPower() const
{
   VALIDATE_OBJECT
   int iPower = getUnitInfo().GetPower();

   if (getUnitInfo().GetRangedCombat() > getUnitInfo().GetCombat())
   {
       iPower = iPower * GetBaseRangedCombatStrength() / getUnitInfo().GetRangedCombat();
   }
   else if (getUnitInfo().GetCombat() > 0)
   {
       iPower = iPower * GetBaseCombatStrength() / getUnitInfo().GetCombat();
   }
  
   //Take promotions into account: unit with 4 promotions worth ~50% more
   int iPowerMod = getLevel() * 125;
   iPower = (iPower * (1000 + iPowerMod)) / 1000;

   //Reduce power for damaged units
   int iDamageMod = m_iDamage * GC.getWOUNDED_DAMAGE_MULTIPLIER() / 100;
   iPower -= (iPower * iDamageMod / GetMaxHitPoints());

   return iPower;
}
 
Nope, ranged units use RCS. I think there is a very slight difference for ranged vs. melee but the multiplier is like x1.45 instead of x1.5, should not have much impact on that small a scale.

Code:
/// Current power of unit (raw unit type power adjusted for health)
int CvUnit::GetPower() const
{
   VALIDATE_OBJECT
   int iPower = getUnitInfo().GetPower();

   if (getUnitInfo().GetRangedCombat() > getUnitInfo().GetCombat())
   {
       iPower = iPower * GetBaseRangedCombatStrength() / getUnitInfo().GetRangedCombat();
   }
   else if (getUnitInfo().GetCombat() > 0)
   {
       iPower = iPower * GetBaseCombatStrength() / getUnitInfo().GetCombat();
   }
 
   //Take promotions into account: unit with 4 promotions worth ~50% more
   int iPowerMod = getLevel() * 125;
   iPower = (iPower * (1000 + iPowerMod)) / 1000;

   //Reduce power for damaged units
   int iDamageMod = m_iDamage * GC.getWOUNDED_DAMAGE_MULTIPLIER() / 100;
   iPower -= (iPower * iDamageMod / GetMaxHitPoints());

   return iPower;
}
Thanks for the response!

I think I'll try to recompile the dll with the promotions weight reduced and see how it goes.
 
Top Bottom