Pages

Mod AI configuration

Put ai.toml in a mod's root folder to override AEX's native AI defaults. It works with or without mod.toml. A small example package provides an editable starting point. A root file in the base TA data folder can supply settings when the selected mod does not provide one. The normal file priority selects one winning file; different files are not merged across layers.

The lobby's difficulty and personality choose a profile. A difficulty is easy, medium, hard or cheating; a play style is porcupine, balanced or aggressive, and defensive is another name for porcupine (the lobby's name for it). Settings can be given at three levels:

  • [difficulties.<level>] sets difficulty fields for that level's three styles, for example [difficulties.hard].
  • [styles.<style>] sets play style fields for that style at every level, for example [styles.defensive].
  • [profiles.<level>_<style>] sets any field for one profile, for example [profiles.medium_balanced] or [profiles.easy_defensive].

A difficulty table accepts only difficulty fields and a style table only style fields (see "Profile fields"); a field in the wrong table is an error that names the right one. Naming one table twice, as porcupine and defensive, is an error. For example:

# Common economy settings for every profile.
[economy]
first_factory_extractor_count = 1
first_factory_power_count = 1
first_factory_min_metal_income = 2.5
first_factory_min_energy_income = 25
metal_income_per_factory = 6

# Change only Medium / Balanced's behavior.
[profiles.medium_balanced]
decision_period_ticks = 90
commands_per_pass = 4
attack_commit_ratio = 1.2
retreat_fraction = 0.4

# This profile can use different economy rules too.
[profiles.medium_balanced.economy]
first_factory_power_count = 2
first_factory_min_energy_income = 50

Missing profile fields retain their built-in preset values. Tables apply in this order, wherever they appear in the file: built-in presets, global [economy], [difficulties.<level>], [styles.<style>], then [profiles.<name>]. Economy settings inherit from built-in defaults, global [economy], then the selected [profiles.<name>.economy]; difficulty and style tables carry no economy. Changing one profile does not change the others. The skirmish opponent owns the default opening and construction behavior.

These settings configure AEX's own AI. TA executable patches and TA AI scripts are not imported as AEX profile definitions. In particular, these explicit factory gates are separate from TA's weighted build-selection formula.

Economy fields

Income values are smoothed resources per second; resource fractions are 0–1. All numeric values must be finite and nonnegative. Count fields are integers.

