Jump to content

IsBaseDefense

From ModEnc²
Tiberian Dawn Red Alert Tiberian Sun Firestorm Red Alert 2 Yuri's Revenge
Flag: IsBaseDefense
File(s): Rules(md).ini, ai(md).ini, Maps
Values: Boolean values: yes or no, true or false, 1 or 0
Default: No
Applicable to: BuildingTypes, TeamTypes


In Tiberian Sun

IsBaseDefense=yes on a building makes it a base defense structure, and the AI chooses from available buildings with this set when selecting a base defense to build. The total number of base defense structures to be built in relation to the base size is determined by the values in GDIBaseDefenseCoefficient and NodBaseDefenseCoefficient. See MaximumBaseDefenseValue for more information on how the AI distributes this number along the available defense structures.

In Red Alert 2

RA2 uses AlliedBaseDefenseCounts and SovietBaseDefenseCounts to determine the preferred base defense counts, of buildings with IsBaseDefense set. However there is a slight exception to this, BuildDummy is a list of low-tier defensive buildings to build between other core structures, and is not included in the defense count limits. Technically any auxiliary buildings can be added to BuildDummy as filler structures, to form part of the building queue.

Since RA2 has both a basic defense list with BuildDefense, and a high-tier BuildPDefense list for excess power conditions, expected as the AI base develops, BuildDummy actually allows three tiers of defensive structures, and more of them than the counts would suggest. This setup also enables the building of at least some defenses outside of the normal threat assessment regime, but possibly influenced by ThreatPosed values on them.

In Yuri's Revenge

The IsBaseDefense=yes isn't used for building AI base defenses. Instead they are built according to the lists provided in AlliedBaseDefenses, SovietBaseDefenses and ThirdBaseDefenses. AlliedBaseDefenseCounts, SovietBaseDefenseCounts and ThirdBaseDefenseCounts determine how many of each. Proportions of these buildings is calculated based on the values of AntiInfantryValue, AntiArmorValue and AntiAirValue and influenced by AIForcePredictionFudge, for fine-grained control.

In ai(md).ini and Maps

IsBaseDefense=yes on a TeamType assigns it as a defensive team. The total number of such teams is subject to the limits set by MinimumAIDefensiveTeams and MaximumAIDefensiveTeams under the [General] section.

Defensive teams can be produced even without the AI choosing an enemy, see: AIHateDelays.

The AI uses IsBaseDefense to identify structures for base defense target selection in ai(md).ini scripts, as well as for SuperWeapons.

For more on AI targeting, see: ScriptTypes/ScriptActions.

Bugs/Side-Effects/Unexpected Limitations

Although the AI automatically builds buildings with IsBaseDefense=yes set in TS, it cannot use such buildings as prerequisites for other buildings, unless the defense structure also has AIBuildThis=yes set.

As the AI attempts to build base defense teams first, failure to build MinimumAIDefensiveTeams with UseMinDefenseRule=yes, may result in an inability to build any teams demanded by AI Triggers.