Skip to content

08 — AI configuration (the AI/ folder)

Index

What the computer players build, where they put it, what they research and what they shoot at is described in text files in the game's AI/ folder. This chapter documents every keyword those files accept and explains how the AI uses the values during the game.

Contents

  1. The files and how they fit together
  2. Syntax, mods and error behaviour
  3. SupportTypes.txt — roles for the conventional war
  4. NuclearTypes.txt — roles for the nuclear war
  5. MissileCategoryMapping.txt
  6. DefenceDef.txt — what to protect
  7. GroupsConquest.txt — group compositions
  8. StrategyConquest.txt — strategies
  9. Support blocks: InvasionSupport, EndangeredRegion, NuclearDynamicGroups
  10. Conditional.txt — research reactions
  11. limits.txt — when the AI goes to all-out war
  12. DiplomacyTime.txt (optional)
  13. Recipes
  14. Pitfalls
  15. Covert operations (AI/CovertOps.txt)
  16. Personalities.txt (optional)
  17. StrategicValues.txt (optional)

1. The files and how they fit together

File Defines
AI/SupportTypes.txt Support types: the roles units play in an invasion or region defence (MainForce, AirSupport, AntiAir, …)
AI/NuclearTypes.txt Nuclear types: the roles in the nuclear war (TriadGround, NuclearDefence, …)
AI/MissileCategoryMapping.txt Which [AI_CATEGORY] weapon categories count as "strategic" etc.
AI/DefenceDef.txt Defence groups: which of our objects a defender should stand next to, and how much each is worth
AI/GroupsConquest.txt Group compositions: every unit group the AI can build — units, placement, targets
AI/StrategyConquest.txt (+ the files it USEs, AI/Default/*, AI/Airforce/*, AI/Submarines/*) Strategies: research lists and the build rules for defence, invasion and nuclear war
AI/Conditional.txt Research the AI adds when an enemy attacks it with, or is known to have, some technology
AI/limits.txt Global pollution thresholds per difficulty that escalate the AI to all-out war
AI/DiplomacyTime.txt (not shipped, optional) how long the AI remembers accepted/declined diplomatic offers
AI/Personalities.txt (optional) Personalities: named trait profiles, one drawn per AI faction at game start (§16)
AI/CovertOps.txt (optional) Covert operations: what covert units (spec-ops teams, bomb trucks) go for, what guards against them, the counter-spy unit (§11)

Files are read in this order; a file can only refer to names defined in files above it (and, inside GroupsConquest.txt, to groups defined earlier in the same file):

SupportTypes.txt ─┐
NuclearTypes.txt ─┼──► DefenceDef.txt ──► GroupsConquest.txt ──► StrategyConquest.txt ──► Conditional.txt ──► limits.txt
(+MissileCategory)┘   (SupportType/      (support/nuclear types   (group names, support/
                       NuclearType "…")   are derived from the     nuclear type names,
                                          units in each group;     DefenceGroup names,
                                          DefenceGroup "…")        technologies)

The model in one page

  • Every unit type that matters to the AI is assigned one or more support types and/or nuclear types — roles. A role measures power: the AI compares its own power per role against the enemy's power per role, region by region (support types) or globally (nuclear types).
  • The AI never builds single units. It builds groups (compositions) from GroupsConquest.txt: a leader unit plus escorts, a placement rule, and a target list. A group belongs to a role through its leader's unit type.
  • A strategy says which groups to build and when:
  • DefenseGroups — a static garrison, built before any invasion;
  • EndangeredRegion — extra forces for our regions at risk, sized against the enemy per role;
  • InvasionSupport — the force gathered against one enemy region, sized against the defenders per role;
  • NuclearGroups / NuclearDynamicGroups — the nuclear arsenal and its defences;
  • DomesticGroups — research centres and other economy buildings;
  • and three research lists (DomesticTechList, InvasionTechList, NuclearTechList).
  • One strategy is picked per AI faction at game start, at random weighted by Probability. Its name is stored in save games (renaming it makes old saves pick a new random one).

2. Syntax, mods and error behaviour

The tokenizer is the same as for the unit files (00 — Basics): free-form, // and /* */ comments, "strings", keywords case-insensitive.

Name Matching
Unit type IDs ("Army_Division") case-sensitive; an unknown ID stops the game with Unit Type not found. A missile ID is also accepted (it resolves to the missile's virtual unit).
Technology IDs case-insensitive; unknown → Technology not found
Group names (Group Airport, "Airport" in a strategy) case-sensitive (exact)
Strategy names case-sensitive (exact)
Support/nuclear type names, DefenceGroup names case-insensitive

Mods

All AI files are looked up through the mod system, so a mod can ship its own AI/… file to replace the original. To extend instead, start the file with USE PREVIOUS "AI/<file>" (see 00 — Basics §3). Support differs per file:

File USE IF / ELSE / ENDIF Defining an existing name again Removing
SupportTypes.txt, NuclearTypes.txt yes yes replaces the whole type delete "Unit" from TypeName
MissileCategoryMapping.txt yes yes lines add to the category clear Category, "AI cat" delete
DefenceDef.txt no no a second group with the same name is ignored (the first wins) —
GroupsConquest.txt yes yes Group Name again re-reads that group in place —
StrategyConquest.txt yes (top level and inside a strategy) top level only Strategy "Name" again re-reads that strategy in place —
Conditional.txt yes yes same trigger + same kind (AttackedWith/EnemyHas) replaces —
limits.txt, DiplomacyTime.txt no no a later section overrides earlier values —

Since DefenceDef.txt and limits.txt cannot USE PREVIOUS, a mod that changes them must ship a full copy.

⚠ An unknown word stops the file

Like the unit files, the game reads each AI list until they meet a word they do not expect. The game then shows a warning such as Error parsing file: (AI/Default/Invasion.txt, 127) unexpected "LaserDefenceSatellite" - the rest of this AI file was not loaded (also written to Fatal.txt) and carries on with what it has read. Unlike the unit files this is a warning, not a stop: fix the word and reload.

File An unknown or misplaced word…
SupportTypes.txt, NuclearTypes.txt …at the start of an entry is taken as the name of a new type. A type without units is reported (AI support type "critical" lists no units), which catches misspelled flags and flags written after the unit list.
DefenceDef.txt …ends the file (every entry must start with DefenceGroup).
GroupsConquest.txt …ends the file. Groups below it do not exist, so loading then stops with AI group composition not found: X from the strategy file.
StrategyConquest.txt …ends the current strategy and the whole file. Inside a USEd part (e.g. AI/Default/Invasion.txt) it ends only that part; the strategy continues with the next line of the including file.
Conditional.txt, limits.txt, DiplomacyTime.txt …ends the file.
MissileCategoryMapping.txt …shows a parse error (category names are checked).

END and the end of the file are the normal ends and are never reported.

Check your files before starting the game with tools/ai_lint.py: python3 ai_lint.py GAME_FOLDER reads the AI files the way the game does and also reports unknown units, technologies and groups, misplaced Optional, duplicated entries and defence groups whose defenders are missing (§6).


3. SupportTypes.txt — roles for the conventional war

MainForce // MANDATORY SUPPORT TYPE! Occupies cities
  default "Army_Division"

AntiAir
  AntiAir
  compare "Bomber"
  "Destroyer" "Cruiser" "AA_Site_Old" "SAM_site" "MOBILE_SAM" "Laser_Defence_Complex"
END

Each entry is TypeName, then any number of flags (in any order), then the unit list (quoted unit IDs). Flags must come before the units. Up to 32 types (support types + nuclear types share index space).

The first type is always the main occupying force and the second the auxiliary force — the game uses their positions (index 0 and 1), not their names. Loading stops with an error if fewer than two types exist. The names of all other types are free; they are referenced by name from strategies and DefenceDef.txt.

Flag Meaning
default "Unit" (first type only, inside the unit list) Marks the next listed unit as the default main-force unit: the yardstick for power comparisons. Without it the first unit is used (with a warning in the log).
compare "Unit" The enemy unit type this role's effectiveness is measured against (e.g. AntiAir vs "Bomber"). Default: the default main-force unit.
points Count / points RadarRange / points PreciseRadarRange How a unit's contribution is scored. Default (no points): its damage per second against the compare type (aircraft it hosts included), reduced for expensive weapon configurations; a damaged unit counts in proportion to its remaining power. Count = 1 per unit. The radar options score sensor coverage.
AntiAir Range checks use the unit's anti-aircraft reach.
AntiMissile Range checks use its anti-missile reach, counting only interceptors without a MinElevation (they can hit warheads near their target). A unit whose interceptors all have a MinElevation — the mid-course ABM_Site, which engages only missiles above 200 km and so protects nothing near it against short-range missiles — does not count for any region, not even its own; its place is the NuclearDefence nuclear type (§4).
CheckRadar (or RadarCheck) Range checks use detection range (sensors).
NumberByHosted When counting units, count the aircraft hosted by a base, not just the base.
NavalSupport Water-based support: evaluated with the naval reach rules.
CityInOccupationRange The unit can block occupation by having cities within its occupation radius (AuxForce).
SimpleOnTerritory Presence on the region's territory is enough (recon, spec-ops, terrorists): no range evaluation.

Each flag may be followed by Yes/No (AntiAir No). The shipped file also has critical, optional and recon commented out — they are not supported; uncommenting them would create empty types (reported as lists no units).

A unit listed in a type also gives that role to its high/low readiness states, and — if the unit is a Slave (aircraft) — to every unit type that can host it (so "Bomber" in AirSupport makes airports count as air support).

delete "Unit" from TypeName removes a unit from a type (use it in a mod with USE PREVIOUS).

The shipped types: MainForce, AuxForce, AirSupport, LongRangeSupport, StrategicSupport, NavalSupport, NavalSuperiority, AirSuperiority, AntiAir, AntiMissile, CoastalDefence, Reconnaissance, SpecOps, Terrorist.


4. NuclearTypes.txt — roles for the nuclear war

Same format as support types, with a smaller set of flags:

TriadAir // MANDATORY NUCLEAR TYPE!
  NumberByHosted
  "Bomber" "High_Speed_Bomber"

NuclearDefence
  points Count
  AntiMissile
  "ABM_Site"
Flag Meaning
points Count / RadarRange / PreciseRadarRange As for support types. Default: destructive value against cities.
AntiMissile Scored by anti-missile reach.
CheckRadar / RadarCheck Scored by detection.
NumberByHosted Count hosted aircraft.

The first three types are the nuclear triad — ground, sea, air, in that order (loading stops with an error if there are fewer than three). The triad's total power is what AI diplomacy compares between factions. Other names are free; they are used in NuclearDynamicGroups and in DefenceDef.txt.

Support-type and nuclear-type names live in one keyword namespace inside strategy files. Writing a nuclear type in an InvasionSupport block (or a support type in NuclearDynamicGroups) is accepted but silently maps to the same index of the other list (TriadGround there means MainForce). Keep the names distinct and use each in its own block.


5. MissileCategoryMapping.txt

Maps the [AI_CATEGORY] weapon categories of Units/Missile_types.txt onto the game's fixed classes:

Strategic "Strategic Nuclear" "SLBM" "Salted Weapons"
  • Line form: Class "AI category" "AI category" …. A category followed by delete is removed instead. clear Class empties a class.
  • Classes: Conventional, Tactical, Strategic, Chemical, Biological, EMP, ASAT, AA, AM.
  • Only Strategic is currently used: weapons in it are what the AI withholds until it decides on all-out nuclear war (and what it unlocks when someone uses strategic weapons against it). The other classes are read but have no effect yet.

6. DefenceDef.txt — what to protect

A defence group tells defensive units (SAMs, terminal ABMs) where to stand: next to the most valuable of our objects that is not yet defended.

DefenceGroup Fixed_AAM
  "AA_Site_Old" Value 0.5               // defenders and their strength (default 1.0)
  Distance 200                          // km: a candidate within this distance of a defender is "covered"
  NuclearType "NuclearRecon" Value 6.0 Decrement 3.0
  SupportType "AuxForce"
  Unit "Research_Center" Value 2.0 Decrement 2.0
  City Value PopulationPercent 0.5 Max 5.0
Keyword Meaning
DefenceGroup Name Starts a group. The name is used in DefenceGroup Name placement options (§7).
"Unit" [Value v] (first, before other keywords) A defender type and its defence value (default 1.0).
Distance km Protection radius. Default 100 km.
Unit "Unit" [Value v] [Decrement d] A candidate to protect with its value (default 1.0). Each defender in range lowers the candidate's value by d (default 1.0). Value Auto [x k]: the value follows the type's strategic value for us (§17): k × √(strategic value ÷ the production cost of the group's cheapest defender), default k 1, so the last few of a valuable type get more defenders. Also for SupportType, NuclearType and CovertTargets.
SupportType "Type" [Value v] [Decrement d] All (non-Slave) units of that support type, as of load time.
NuclearType "Type" [Value v] [Decrement d] All (non-Slave) units of that nuclear type.
CovertTargets [Value v] [Decrement d] Every unit type enemy covert teams go for (on the ground, fragile, not an occupier; see §15) as candidates, each worth v × its TargetValue multiplier from AI/CovertOps.txt. Used by the shipped CounterSpy group that places Security_Checkpoint.
City Value Mode v [Min m] [Max M] [Decrement d] Our cities as candidates. Mode is required: Default (v), Population (v × population in millions) or PopulationPercent (v × city's share of the faction population, in %). Then clamped to Min…Max.

Later lines override earlier ones for the same unit (beware duplicates — the shipped Fixed_AAM lists SRBM_Site twice, so its Value 1.5 Decrement 3.0 is replaced by the defaults).

Defenders are also added automatically: every group composition whose PlacementType (not a strategy's DynamicPlacement) uses DefenceGroup X adds its leader units to X's defenders with value 1.0 (unless the defender was given a value explicitly). DynamicPlacement … DefenceGroup X does not register anything — a group placed only that way must have its leader units listed as defenders explicitly (the shipped Mobile_AAM and TerminalABM_Mobile do this). Otherwise its units do not spread out: they all go for the top candidate. tools/ai_lint.py reports such cases.

At run time, a defender placed with DefenceGroup X goes to the candidate with the highest remaining value in the region (ties broken at random). With NO_NEGATIVE a candidate at or below zero is never chosen: a new defender then uses the normal placement of its point type, and an existing defender that already protects something is not moved.

A defence group also decides how many defenders an endangered region needs, for the EndangeredRegion roles placed by it (§9).

The file has no USE/IF support and stops at the first line that is not DefenceGroup.


7. GroupsConquest.txt — group compositions

DEF "SAM_SITE_FIX" "SAM_site" then "MOBILE_SAM" then "AA_Site_Old"

Group Airport
  PlacementType Airbase
  DistanceFrom "Bomber"
  DistanceType flight
  "Airport" Leader
  "SAM_SITE_FIX" optional
  extra missile 10
  Target "Missile_Silo" Priority 8000 Nuclear
  Target City Priority 100 Nuclear
  Avoid "Security_Checkpoint"
  MaxTargets 3

A group is read in three parts, in this order: header keywords → unit list → target keywords. Anything out of order ends the group, and an unknown word then ends the file (§2).

7.1 Header keywords

Keyword Meaning Default
PlacementType Point [options] Required. Where the group is deployed (point types below). — (error no Positioning type set)
AlternativePlacement Point Fallback point types, tried in order when the main one has no free point. Repeatable. none
AttackType Point [options] Where the group goes to attack from. none
WaitType Point [options] Where it waits for the global attack order. none
PatrolType Point [options] Points it patrols between. Up to 4 lines. none
DistanceFrom "Unit" Unit type whose range sets the placement distance from the enemy (e.g. "Bomber" for an airport). the leader
DistanceType radar \| flight \| weapon Which range of DistanceFrom to use. weapon
LinkTo Group (or AttachTo) Ties the group to another group (army divisions to their army base). —
SupportedBy Group The AI also wants this group built when this one is (radar for ABMs, space centre for satellites). Repeatable. —
AirTransport Group / SeaTransport Group / SubwaterTransport Group Groups that can carry this one; also marks them as transports. Repeatable. —
CanOccupy Yes/No Can capture cities. Needs the value. No
CanAquireOptionalsFromExisting [Yes/No] May take existing units from other plans to fill its optional slots. (spelled this way) No
CanJoinAnotherPlanWithSameDestination [Yes/No] May merge with another plan going to the same place. No
CanDetachOptionals [Yes/No] Optional members may be detached for other tasks. Yes
ChangePositionAfterAttack [Yes/No] Relocate after firing (mobile launchers, SSBNs). No
ObsoleteIfTech "tech" Read but currently has no effect. —

Groups referenced by LinkTo, SupportedBy, …Transport and Copy must be defined earlier in the file.

Point types

These are point classes the AI precomputes on the map:

Point Chosen for
MissileSilo Inland, away from our cities and borders, with good reach to enemy cities.
CityDefence Close to our populated cities (minimum of distance² weighted by population).
Radar Near the border with the enemy.
OverHorizonRadar Maximum coverage of enemy territory.
Airbase Reach to the enemy, not on the border.
SubmarineAttack Sea points within reach of enemy cities.
SubmarineHide Sea points just inside our reach to the enemy (hiding spots).
CarrierAttack Sea points with coverage of enemy territory, closer to land.
MobileMissile Moderately close to the enemy, good reach to enemy territory.
ObjectDefence Next to an object to protect — use with DefenceGroup Name.
NavalBase Our shore / nearby sea.
Orbit Satellites.
Shore Our land close to the water (coastal batteries).
CityControl A ground point next to each city, used to hold or capture it.
BorderDefence Along our land border with the enemy.
MarinesLanding, AirborneTroopsLanding, TroopsTraining, Industry Computed but not used by the shipped files.

Nearby and Any are additional point words that make sense only in a strategy's DynamicPlacement (§9): Nearby = any point in this region or the neighbouring regions.

Point options

Written after the point type, in any order:

Option Effect
self Use our own points (independent of the chosen enemy). Without it, points are chosen against the current enemy.
distant Keep away from our other units of the same kind.
closest Closest point to where the unit is produced.
free Skip points already taken.
FarFromBorder Prefer regions that do not border enemies.
FullCover (dynamic placement) every city of the region must be within range.
Safe Not under immediate threat. With Nearby: prefer another region if this one is invaded; on invasion: move to a safe border point.
Follow SupportType Dynamic placement following units of that support type.
DefenceGroup [NO_NEGATIVE] Name [NO_NEGATIVE] Place by the defence group's candidate values (§6).

7.2 Unit list

One line per slot: a quoted unit ID (or a DEF name) with an optional tag.

Form Meaning
"Unit" Required member.
"Unit" optional Nice to have; the group counts as complete without it.
"Unit" leader The leader; other members follow it. Without a leader line the first line is the leader.
"Unit" optional leader Both (note the order — leader optional ends the list, see §2).
"A" then "B" then "C" Alternatives in preference order: the first type the faction can build is used. The last one is the "minimum" used for automatic research (§8.3), so put the earliest-available unit last.
DEF "Name" "A" then "B" … (top level, outside groups) Defines a reusable alternative list; use it in groups as "Name".

A group's leader unit types decide its support/nuclear roles (§3, §4).

7.3 Target keywords

After the unit list:

Keyword Meaning Default
extra missile N Reserve loads to keep stocked. 0
DefaultAttackStrategy Lazy \| Immediate \| Defence Engagement rule for targets without their own tag (Immediate: for the listed targets only, see below). Lazy
DefaultAttackType Conventional Nuclear Special Weapon types for targets without their own (any combination). Conventional
DefaultPriority p Priority of targets not given one. 1
DefaultMaxDist km Max attack distance; -1 = the unit's weapon range. 1000
DefaultMax n Max groups engaging one target of a type. unlimited
DefaultFade f Priority multiplier per attack already made on a target. 0.02
DefaultCutOff c Targets with priority ≤ c are ignored. 0
Target "Unit" \| City [tags…] A target and its tags (below). Also applies to the unit's readiness states.
Avoid "Unit" \| City Never target it (priority 0).
AvoidContact "Unit" \| City [Dist km] Keep away from it while moving. 1000 km
Copy Targets Group Copy all target settings of an earlier group (overwrites what was set before).
Copy AvoidContact Group Copy its avoid-contact list.
MaxTargets n Targets to engage at once. 1
PriorityDivider d Switch target only for one with ≥ d × the current priority. 50
Return when type "Unit" n [type "Unit" n …] Return to rearm when fewer than n hosted units of that type remain.

Default… lines reset all targets' values, so put them before the Target lines (except DefaultPriority, which only changes targets still at the old default).

Target tags, any order:

Tag Meaning
Lazy The ordinary rule: a target only of a faction at war with us (or a forced target), and only once it is in the weapon range of the group (its aircraft included).
Immediate Hunted, not only fired at: valued up to MaxDist (not just in range), so a mobile group moves to it, a base or carrier launches at it, a ground leader may follow it into a neighbouring region. Also taken from a faction not at war with us when our units would engage it anyway: on our territory with a hostile order, an approved attack on units on our territory, or a type that does not trigger war when attacked (aircraft, spec-ops teams, bomb trucks). One immediate target at a time, when the group has no ordinary one and is free (not occupying, not on a covert mission).
Defence (Defense) Like Immediate while the target is on our or allied territory; elsewhere an ordinary target.
Priority p Importance (default 1, or DefaultPriority). Priority Auto [x k]: k × the strategic value of the target for its owner (§17), default k 50, so an enemy's last over-the-horizon radar becomes a top target.
Fade f Priority multiplier applied each time the target has been attacked.
CutOff c Ignore while priority ≤ c.
MaxDist km Max distance (-1 = weapon range).
Max n Max groups attacking one such target at once.
Conventional, Nuclear, Special Allowed weapon types (combine). Without any: DefaultAttackType.

Without an engagement tag a target gets DefaultAttackStrategy — except a nuclear-only target, which is always Lazy. A default Immediate covers only the types the group lists with Target (or gets by Copy Targets): every other type stays Lazy — before, a group with DefaultAttackStrategy Immediate hunted anything within 1000 km (the default MaxDist), its unlisted types included. A default Defence still covers every type (the army groups defend against whatever enters our territory).

Units fire on their own at what is in range (weapons with AutoEngage), and hosts scramble their aircraft at air intruders, whatever the AI's targets: the tags above decide what the AI sends its groups at.

Special defaults, applied before the Default… lines and the targets of the group:

  • Cities — nuclear attack only, Fade 0.4. As a nuclear-only target a city is Lazy. A Target City line without a weapon tag switches it to DefaultAttackType.
  • Units with AttackIfDestroyed (silos, launchpads, over-the-horizon radars, special airports, satellites, …) — Lazy, because destroying them can trigger the owner's retaliation. Whatever their tag, the AI targets them only once it attacks that owner's strategic assets or cities (AttackEnemyStrategicAssetsBitscale, AttackEnemyCitiesBitscale: the nuclear war, a global attack).

8. StrategyConquest.txt — strategies

Strategy "Default"
  PreferNuclear 50
  Probability 100
  USE "AI/Default/Tech.txt"
  USE "AI/Default/Invasion.txt"
  …

A strategy is Strategy "Name" followed by settings, in any order and any number of times; USE "file" inside a strategy reads that file's settings as part of it (this is how the shipped strategies share the AI/Default/* parts). A USEd file that itself starts with Strategy is read as a list of strategies.

8.1 Settings

Setting Meaning Default
Probability n Selection weight (0–10000). A strategy whose critical techs are disabled in the game gets weight max(n/10, 1). 100
Backup Excludes the strategy from the normal random pick; it is used only when that pick has nothing to choose from (all other strategies at Probability 0). A later Probability n sets its weight among backups.
PreferNuclear n 0 = invasion only, 100 = nuclear only; in between it splits research between the invasion and nuclear lists. 50
WantShareNuclear, BlockShareNuclear Diplomacy preference on sharing nuclear technology. off
ForceOptionalTechnologies Also auto-research the techs of optional groups (§8.3). off
CannotKeepRegionThreshold f Region defence gives up when our completeness falls below this. In diplomacy such a region is valued at completeness / threshold of its normal value (at least 5 %). 0.75
CannotKeepRegionThresholdForSupport f Same, for support roles (multiplies CriticalThreshold). 0.5
CannotKeepHysteresis f A region judged lost (by CannotKeepEndangeredShare or CannotKeepRegionThreshold) counts as holdable again only when it is clear of the limit by this share: the missing army power below the limit times (1 - this), or the force ratio above the threshold times (1 + this). Without it a region right at the limit could flip on every AI cycle, its armies leaving and coming back. 0 = no hysteresis. 0.2
CannotKeepEndangeredShare f An endangered region (not invaded yet) cannot be kept when the army power it still misses is more than this share of the faction's whole army power: it is no longer a safe region to deploy to or retreat into, and it does not draw armies from regions that can be held. (Invaded regions use CannotKeepRegionThreshold.) 0.5
ShouldAttackProactivelyThreshold f Strength advantage needed to strike pre-emptively. 1.5
OverwhelmedInCityThreshold f, OverwhelmedCityAttackersThreshold f When defenders in a city count as overwhelmed. 1.5, 0.75
SuppressionAvoidance Yes/No Normal difficulty and up only. Ground groups shot at by units they cannot answer (ships, submarines, long-range missile sites) react instead of standing still: finish an occupation that is about to complete (or keep blocking an enemy capture), close in on a reachable attacker, move out of its range, or hold and make it a priority target. Independently of this switch, region defenders leave a city shelled by ships when no enemy ground unit is at it, retreat points are chosen outside naval range, and such ships become priority targets. Yes
SuppressionSurvivalFraction f A move (closing in or moving out) is taken only if it ends within this fraction of the time the attackers need to destroy the group. 0.75
SuppressionNuisanceTime f Ticks (400 per game minute): attackers that need longer than this to destroy a group (after the repair it gets where it stands) are ignored, unless the group is about to complete the capture of its region. A single attacker this weak does not decide where the group goes while stronger ones are there. 24000
SuppressionRangeMargin f The exit point is chosen outside the attacker's range times this. 1.25
SuppressionReevaluateTime f Ticks a taken decision is kept unless the set of attackers changes. 600
RedeployCooldown f Ticks: an existing unit the region tactics redeployed is not redeployed again before this time has passed (stops units being sent back and forth between two regions). Newly built units are not affected. 0 = off. 0
RedeployCooldownMargin f When the cooldown is skipped: always for a region of a higher type than the unit's current one (invaded or being invaded by us > endangered > potential invasion target), never for a lower type; for the same type when the region tactics rank the new region higher and its value is this many times the current one's. Never within the same region; a unit whose region no longer needs it is free. 0 = the cooldown always holds. 2
AttackSyncMaxWait f Normal difficulty and up, against human players only: the armies going for the same fight (attacking ground units, or moving to points in an enemy region, within 250 km of one target, whoever owns it) wait for the slowest of them so they arrive together. An army more than this many ticks behind the fastest one is not waited for; it joins the armies of its own arrival time instead. 4000
InvasionTargetSwitchMargin f A unit already assigned to one potential invasion target is moved to another only when the new target's chances, with the unit counted there, stay ahead of the old one's by this many times the unit's strength. The chances follow the enemy armies near the targets, so without a margin one enemy army crossing a border could send a whole stack of armies from one target to another and back. The same margin applies when a unit leaves an endangered region for an invasion: the region must keep a surplus of this many times the unit's full strength (more for a cautious personality, less for an aggressive one), so an army lent to an attack is not pulled back home at once. 0 = any lead. 1.5
NuclearThreatWeight f Conquest: the enemy nukes in reach of a region but not in it (launchers, bombers, submarines far away), permitted against us by the enemy's restraint, count as enemy strength there × this: each unit's nuclear damage per second against our armies, spread over the regions it reaches. A region under nuclear threat needs a wider margin to invade, is given up sooner when it cannot be held, and lowers the local balance the diplomacy reads. 0 = only the enemy units in and near the region count. 0.5
SuppressionMaxAttackerRange f Km: an attacker whose range against the group is longer than this (strategic missile carriers) is no reason to move out or close in; the group stays. 2000
NavalHoldTimeout f Ticks a loaded transporter (or an empty sea transport) holds off out of reach when its destination or landing is within reach of enemy ships or coastal guns and no safe landing exists; its escorts attack the blockers meanwhile. Then it proceeds. 48000
CovertBlockerWeight f, CovertInvasionWeight f, CovertCounterWeight f, CovertSearchWeight f Weights of the spec-ops mission kinds (section 15), 0 = never. 1
CovertTransportPenalty f Game minutes added to the travel time of a spec-ops mission on another land mass. 30
TerrorStrikeInterval f Ticks between two planned bomb-truck strikes at Terrorism 1; divided by the trait. 48000
TerrorMaxTrucks f Bomb trucks a faction keeps at Terrorism 1 (the trait scales it). 4
AllowWeaponType "AI category" Yes/No No = this strategy does not use that weapon category by default. all allowed
DomesticTechList, InvasionTechList, NuclearTechList Research lists, §8.2.
NoNukeCitiesBefore "tech" … No full-scale nuclear attack on cities before these are researched.
DefenseGroups, DomesticGroups, NuclearGroups Static build lists, §8.4.
InvasionSupport, EndangeredRegion (or DefenseSupport), NuclearDynamicGroups Dynamic build rules, §9.
InvasionGroups [Minimal …] [ComplementPer …] Legacy invasion lists; read, not used by the shipped files.

IF is not recognised inside a strategy — wrap whole strategies, or whole USE lines, at top level.

8.2 Research lists

InvasionTechList
  "Weapon_Modernization" Target
  "AWACS"
  "Tactical_nukes" MinRequired Critical

Each entry is a tech with optional tags (Critical may come before or after the other tag):

Tag Goes to Effect
(none) the optional queue Researched when nothing better is pending.
Target the target queue Preferred research.
MinRequired the minimum queue Researched first; the invasion (or nuclear war) waits until all minimum techs of that list are known.
Critical — If this tech is disabled in the game or for the faction, the strategy becomes unavailable (low selection weight).

In DomesticTechList, MinRequired is treated like Target. There is no Optional tag in tech lists. Parents are researched automatically, so you only list the techs you want. The same tech may appear in several lists.

How the next research is chosen (per research stream, when the queue is empty):

  1. Collect the first unknown step towards every tech in: active MinRequired conditional techs, the domestic target list, the invasion minimum list and the nuclear minimum list.
  2. If the domestic candidates have the lowest tech level, research a domestic one. Otherwise pick between invasion and nuclear: the list with the lower tech level wins; on a tie, nuclear with probability PreferNuclear %.
  3. Among the chosen list, a random candidate at or below the current tech level (else at the lowest level).
  4. If that candidate is above the current tech level, or step 1 found nothing, do the same with the conditional Target techs and the domestic/invasion/nuclear target lists, then with the conditional Optional techs and the optional lists.
  5. If still nothing, any researchable tech at random.

Techs a research-sharing ally is already researching are skipped.

The comment "the AI WILL NOT consider invading until MinRequired tech is researched" in AI/Default/TechInvasion.txt sits next to a Target tag; only MinRequired (and the automatic techs of §8.3) gate the invasion.

8.3 Automatic techs

After a strategy is read, the techs of the leader units of these sets are added to the lists (to all units' techs with ForceOptionalTechnologies), with Critical:

From Added to When
DefenseGroups minimal set, InvasionGroups Minimal, NuclearGroups Minimal invasion minimum list PreferNuclear < 100
NuclearGroups Minimal / Target nuclear minimum / nuclear target list PreferNuclear > 0
NuclearGroups Optional nuclear target list with ForceOptionalTechnologies
DomesticGroups Target (Optional) domestic target (optional) list (optional: with ForceOptionalTechnologies)

For "A" then "B" alternatives the last alternative's tech is used.

8.4 Static build lists

DefenseGroups
  Minimal
    "ArmyBaseDef" x 1
    "Patrol" 2
  ComplementPer 15 RegionGDP Once
    "ArmyBaseDef" x 1
  Optional ComplementPer 1 WaterBorderRegion
    "BestCoastalDefence"
  Coverage Dist 2000 By "Air_Transport"
    "ArmyBaseDef" x 1

Group list items (used here and in §9): "Group" [backup "Group2" …] [x N | N] [DynamicPlacement Point options] [OnInvasion|OnBuildUp reaction]. backup (or alternative) names fallback groups, used when the main one is not available yet or is less cost-effective. x N repeats the item.

Block Contents
DefenseGroups [Minimal] list [complements…] [Coverage…] The garrison. The minimal list and every non-optional complement must exist before the AI starts an invasion.
DomesticGroups [Target \| Minimal] list [Optional list] Economy buildings.
NuclearGroups [Minimal list] [Target list] [Optional list] Minimal: needed before invading (so the AI can answer a nuclear attack). Target: when complete (with the techs of NuclearTechList minimum and NoNukeCitiesBefore), the AI may start the global nuclear attack. Optional: nice to have.

Complements — [Optional] ComplementPer N Type [Over M] [Once | Max K] followed by a group list:

Type Adds
Region(s) one set per N of our regions (rounded down: fewer than N regions → none). Over M: only regions beyond M count.
WaterBorderRegion(s) the same, counting our regions with a coastline
EndangeredRegion(s) the same, counting regions at risk
RegionGDP per region: one set when its share of the faction's GDP is ≥ N % (more for bigger shares: ⌊share / N⌋). Over M: counts the share above M %.
RegionCity / RegionCities per region: per N/100 cities — so ComplementPer 1 RegionCity means one set per city
LandSegment(s) per region: per N/100 separate land masses (Over 1 → only for the 2nd one onwards)
GDP / GeneralGDP once for the whole faction: our total GDP share is always ≈ 100 %, so this gives ⌊100/N⌋ sets
CovertTargetValue per region: one set per N points of the summed covert target value of our units there (cost / power × TargetValue, §15), so the regions with the most to lose to enemy spec-ops get the most checkpoints
NuclearWarProbability one set per N % of the global nuclear-war probability (0–100 %: rises with global pollution — 100 % at pollution 0.2 — and with the factions' readiness for nuclear war, their losses and the nuclear strikes already made)
Effort read but not evaluated

Once = at most one set; Max K = at most K sets (per region for the per-region types). Optional before ComplementPer makes that complement optional (not required before invading; still built). It applies to the next complement only; Optional not followed by ComplementPer is reported.

Coverage — Coverage [Dist km] [By "Unit"] list: makes sure every region is within Dist (or the safe flight range of By, whichever is smaller) of a unit of the listed groups, adding groups to the farthest uncovered regions.


9. Support blocks: InvasionSupport, EndangeredRegion, NuclearDynamicGroups

These three blocks size forces against the enemy, per role:

  • InvasionSupport — per enemy region we plan to invade: how much of each support type to gather.
  • EndangeredRegion (alias DefenseSupport) — per own region at risk: extra forces.
  • NuclearDynamicGroups — globally against each potential enemy, per nuclear type.
EndangeredRegion
  AntiAir
    min 0
    max 10
    EnemyCheck Number AirSupport 0.1
    CriticalThreshold 0.3
    "BestSAMSiteDef"
      DynamicPlacement ObjectDefence self DefenceGroup Fixed_AAM NO_NEGATIVE
      OnInvasion add Safe
    ComplementPer 5 RegionGDP Max 10
      "BestSAMSiteDef"
    WaterOnly
      min 1 max 4
      "HiddenPatrol"

The block is a sequence of role sections. Each section is: role name → parameters → main set (group list) → complements → optionally WaterOnly + parameters + its own main set and complements (used when the region has no land connection to us). If the block starts directly with a group name, it is a MainForce main set with min 1. Roles not mentioned get no forces; the block ends at the first word that is not a role name.

Parameter Meaning Default
min n [OnInvasion\|OnBuildUp n2] Minimum number of main sets; the second value applies while the region is invaded / the invasion is being built up. 0
max n [OnInvasion\|OnBuildUp n2] Maximum number of main sets generated from enemy strength (complements are not capped by it). 200
EnemyCheck [Number] [Deficit] [Role] v [OnInvasion\|OnBuildUp v2] Size against the enemy: by power (default) or by Number of units, of Role (default: this role), times v. Deficit uses only the enemy's surplus over ours. Repeatable: power checks add up, number checks add up, and the larger of the two results is used. EnemyCheck 1.0 against this role
EnemyCheck Intercept Role L [OnInvasion|OnBuildUp L2] [Salvo f] [MaxPer m] [Defender "Unit" f2]... [Threat "Unit" f3]... |OnBuildUp L2] [Salvo f] [MaxPer m] [Defender "Unit" f2]...| Size a missile or air defence by interception: the main sets it takes so that each missile (warheads and decoys of a MIRV counted) or aircraft of the fractionf(default 1) of the salvo of the enemy'sRoleunits in range gets through with a chance of at mostL. It uses the role's main-set leader the faction can build, its default weapon config, both sides' techs: the kill chance per shot, the shots one defender fires while the threat crosses its range, and the shots needed. Weapons that cannot be intercepted (guns, beams) ask for nothing.MaxPer m: at most m sets per enemy unit (a defender the formula judges badly cannot ask for the region'smaxat once).Defender "Unit" f2(repeatable): the sets counted with that defender type times f2 (e.g.Defender "MOBILE_SAM" 0.5: a type the formula over- or underrates).Threat "Unit" f3(repeatable): the sets an enemy unit of that type asks for times f3, 0 leaving it out. An aircraft counts only when it has a weapon against ground units or against the defender (not fighters, interceptors, AWACS). An enemy unit reaching n of the faction's regions under evaluation counts 1/√n in each (it cannot strike them all at once, but may concentrate on one). The units an enemy unit hosts count too (an airbase's aircraft), and its airway places (CanHostAircraft) as full with each type as its owner's are on the whole, when it has fewer aboard. A ballistic missile is engaged only while its arc is within the weapon's range of its impact point and between the weapon'sMinElevationandMaxElevation; every threat only beyond the weapon'sMinRange. Adds to theNumber` checks; for a role that protects objects, at least these sets minus our defenders in the region are missing. —
CriticalThreshold f Completeness (our ÷ required) below which the role blocks the invasion / counts the region as not defendable. 0 = never critical. Forced to 0 for roles without groups. 0

WaterOnly does not inherit the main section's parameters: give them again. Without WaterOnly the water case copies the main section.

Group list items are as in §8.4, with placement overrides:

After a group Effect
DynamicPlacement Point [options] Overrides the group's PlacementType for this use (Nearby, FullCover, FarFromBorder, DefenceGroup X are the common ones).
OnInvasion / OnBuildUp + reaction What to do when the region is invaded (EndangeredRegion) or while building up the invasion (InvasionSupport):
…none stay
…Border move to a border point in the same region
…SafeBorder move to a border point in another region
…DynamicPlacement Point [options] switch to that placement
…add options keep the placement, add options (e.g. add Safe)
…Block do not deploy until the invasion is over

Complements use the per-region types (RegionGDP, RegionCity, LandSegment) — and in NuclearDynamicGroups, NuclearWarProbability. An Optional complement is built only when optional groups are forced (for an invaded region, optionals are forced).

How the numbers combine for one role: required power = max(enemy power checks, enemy number checks × one main set's value). The AI generates min main sets, then the non-optional complements (their value is subtracted), then as many more main sets as needed for the remaining power, up to max. Groups that already exist nearby are counted against this before anything new is built. Each main-set group is replaced by its first backup that is available when the main group is not, or that covers the region better.

Roles that protect objects. In EndangeredRegion, a role whose first main-set group is placed by a defence group (DefenceGroup X in its DynamicPlacement, or in the group's PlacementType; in the shipped data AntiAir → Fixed_AAM and AntiMissile → TerminalABM) is sized by what it protects instead:

  • EnemyCheck lines only tell whether a threat exists — any enemy unit of a checked role in range of the region, before the factor and rounding;
  • except EnemyCheck Intercept: at least its sets minus our defenders of the role in the region are missing (the larger of the two counts is used);
  • with a threat, the region needs as many main sets as it takes to bring every candidate of X in the region to zero (§6): a candidate with remaining value r and decrement d needs ⌈r ÷ (d × the defender's value)⌉ defenders, using the main set's leader as the defender. min and the non-optional complements still apply, the larger number is used, up to max;
  • our defenders count where they stand next to a candidate (within Distance), not by the cities they can reach, and they are already subtracted from the candidate values, so the result is what is missing. Completeness is the strength of those defenders against the strength still missing.

The other roles, and these roles while the region is invaded with an OnInvasion Block reaction, keep the enemy-based sizing above.

There is no Optional "Group" form inside these blocks. Optional is only valid immediately before ComplementPer; Optional "Group" ends the block (and is reported).


10. Conditional.txt — research reactions

AttackedWith "Chemical_Weapons"
  Research "Chemical_Weapons"
  Research "CBRN_Defence_1"

EnemyHas "Satellite"
  Research "U_Space_radar"
  Research "M_ASAT" Target
Trigger Fires when
AttackedWith "tech" a unit of this AI is hit by a weapon (or by the unit launching it) whose tech is tech or descends from it
EnemyHas "tech" the same, or an enemy is found to have such a tech

Then Research "tech" [MinRequired | Target | Optional] lines (default MinRequired). Once triggered, a reaction stays active for the rest of the game and its techs join the research lists of §8.2 at the matching priority. Applies to every strategy.


11. limits.txt — when the AI goes to all-out war

[Normal]
  StartWar 0.10
  KillAllButAllies 0.3
  KillAllButAlliesWithLessScore 0.65
  KillAll 0.85

Sections [VeryEasy], [Easy], [Normal], [Hard], [VeryHard], [Insane] (the AI difficulty), each with the four thresholds compared with the global pollution level (0 = clean; the nuclear-war probability is treated as 100 % from 0.2):

Key Above the threshold the AI…
StartWar …may target any enemy city, and (above StartWar × √(1 + eliminated factions)) stops weighing production efficiency in its attacks. At or below it (outside Conquest mode) the AI nukes enemy cities mainly in a scripted/forced global attack or in retaliation (the enemy bombed more of its cities than it did theirs).
KillAllButAllies …attacks every non-ally.
KillAllButAlliesWithLessScore …also attacks allies with a higher score than its own.
KillAll …attacks everyone.

A value above 1 effectively disables a stage. The three Kill… stages do not apply in Conquest mode. Defaults if the file or a key is missing: VeryEasy 0.15/0.4/1.5/1.5, Easy 0.125/0.35/0.75/1.5, Normal 0.09/0.3/0.65/0.85, Hard and above 0.06/0.25/0.55/0.75.


12. DiplomacyTime.txt (optional)

Not shipped. If present, read once per AI faction at game start:

TimeToSustainAccept
  CeaseFire 300
  Alliance 1200
TimeToSustainDecline
  War 600
END

How long (game seconds) the AI keeps to its decision on an accepted or declined offer before reconsidering it. Request names: CeaseFire, PeaceTreaty, Partnership, Alliance, CooperationAgreement, Territory, Technology, Intelligence, Hardware, War, Contributions, WithdrawForces. Default 600 for all. A misspelled name is reported and the rest of the file is skipped.


13. Recipes

Make the AI use a new unit. Add it to the right roles in SupportTypes.txt / NuclearTypes.txt (otherwise it is invisible to power comparisons), then either add it as an alternative to an existing group ("New_SAM" then "SAM_site" leader, or extend a DEF) or create a Group and reference it from a strategy section. If it should defend objects, give it PlacementType ObjectDefence self DefenceGroup X — that also registers it as a defender of X. Add its tech to a tech list if it is not reachable through the automatic techs.

A mod that adds a strategy without replacing the shipped ones:

// MyMod/AI/StrategyConquest.txt
USE PREVIOUS "AI/StrategyConquest.txt"

Strategy "Rush"
  PreferNuclear 10
  Probability 50
  USE "AI/Default/Tech.txt"
  USE "MyMod_AI/RushInvasion.txt"
  USE "AI/Default/StaticDefence.txt"
  USE "AI/Default/DynamicDefence.txt"
  USE "AI/Default/Nuclear.txt"
  USE "AI/Default/Domestic.txt"

USE PREVIOUS must be the first line; strategies follow. Keep new file names distinct from the shipped ones (or use USE PREVIOUS inside them too).

A mod that adds groups: USE PREVIOUS "AI/GroupsConquest.txt" then your Group entries. To change a shipped group, define it again under the same name: it is re-read completely (write the whole group).

Make the AI more peaceful on Normal: raise StartWar and KillAllButAllies in [Normal] of limits.txt (ship the whole file).

Test: run tools/ai_lint.py on your game folder, then start a skirmish with AI factions, check for warnings, and watch what they build.


14. Pitfalls

  • Order inside a group — header keywords, then units, then targets. "Unit" leader optional ends the unit list (write optional leader).
  • Optional works only right before ComplementPer.
  • Defence groups used only through DynamicPlacement need their defenders listed explicitly (§6).
  • Same role name in both namespaces — keep support-type and nuclear-type names distinct (§4).
  • DefenceDef.txt and limits.txt cannot USE PREVIOUS; a mod ships the whole file.
  • ObsoleteIfTech, the Effort complement type and the Tactical/Chemical/Biological/EMP/ ASAT/AA/AM mapping classes are read but have no effect yet.
  • DistanceType flight sets the deployment distance only. The distance used when choosing a backup group and for FullCover checks uses the leader's weapon range.
  • Renaming a strategy or group: old save games then pick a new random strategy, and drop the AI's plans for groups that no longer exist.

15. Covert operations (AI/CovertOps.txt)

Optional file, read after DefenceDef.txt. It tunes what the AI's covert units (hidden ownership on the ground: spec-ops teams, bomb trucks) go for and what the AI defends against them. Everything in it works from Normal difficulty up. Without the file the values computed from the unit data apply.

Every unit named in it must exist. A game mode or mod with its own unit set brings its own AI/CovertOps.txt (Blitz has one with no entries: it has no covert units); one that only adds to the standard units can use the standard file.

A unit type is a covert target when it is on the ground, is not an occupier and is not covert itself. A unit that can fire at a team next to it (a weapon against ground units with a minimum range under 20 km; a ballistic missile launcher cannot) is a target only when the attacker's team destroys it in less than 0.75 of the time it needs to kill the team (both at full strength); on the way such a target also counts as a guard of itself: a team or a bomb truck strikes when the way in (and a team's time to destroy it; a truck needs only to arrive) stays within the same share of its time to kill them; its value for a team is ProductionCost / Power (costly and fragile first) times its multiplier. A guard is any unit that can see or shoot a covert unit; the ranges come from the unit's sensors and weapons.

Keyword Meaning Default
TargetValue "Unit" v Multiplier on the computed value (0 = never a target). TargetValue "Unit" Auto: the target's strategic weight and scarcity for its owner (§17: strategic value ÷ cost). 1
SoftTarget "Unit" / HardTarget "Unit" Force a type to be / never be a covert target. by the data
Guard "Unit" / NotGuard "Unit" Force a type to count / not count as a guard. by the data
CityValue v Value of a city per million inhabitants (bomb trucks). 1
GuardRangeCap km Sensor ranges above this do not widen a guard's circle. 100
GuardAttackCap km Weapon ranges above this do not widen a guard's circle (long-range weapons need a spotter to hit a hidden unit). 150
MaxMissionDistance km A spec-ops team or bomb truck takes no mission on its own land mass farther away than this (straight line); enemy covert units are chased within 2000 km. 2500
MaxRemoteMissionDistance km Nor one on another land mass (by transport) farther away than this. 6000
ResponseMaxAttackers n Attackers sent at most on an enemy covert unit seen on our territory (an incident of its region, never a priority target; never with nukes). Only groups whose Target lines name its type respond, on our territory as a Defence target (in GroupsConquest.txt: the army groups, AirportTactical). 2
CounterSpyUnit "Unit" The unit built where enemy covert units were seen or struck (one per incident, placed by its own group). Security_Checkpoint

A covert unit is not identified by its attacks: its owner becomes known only to the faction that destroys it (a sensor with IdentifiesCovert, 04 §, would identify it too - none is shipped). Without identification a covert unit, its attacks and its wreck stay anonymous for that faction. A covert unit that triggers no war when attacked (DoesNotTriggerWarWhenAttacked) and whose owner is not identified is always attacked, whatever the diplomatic state.

Spec-ops missions. From Normal difficulty up the teams of a SpecOps-type group no longer walk to a random spot: every think cycle the AI lists missions and each team takes the best one it can reach on its land mass (priority over travel time): the defender of a zone where our aircraft or missiles were lost (blocker), anti-air, radars and missile sites in a region we invade or are likely to invade (invasion), an enemy covert unit seen on our territory (counter), or a region worth a look that no team visited in the last game hour (search). The team approaches round the circles of the guards it knows of, switches its charge on when in reach, strikes, and flees out of every guard's circle when shot at. Strategy settings CovertBlockerWeight, CovertInvasionWeight, CovertCounterWeight, CovertSearchWeight (default 1, 0 = never) scale the kinds. The group's own Target and Avoid lines still apply when no mission is available. A mission on another land mass is reached through the normal transport request of the plan; CovertTransportPenalty (default 30 game minutes) is added to its travel time when choosing.

Bomb trucks. A Terrorist-type group (TerroristSmall, the Bomb_Truck) is built only by a faction whose personality has Terrorism above 0: the faction keeps at most the trait times TerrorMaxTrucks trucks (default 4: 0.2 is one truck, 0.6 two, 1 four), whatever the composition's per-region min/max say. Such a faction researches what its lightest truck needs (the espionage branch is in no research list) as its first choice whenever its research slot is free, but never ahead of its tech level. Every TerrorStrikeInterval ticks divided by the trait (default 48000, two game hours at Terrorism 1) a truck may take a strike: on the cities of a victim (never in Conquest mode and only after the NoNukeCitiesBefore techs) and/or on its ground units (by cost and the TargetValue multiplier of CovertOps.txt), as TerrorTargets says. The trucks are nuclear by definition: a strike is planned only on a victim the warhead may be used on, outside the no-nukes time and, unless UsesNukesFirst, only on a faction that nuked our cities; otherwise the trucks wait. Victims are the factions at war with us; with TerrorPreWar also those who attacked us or whose regions we consider invading; with TerrorRetaliation any faction whose own covert strike on us was identified, for two game hours. The truck approaches like a team (round the guards it knows of), arms the warhead on the last 60 km and drives in with the attack order.

For every faction that never identified the truck (its attack identifies nothing) the explosion is anonymous: no war, no cities-bombed count, no first use of nuclear weapons, only a covert incident that calls for checkpoints. A faction that did identify it treats the strike as an attack by its owner and remembers it for a covert reply.

16. Personalities.txt (optional)

Named trait profiles. At game start every AI faction draws one by Probability (the same random as its strategy), a saved game keeps it by name. Without the file every AI uses the defaults. Traits not listed in a profile keep their defaults. Read after CovertOps.txt; ends with END. With the Aggressive AI game setting the draw is by AggressiveProbability n instead (right after the name, like Probability): a separate set of personalities, the profiles without it are not drawn then; when no profile has one, Probability decides as usual.

Personality "Rogue"
  Probability 20
  Aggressiveness 0.7
  Terrorism 0.6
  TerrorTargets Both
  TerrorPreWar Yes
Trait Meaning Default
Aggressiveness f A scale (0.5 neutral): attack a neighbour when the win probability is above 1 − f; the enemy power seen at our endangered regions and at the invasion targets × (1 + 0.5 − f) (Cautious 0.35: ×1.15, more defence wanted and invasions only with a wider margin; Rogue 0.7: ×0.8); how badly an inland region must need defence to come before the border targets; peace treaties valued at a local balance + 0.5 × (f − 0.35). 0.5
NuclearRestraint f Conquest scoring: 0..1, how long nukes stay the last argument (0 = an ordinary weapon). The strategic nukes against an enemy's forces and assets. 0.5
TacticalNuclearRestraint f The same for the battlefield nukes. half the NuclearRestraint
CityNuclearRestraint f The same for any nuke on cities. halfway from the NuclearRestraint to 1
ChemicalRestraint f The chemical weapons (MissileCategoryMapping class Chemical), the same way but a step no higher than the tactical nukes (allowed whenever they are) and with no peace offer before it; once used on a faction, either way, free against it for good. the tactical restraint
BiologicalRestraint f The biological weapons, and chemical ones on cities: the desperate step - the regions or population lost (not the forces) past 0.15 + 0.6 × it while losing, or the enemy's use in this war; decided anew in every war. the city restraint
BetrayalPossibility f, HesitantToNukeCities f, DesperateLevelLosses f Diplomacy and nuclear traits (partly used, see the developer docs). 0.5, 0, 0.75
InvadesFirst, UsesNukesFirst, UsesChemsFirst, UsesBioFirst, NukesCitiesFirst Yes/No doctrine flags (UsesChemsFirst, UsesBioFirst: unused, see the restraints above). Yes, Yes, Yes, No, No
Terrorism f 0..1: bomb-truck effort (the trucks are nuclear), 0 = the faction never uses them. 0
TerrorTargets Cities/Assets/Both What the trucks go for. Both
TerrorPreWar Yes/No Strikes on potential enemies before a war (the hidden ownership gives deniability). No
TerrorRetaliation Yes/No A covert reply after being hit by a covert strike. Yes
SurpriseStrike f 0..1: the chance that a war the faction would threaten with an ultimatum starts instead at once, without any warning, by a decapitating nuclear strike on the target's strategic forces - only when that is appropriate (the target's conventional forces strong, the faction's nuclear forces in good shape). Other factions remember it: alliances with the attacker are worth less. 0 (Balanced 0.15, Rogue 0.7)
SpecOps f 0..1: the share of the planned spec-ops teams the faction rebuilds with priority after losses (at least one). 0.5 (Cautious 1)

The terrorist traits take effect with the bomb-truck doctrine (in progress); the profile itself is already drawn, saved and shown in the AI dump ("Personality: ...").

Nuclear restraint (Conquest scoring). An AI uses a level of nukes against an enemy only once it is permitted, for the rest of that war:

  • the level's restraint is 0.2 or less (a reckless personality); or
  • that enemy used the level against us first (any nuke on our units grants the tactical level, a strategic one the strategic level, a nuked city the cities level); or
  • our losses in the war (the largest share of our regions, our forces against the enemy's, or our population lost since the war started) exceed 0.15 + 0.6 × the restraint. With the defaults: tactical at 30 %, strategic at 45 %, cities at 60 %.

Chemical and biological weapons (classes Chemical, Biological) are restrained the same way, without the steps and peace offers below: chemical with the tactical nukes, by a low ChemicalRestraint, by the losses, by the enemy's use, and against a faction for good once used either way; biological - and gas on cities - by a low BiologicalRestraint, by the regions or population lost, or by the enemy's use in this war (a peace ends it).

A higher level grants the lower ones. A strategic permission from a low restraint alone (0.2 or less) does not lift the faction's classic strategic block (ready for a first strike, or the war so far); one earned by losses or by the enemy striking first does. The shipped Classic profile (Probability 0, AggressiveProbability 100: the Aggressive AI setting's personality, never drawn otherwise) keeps the doctrine from before the restraint: NuclearRestraint 0, TacticalNuclearRestraint 0, CityNuclearRestraint 1 (cities at 75 % losses). Defensive nukes (AI category Defensive Nuclear: the nuclear AAMs) are always allowed. The levels are the Tactical and Strategic classes of MissileCategoryMapping.txt. Other scoring modes keep the pollution-based escalation. DesperateLevelLosses is no longer used in Conquest: the cities level replaces it.

Escalation by losses, with peace offers. A level granted by losses (not by a low restraint, not by the enemy using it first) goes in steps, per level and per enemy:

  1. a peace offer first: the diplomacy's own ceasefire offer (the AI wants a ceasefire, as when it is losing: it asks nothing for it and gives technology and hardware when asked), waited for 2 × the diplomatic reaction time × (0.5 + the level's restraint);
  2. no peace: the escalation, with a budget: cities - 5 more city hits (or as many as the enemy hit, if more); tactical and strategic - 10 × (1.5 − the restraint) warheads more at its units;
  3. the budget used, our nukes not getting through (below), or nothing fired in 12000 ticks: another peace offer;
  4. no peace again: no limit.

A level whose nukes are all banned (or not available) does not escalate and starts again from the peace offer after an unban; the cities level counts lost regions and population only; a peace stage waits until its offer was sent. Back to none when we are no longer losing or the losses fall below half of the threshold (an escalation holds 6000 ticks at least). A restraint of 0.2 or less skips all of this. So does a level held anyway (the enemy used it first). A city permission makes the faction's groups attack, but it is no total war: its diplomacy goes on and no other faction becomes an enemy for it. The cities level also escalates when the proportional retaliation below is used up while the enemy keeps hitting ours.

Cities: retaliation. After an enemy nuked our cities, an AI may hit up to as many of its cities + 2 (while losing: twice as many + 2). The hits count, not the launches: the enemy's defences shoot many down, so the launches go on while the hits are below the limit.

Nuclear delivery. The server records, per pair of factions, our warheads that the defences could stop (tactical and strategic missiles, a MIRV's warheads; not the decoys, not nuclear shells) that reached the other faction and those its defences shot down (a MIRV carrier shot down: its warheads). The share that arrives (2 arrivals assumed before any is seen; each new warhead fades the older record by 0.97, about the last 30 count; kept across wars with the same faction) scales the faction's nuclear power against it: the faction power (CalculateFactionPower) and the nuclear balance, so the war outcome, the win probability, the deals and the votes all see nukes that do not get through as weak. Below 40 % after 5 warheads, an escalation turns to another peace offer.

Our nukes in flight at what we may not hit any more self-destruct: those at its cities beyond the hits left to the limit (the ones in flight count), those at a level revoked (a peace offer step included), and all at a faction we are no longer at war with (a ceasefire, a peace).

17. StrategicValues.txt (optional)

What a unit type is worth to the AI beyond its production cost: the strategic assets (over-the-horizon radars, satellite relays, silos), more when their owner has only a few left. Without the file every type is worth its cost.

StrategicValue "Over_Horizon_radar" Weight 20 Scarcity 2
StrategicValue "Missile_Silo"       Weight 8  Scarcity 10
City PerMillion 1
Keyword Meaning Default
StrategicValue "Unit" [Weight w] [Scarcity n] The value of one unit of the type for its owner = production cost × w × max(1, n ÷ the units of the type the owner has, all its states counted). Scarcity 2: the last one is worth twice as much; Scarcity 10: the last of ten silos ten times one of many. Weight 1, no scarcity
City PerMillion v A city's value per million inhabitants. 1

The counts are taken on every AI cycle for every faction, human players included. The values are read by Value Auto in DefenceDef.txt (§6, our own values), Priority Auto in GroupsConquest.txt (§7.3, the enemy's values) and TargetValue ... Auto in CovertOps.txt (§15).