Fields Meaning
first_factory_extractor_count, first_factory_power_count Completed structures required before requesting the first factory. Zero removes that requirement; a kind the AI's builders cannot construct does not block it.
first_factory_min_metal_income, first_factory_min_energy_income Inclusive minimum incomes for the first factory.
metal_income_per_factory Additional factories require metal income strictly greater than this value times the next factory count.
energy_income_per_factory The same strict additional-factory energy gate when positive; zero disables it.
expansion_floor_metal_income_per_factory Expansion floor: until metal income, plus what idle metal makers could make from spare energy, reaches this value times (completed factories + 1), the AI keeps at least one extractor claim going, even with max_expansion_claims = 0. Default 8; zero turns the floor off.
progression_build_horizon_sec Positive lookahead for bank-supported capability progression and incremental work admission; default 180 seconds.
progression_income_share Fraction of spare income forecast for bank-supported progression, 0–1; default 0.5. Current construction and operating costs remain reserved.
income_ema_alpha Income smoothing factor, 0–1.
energy_starved_fraction, metal_starved_fraction, resource_capped_fraction Stored-resource fractions used to classify shortages and surplus.
opening_metal_spend_fraction Stored-metal fraction separating opening extractor and power priorities.
energy_per_metal_income_target Desired energy-to-metal income ratio.
max_climb_energy_per_metal With metal plentiful, the energy target follows the energy per metal of what the top plants build and the next tier's plant, capped at this. 0 (default) keeps the fixed ratio.
power_tier_floor 1: once a builder can make power at a higher tier, lower-tier power is no longer built (unless energy stalls). Default 0.
lasting_power 1 (default): with metal plentiful, a power plant counts for its whole output, not only this pass's gap.
upgrades_per_tier In-place building upgrades under way at once: 1 at tier one plus this many per tier owned, up to 6. Default 2.
plants_before_army_floor From this many plants, an extra plant waits for a minimum attack squad. Default 1000 (off).
naval_reach_gate 1 (default): where ships from the base reach no enemy start, a shipyard builds no warships while no enemy is on its water, and only one such yard is built. 0: ships are built wherever a yard stands.
naval_answer_plant 1 (default): enemy ships or submarines near the base put a plant that makes torpedo units at the front of the factory frontier when no owned plant makes one.
unkeepable_promise_relief 1 (default): with the metal bank near full, a promised job the bank cannot carry stops refusing other orders.
progress_walk_expiry 1 (default): a builder walking to a site keeps the job while it gets nearer, and is released when it stops moving (30 s) or stops getting nearer (90 s), at most 480 s. 0: every walk ends at 120 s.
failed_site_memory 1 (default): a site a builder's job ended at with nothing built is not given to that builder again for 120 s, nor to anyone once two builders failed there.
unsafe_claim_site_only 1 (default): a deposit the AI has given up on (its extractor lost twice) closes only that deposit; 0 also closes every deposit within 160 wu of it.
push_cleared_advance 1 (default): a push moves on from a target it holds in sight with nothing hostile there, and the circle it arrives in grows with its size. 0: it moves on only once half its power stands within 300 wu.
push_form_up 1 (default): a land or sea push on a far target gathers 1600 wu short of it and goes in together. 0: it marches straight at the target.
lane_points_inside_map 1 (default): a push's flank points, hold points and form-up points, and a ship's firing points, stay 128 wu inside the map's edge, where units can stand. 0: they may lie on the edge itself.
push_resend_stalled 1 (default): a push member that has stood still for 20 s near its flank point with its order still running is sent on at the target. 0: only a member with no order is sent on.
retreat_to_staging 1 (default): a beaten land or sea push falls back to its staging point, and after an alert only defenders that left the base come back. 0: both go to the base anchor.
constructor_needs_base_options 1 (default): only a mobile builder that can place an extractor, power, a metal maker or a factory is built and counted as a constructor. Read from the top-level [economy] table.
rate_bombers 1 (default): a bomber's dropped command-fire bombs give it combat power, rated per bombing pass. Read from the top-level [economy] table.
combat_skips_utility 1 (default): armed transports and radar scouts with a token weapon are not built as combat units. Read from the top-level [economy] table.
raid_after_first_constructor 1 (default): the opening raid waits until a constructor other than the commander is built or queued.
builder_loss_window_sec Each constructor lost within this many seconds lowers the constructor target by one, down to builders_base + 2. Default 120; 0 turns it off.
stall_counts_started_power 1 (default): while energy is starved, pending power covers the gap only once its frame has started or its site is at the base.
balance_power_one_at_a_time 1 (default): while power is pending, the energy-per-metal target alone orders no further plant; real shortfalls still do.
pending_power_arrival_sec A power plant under construction counts against today's energy draw (spending above income) only when the builders on it will finish it within this many seconds, so a plant minutes from done does not stop quicker power being built for that draw; only power that is itself done within this time is built for it. Power wanted for the next tier and for the energy-per-metal target still counts every plant under construction, one plant at a time. Default 30; 0 counts every pending plant against everything.
income_ema_max_rise Each pass the smoothed income takes a sample of at most this many times itself, so a one-off metal or energy lump does not read as income. Default 2; 0 turns it off.
tier_power_demand_during_frames 1 (default): a plant that advances the tier asks for its power while another factory is under way.
max_makers_in_flight Metal maker jobs the spare energy may have under way at once, one per maker drain the spare covers. Default 4; 1 keeps one at a time.
maker_energy_funding 1 (default): a metal maker that repays its metal cost within 60 seconds is funded on energy alone.
maker_flow_restart 1 (default): switched-off metal makers restart on spare energy income once the energy store is above half, not only when it is full.
base_alert_reach 1 (default): the base alert also answers an enemy whose guns reach a base building, or a radar blip near one, not only enemies near the base centre.
forward_defense_arc 1 (default): perimeter defences fill the side facing the threat before the rear.
claim_defense 1 (default): a builder beside a held outlying metal claim with no tower stands one there.
anti_air_cover 1 (default): an anti-air-only tower stands where it covers valuable buildings no anti-air covers yet.
fighter_structure_cover 1 (default): base-cover fighters also attack enemy aircraft over any own building, not only near the base centre.
fighter_army_cover 1 (default): army-cover fighters fly over the army, not its target, stay home while known anti-air guards the way, and leave two fighters on base cover.
nearest_builder 1 (default): of the idle builders that can make the chosen building, the one that would arrive and finish first builds it. 0 takes the first in unit order.
commander_leash_wu While another builder can make the same building, the commander builds no farther than this from the base. Default 2048; 0 turns the leash off.
commander_leash_all_jobs 1 (default): the commander does all its work within commander_leash_wu of the base, so a raiding party does not catch it far out. It assists, reclaims and upgrades only there, measured from the base however far it stands. Beyond the leash it builds only what no other builder of ours can make: a factory while the side has none, at any distance, or, while it is the only builder, a metal extractor or power plant when none fits inside the leash, up to twice the leash. Radar, sonar, sea buildings, defences and storage beyond the leash wait for a constructor. 0: the leash holds only builds that another builder can make, as before.
commander_retreat 1 (default): when the enemy near the commander outweighs it and the own units and defences around it, the commander drops its work and walks off, back to the base or to the side of the base away from the enemy, never beyond commander_leash_wu. It takes no work until a while after the enemy has gone. A commander with nowhere to go keeps working. 0: it carries on where it is.
commander_factory_assist 1 (default): a commander left with nothing to build or help build assists a busy plant inside commander_leash_wu, and keeps to that plant rather than going reclaiming. 0: it does not help plants with their units.
builder_loss_memory 1 (default): a builder killed on its way to a metal spot or vent away from the base keeps the next builders away from that area for a while.
vent_safety 1 (default): a geothermal vent away from the base is claimed like a metal spot (claim limit, reach, danger on the way) and only by a builder that can walk there before its order expires.
feature_wall_regions 1 (default): blocking map features that builders do not clear in passing wall builders in, so a walled-in builder takes only sites inside or within build distance across the wall. 0: features never wall a builder in.
walled_plants_outside 1 (default): no ground-unit plant goes inside a small walled pocket, where its units could not get out, unless no lot outside is in reach. Air plants are not refused.
release_stalled_plants 1 (default): a plant that has had a queue and no unit under way for 20 s frees its helpers and gets no new ones.
clear_stalled_plant_mouth 1 (default): own units standing round such a plant are walked to its rally so its product can leave. Needs release_stalled_plants.
surplus_frame_assist 1 (default): with the metal bank full or rich, helpers join defence and strategic buildings under construction; each plant keeps one helper.
upgrade_bank_funding 1 (default): an in-place upgrade whose lost income the bank carries through the build goes ahead; 0 also needs spare income to carry the loss on its own.
home_extractor_upgrades 1 (default): a constructor sent to a far deposit first upgrades a safe extractor at home, if it can build a stronger one.
upgrades_outside_claim_budget 1 (default): in-place extractor upgrades do not use max_expansion_claims.
deposit_map_rules 1 (default): a map with metal deposits follows deposit rules even with background metal; 0 treats any background metal as metal everywhere. Read from the global [economy] table only.
held_deposit_supply 1 (default): the metal budget counts the deposits at home and the outlying ones held now; 0 counts every deposit in reach.
plant_limit_attack_domains 1 (default): the plant limit sorts plants into land, air and sea, so a hover plant is limited while a higher land plant exists. 0: by movement class.
plant_limit_reachable_tier 1 (default): only a higher plant the AI's own build tree can reach limits a plant; another side's plant does not.
bank_feeds_tier_power 1 (default): while the next tier waits only on power and power is wanted, a full metal store buys no more plants of the tier owned.
plant_gate_by_draw 1 (default): the second and third plant may be earned by what the plants draw, and may pass a tier step that waits on metal while spare metal covers them.
commit_ratio_decay 1 (default): once attack_patience_sec has passed, each further full patience period halves the strength the army needs to attack, down to an eighth of the enemy's, so a waiting army always attacks in the end. The further periods count only time spent waiting, from the last attack or from the last beaten attack's return, whichever is later: not the time a beaten attack spent fighting. 0: it waits for even strength.
beaten_target_regroups 1 (default): after an attack comes home beaten, the next attack on the same place waits the attack cooldown and its patience again from that moment, and goes only with at least the beaten attack's strength times the bigger wave the AI's memory of the failure asks for, for as long as it remembers the failure. Other targets are not held back. 0: the survivors and the units waiting may attack the same place again at once.
spread_attacks 1 (default): with two or more enemy players left, each attack goes to the enemy the AI has attacked longest ago among those it is strong enough to take on, at its starting position when nothing of it is known yet, so every enemy is attacked in turn. An attack that has destroyed all it knows of its enemy moves on to the next one the same way. When it can take on none, it waits for the single best target as with 0. 0: every attack goes to the single best target among all enemies. With one enemy left this changes nothing.
raid_groups 1 (default): on a difficulty with raids, the AI sends raid parties of raid_squad fast units at the enemy's outlying extractors all game, the first from first_raid_sec. The opening builds opening_raiders raiders before its next constructors; later the party is topped up after constructors, anti-air and artillery, and only while it has a target it can reach and beat. Once the first attack may go, a party at home never holds more than half of the land army. A party also counts the enemy at a target against the full assumed 200, whatever early_pressure lets it attack with. 0: no raid parties.
fallback_softer_target 1 (default): when the best target is guarded too strongly for the army, it attacks a weaker target it can take instead of waiting. 0: it waits for the best target.
regroup_by_strength 1 (default): after an attack comes home beaten, the army attacks again as soon as it is back to the strength it lost with, but never needs more than regroup_size_cap times the strength that set out. 0: it waits as before.
commit_ratio_after_push 1 (default): after an attack wins, the next one may set out at the relaxed strength the patience rule allows, instead of starting again from attack_commit_ratio. 0: every attack starts from attack_commit_ratio.
style_push_pacing 1 (default): how long an attack forms up (form_up_wait_sec, form_up_max_sec), the smallest group of reinforcements sent after it (reinforce_wave_min) and when a losing attack turns home (losing_retreat_ratio) follow the play style. 0: every style forms up for 60 seconds after its first unit arrives and at most 240 seconds, reinforces in groups of at least 2, and turns home under 0.6 of the enemy's strength.
early_pressure 1 (default): Balanced may first attack at 300 seconds instead of 360, Aggressive's patience is 60 seconds instead of 90, and a style whose min_attack_squad is under 8 assumes a target holds less enemy strength when nothing is known of it (200 × min_attack_squad / 8 instead of 200), so Aggressive's first three units can attack. A first_attack_sec or attack_patience_sec a policy sets to another number stays as set. 0: the earlier values.
base_alert_holds_attack 1 (default): while defenders are answering enemies at the base that are stronger than the garrison, the waiting army helps defend and no new attack sets out, for at most the longer of attack_patience_sec and the attack cooldown. Aircraft over the base and attacks on outlying claims do not hold it. 0: a ready army attacks whatever the base faces.
plants_grow_with_overflow 1 (default): while the metal store is full, energy is not short and every plant is busy, the AI may build one more plant of its highest tier past the usual limit at a time, up to three more of each kind. 0: the limit stays fixed.
mop_up_held_evidence 1 (default): the army splits up to finish the enemy only after it has looked at every enemy start lately and the enemy army seen in the last few minutes is small, and keeps at it until a real army turns up. 0: decided from what is in sight in one pass.
frame_power_by_progress 1 (default): an enemy unit still being built counts only as strong as far as it was built when last seen, so a half-built cannon does not keep the army waiting. 0: it counts as finished.
stockpile_not_guard_power 1 (default): an enemy nuke silo counts as a long-range threat but not as defence of the ground around it, when the army judges whether it can take a target or finish the enemy. 0: its nuke counts as defence too.
mop_up_static_weight 1 (default): when deciding whether the enemy is beaten, its towers and other defences count for a quarter of their strength; an enemy army still counts in full. 0: defences count in full.
sustained_shot_interval_sec Above 0: a strategic gun that pays per shot is judged at one shot this often instead of flat out. Default 0.
builders_base, builders_per_factory Base builder target and increment per completed factory.
metal_world_extractor_base, metal_world_extractors_per_factory Extractor expansion target.
structures_per_radar Completed structures per additional static detector allowed, and separately per additional static jammer; integer, at least 1. The budget is an upper limit; uncovered operational radar/sonar coverage, or jamming of production once the enemy fields sensors or long-range weapons, creates demand.
scout_by_sight 1 (default): scouts, spies and attack targets count a start or metal spot as looked at only once the side has had it in live sight. 0: the explored map decides, which Mapped fog fills from the start.
sweep_enemy_starts 1 (default): with no known target, attacks and spies keep to the enemy's starts, and an attack returns to an enemy start it never saw before trying another. 0: every start in turn.
unseen_start_before_blip 1 (default): an enemy start never in sight comes before radar blips as an attack target. 0: the nearest blip first.
structure_memory_sec Above 0: enemy structures unseen this many seconds are forgotten. 0 (default): remembered until their ground is seen without them.
strategic_build_horizon_sec Positive planning interval used to fund a strategic building and its ammunition reserve; default 180 seconds.
strategic_income_share Fraction of metal and energy income available to strategic construction and weapon operation, 0–1; default 0.5.
strategic_interceptor_target, strategic_offense_target, strategic_artillery_target Independent capability targets; default 1 each. Zero disables that goal. Completed units, frames and pending construction count toward each target. The offence and artillery targets are floors: a richer income sustains more, each goal taking an equal slice of strategic_income_share. Interceptors are wanted only once an enemy offensive stockpile has been seen or the AI's own launcher stands, and then grow with what they leave uncovered.
strategic_ammo_reserve Desired stockpiled rounds per strategic unit; default 1. Construction affordability includes this reserve; zero disables ammunition requests.
strategic_reach_gate 1 (default): a strategic launcher or gun whose reach does not span the map is built only with a known enemy structure in its reach from own territory, and placed within reach of one. 0 builds and places it as before.
strategic_start_fallback 1 (default): a ready strategic missile with no known enemy structure in its reach is fired at an enemy start position, at most 3 rounds per start. 0 holds it until a structure is seen.
urgency_strategic, urgency_strategic_counter Proactive strategic priority before personality weighting (default 85), and interceptor priority when an offensive stockpile has been perceived (default 95).
min_defense_when_threatened Minimum defensive structure target after enemies have been seen.
urgency_opening_extractor, urgency_opening_energy, urgency_first_factory Relative opening priorities.
urgency_energy_stall, urgency_metal_stall, urgency_energy_grow, urgency_extractor_expand Relative resource priorities.
urgency_builder, urgency_defense, urgency_radar, urgency_storage, urgency_extra_factory Relative construction and production priorities.

