The Threat System
The threat evaluation system was supposed to make the AI appear more 'intelligent' by targeting the more important threats first. In early development stages of Tiberian Sun this was planned as a Superweapon for GDI, but was scrapped, although the logic in all its incomplete glory remains in all later games up to and including Yuri's Revenge. As with various other logics, there is a lot of speculation surrounding this system.
Related INI Flags
- IsThreatRatingNode
- when a Building with this flag set is placed, its owner gains the "threat rating node" which is supposed to be the activator of the intelligent threat analysis logic. Through a bug in the game code, once a house gains this ability, it will not lose it even when the building in question is destroyed.
- [General]→EnemyHouseThreatBonus=
- An additional weight applied when the owner of the targeted unit is the house's selected enemy house.
The threat rating system also relies on multiple floating-point coefficients that are defined globally which can be applied to each unit describing its "effectiveness" and reliance on external factors such as distance from the target. These coefficients have two values, one applied under normal circumstances and one applied when the owner house has the "Threat Rating Node".
Coefficient name | Flag name with ThreatRatingNode | Flag name without ThreatRatingNode |
---|---|---|
Self Effectiveness | [General]→MyEffectivenessCoefficient | [General]→DumbMyEffectivenessCoefficient= |
Target Effectiveness | [General]→TargetEffectivenessCoefficient | [General]→DumbTargetEffectivenessCoefficient= |
Special Threat Coefficient | [General]→TargetSpecialThreatCoefficient | [General]→DumbTargetSpecialThreatCoefficient= |
Special Threat Value | [unit]→SpecialThreatValue | [unit]→SpecialThreatValue |
Target Strength | [General]→TargetStrengthCoefficient | [General]→DumbTargetStrengthCoefficient= |
Target Distance | [General]→TargetDistanceCoefficient | [General]→DumbTargetDistanceCoefficient= |
By default, when a house is created, it is considered to have Threat Rating Node. So, IsThreatRatingNode availability is always yes and the dumb coefficients are never used.
Threat Calculation
The basic algorithm estimating how much threat a certain object (Attacker) poses to a Defender works like this:
float Threat = Attacker's best weapon's Verses against Defender * Target Effectiveness; if(Attacker is currently targeting Defender) { // don't look at me, I didn't write the code Threat = Threat * (-1); } float tempValue = Special Threat Value * Special Threat Coefficient; Threat = Threat + tempValue; if(Defender is currently considering Attacker's owner house as the Enemy House) { Threat = Threat + [General]→EnemyHouseThreatBonus=; } tempValue = Defender's best weapon's Verses against Attacker * Self Effectiveness; Threat = Threat + tempValue; tempValue = Target Strength * Attacker's current health percentage; Threat = Threat + tempValue; tempValue = Target Distance * Distance between Defender and Attacker; Threat = Threat + tempValue; Threat = Threat + 100000.0;
Applicability
The threat rating logic is utilised when the object is selecting a target freely and when it is deciding whether or not to retaliate. However, both of those decisions are very complex and depend on a lot of other variables.