The four resource/opening fractions also require 0–1. Urgencies express relative priority: higher values win. They are not percentages.

Profile fields

A difficulty decides how well the AI plays; a play style decides what it plays for. Every field below can be set in [profiles.<name>]; a difficulty field also in [difficulties.<level>], a style field also in [styles.<style>], and attack_cooldown_sec in either.

Difficulty fields

Field Type and bounds Meaning
decision_period_ticks Positive integer, up to uint32 maximum Ticks between full decision passes; the dispatcher still applies its shared cadence and startup grace.
commands_per_pass Positive integer Maximum commands emitted per pass.
decision_top_k Positive integer Number of top-scoring candidates considered when selecting a build.
max_expansion_claims Nonnegative integer Simultaneous extractor expansion claims. The expansion floor raises zero to one while metal income is below its target.
income_multiplier Positive number Multiplier on this AI's resource generation. Only a cheating profile may set a value other than 1.
sees_through_fog Boolean Whether perception ignores fog. Only a cheating profile may set it true.
max_attack_groups Positive integer Pushes under way at once; each approach of a split push counts as one. A ready army waits while none is free. Bomber runs and air drops do not count.
raids Boolean Whether the opening raid is built; with false, raid_share counts as 0.
multi_direction_attacks Boolean Whether a push may split along several approaches; with false, attack_directions counts as 1.
retreat_discipline Boolean Whether a push or bomber run retreats on losses; with false, retreat_fraction counts as 0 and it fights on.
defended_claims Boolean Whether defenders answer an armed enemy at an outlying extractor claim. The base is always defended.
use_threat_map Boolean Whether a push's target choice weighs the threat around each target; with false, every target is valued as if unguarded. Routing, expansion and bomber runs are not affected.
micro Boolean Whether damaged units are sent home through the AI's rift-gate pair to recover.
reaction_delay_sec Nonnegative number Seconds a new attack on the base or a claim must have been seen before defenders answer it.
tech_delay_sec Nonnegative number Until this second, unit types above tier 1 get no tech bonus when factories choose what to build. Building higher-tier factories is not delayed.

Play style fields

Field Type and bounds Meaning
attack_cooldown_sec Nonnegative number Minimum interval between attack commitments; difficulty or style. Built-in presets scale the difficulty's cooldown by play style.
attack_patience_sec Nonnegative number Seconds the attack pool waits since its last attack before it attacks at even strength instead of attack_commit_ratio; with [economy] commit_ratio_decay each further period waited since then, or since an attack last came home beaten, halves that, down to an eighth. 0 turns this off.
defense_share, army_share Numbers, 0–1 Defense and army allocation preferences. Static defense's share of military spending is defense_share / (defense_share + army_share); defense_share also sets the defense count as a share of the AI's own structures.
attack_commit_ratio Positive number Own-to-enemy power ratio required to attack.
retreat_fraction Number, 0–1 Fraction of committed power below which the force retreats.
min_attack_squad Nonnegative integer Minimum attacking group size.
first_attack_sec Nonnegative number Earliest second a push, bomber run or air drop may set out.
raid_squad Nonnegative integer Fast units in each raid party sent at outlying enemy extractors ([economy] raid_groups, and only with raids). 0 sends none. Built in: Defensive 0, Balanced 3, Aggressive 3.
first_raid_sec Nonnegative number Earliest second a raid party sets out. Built in: Defensive 0, Balanced 240, Aggressive 120.
opening_army_units Nonnegative integer Army units the opening builds toward before its first attack. Built in: Defensive 6, Balanced 8, Aggressive 10.
opening_raiders Nonnegative integer Raiders the opening queues first, ahead of constructors, anti-air and artillery, once a first constructor besides the commander is made ([economy] raid_groups); never fewer than raid_squad. Built in: Defensive 0, Balanced 3, Aggressive 8.
raid_probe_sec Nonnegative number Until this second, a raid party that knows no target goes to look at the unseen metal spots on the enemy's side of the map (at least 900 world units from its base), and takes any target it sees on the way. 0: it waits for a target seen. Built in: Defensive 0, Balanced 0, Aggressive 600.
regroup_size_cap Positive number After a beaten attack, the most the next one needs, as a multiple of the strength the beaten one set out with ([economy] regroup_by_strength). Built in: Defensive 2, Balanced 1.5, Aggressive 1.
form_up_wait_sec, form_up_max_sec Nonnegative numbers A far attack stops short of its target to gather, then goes in together this many seconds after its first unit got there, or this many seconds after it set out, whichever is first ([economy] style_push_pacing). Built in: Defensive 60 and 240, Balanced 45 and 180, Aggressive 15 and 60.
reinforce_wave_min Positive integer Fewest units sent at once to join an attack under way (style_push_pacing). Built in: Defensive 2, Balanced 2, Aggressive 1.
losing_retreat_ratio Nonnegative number An attack that has lost 35% of what set out turns home once its strength is under this share of the enemy's where it fights (style_push_pacing). Built in: Defensive 0.8, Balanced 0.6, Aggressive 0.4.
raid_share Number, 0–1 Size of the opening raid: with a constructor and resources not starved, factories build ceil(min_attack_squad × raid_share / 0.25) raiders (at least 1, at most min_attack_squad) before extra constructors. 0 builds no opening raid.
attack_directions Positive integer Approaches a push splits into: one straight at the target, the others to points beside it on alternate sides. A push splits only as far as free attack groups and at least 6 units per approach allow.
chokepoint_defense_layers Nonnegative integer Defence rings, two defences each, at the nearest two ground chokepoints within reach of the base, built while the base is not under threat; 0 defends the base only.
defense_artillery_share, defense_anti_air_share Numbers, 0–1, together at most 1 Shares of defences that are artillery and anti-air structures, counted by number of defences; the rest is direct fire. Each new defence is of the kind furthest below its share, unless the builder offers none of that kind. While the base is under threat any defence may be built.
strategic_weight Nonnegative number Scale on the proactive strategic urgency (urgency_strategic); the counter urgency is not scaled.
expansion_reach Positive number Farthest new extractor claim from the base, as a fraction of the distance to the nearest enemy start; never less than 1200 world units. It also bounds the chokepoints defended.
adaptive_stance Boolean Once an enemy army has been seen, lean halfway toward the same level's Defensive profile when losing and its Aggressive profile when ahead. The lean moves defense_share, army_share, attack_commit_ratio, attack_patience_sec, first_attack_sec, raid_share, min_attack_squad, attack_cooldown_sec, retreat_fraction, raid_squad, first_raid_sec, opening_army_units, regroup_size_cap, form_up_wait_sec, form_up_max_sec, reinforce_wave_min and losing_retreat_ratio; whole-unit values round down. opening_raiders and raid_probe_sec do not move.
stance_losing_ratio, stance_winning_ratio Nonnegative numbers; with adaptive_stance, losing at most winning Own-to-enemy army power below which the stance defends and above which it attacks.

Other integer fields fit a signed 32-bit integer. Unknown names, wrong types, out-of-range values and files larger than 64 KiB are rejected with a field error. There is no partial acceptance of a malformed policy. A [director] table is refused too: a mod names its AI director in mod.toml (AI_DIRECTOR.md), and the resolved policy carries that script, so everything below applies to the director as well. The AI activation log reports the resolved cadence, command budget, policy fingerprint and director.

A policy overlay (a tuning candidate run over a match's resolved policy, overlayAiConfiguration) replaces the policy's tables but keeps the base policy's director unless the overlay carries its own [director] table, so a mod's director plays in every tuning game of that mod. An overlay whose result with the director exceeds the policy bound is refused.

Saves, replays and multiplayer

Settings resolve when a match loads. Saves retain the complete effective policy; later file edits apply to new matches. AEX writes the resolved policy with a [compatibility] table whose policy_revision says which rules the match was made under; a mod's ai.toml may not set it. A stored policy without it predates the current rules and keeps them on restore: there the AEX AI also plays a seat's TA build profile, and any level may carry an income multiplier or fog sight. AI plans still rebuild on restore as described in savegames.

Replays carry policy in their initial checkpoint. Multiplayer checks the resolved packaged policy at join and refuses differing settings, including differences within the same named mod version. Formatting and comments do not change the fingerprint. Restored matches use their checkpoint's effective policy on every peer.

This configures the existing AI systems. Map analysis, movement, production scoring constants outside these fields, and other engine rules retain their existing owners and defaults.