Skip to main content

AI

Verified via reverse engineering

Traced through GhidraMCP against the symbolized FarCry2_server; the brain contents are read out of the shipped mercbrain.ai.rml. The workspace loader, GetChanceOfSuccess, ManageIntuition, AdjustFOV and the vision evaluators were matched in the retail PC Dunia.dll (Steam) and behave the same. See intro for how RE-verified and community-reported claims are distinguished.

A soldier's behaviour is split between C++ and data. C++ decides which behaviour runs and how well he sees and shoots; data decides what each behaviour does. The class hierarchy and the CAIEngine bootstrap are in Architecture; this page is about how the pieces decide.

LayerWhere it livesEditable
Which behaviour runsCBrainMerc* classes, fed by agent flags and squad orderspartly - through the flags
What a behaviour doesplans and tasks in mercbrain.ai.rmlyes
How far and how well he seesSensorySystem of the archetype's CPawnAgentyes
How often he hitsShootingSystem of the archetype's CPawnAgent, and the weaponyes
How likely optional tactics areAdaptativeBehavior in gamemodesconfig.xmlyes

All of it is editable in JackAll's AI tab. Animals have their own agent, described in Animals.

Brains and behaviours​

CBrainMerc is a CBrain: a plan that, every update, asks C++ which behaviour filter applies and runs the plan its Selectable for that filter names. The top layer's filters are the brain states:

MercBhvIdle, MercBhvAlert, MercBhvCombat, MercBhvDead, MercBhvThreshold (wounded and rescue), MercBhvSpecial (burning, drowning, falling), MercBhvSocial, MercBhvVehicle, MercBhvDomino, MercBhvScriptedMode

Each selects a sub-brain that does the same one level down. CBrainMercCombat, for instance, picks among 41 filters: CombatLongFireRange, CombatMediumFireRange, CombatShortFireRange, CombatKillFireRange, CombatThrowGrenade, CombatPassiveLeapFrog, CombatRushTarget, CombatHigherTarget, CombatNoCoverRunToThreat, ShootFlare, CombatBuilding, FriendDied, Relocate, GrenadeEscape, EscapeFlameThrower and others. The choice is C++; the plan each one runs - where to move, when to crouch, how to fire, what to say - is data.

How combat picks a behaviour​

CBrainMercCombat::DoStart walks a fixed priority chain and hands the first match to the brain with CTask::DispatchConnection(brain, ANCHOR_SELECTABLE, filter). Most links of the chain test one of the agent's 64 flags - requests, several of which the chain clears as it acts on them. Flags are set by C++ (squad orders, senses) and by the brain itself through CTaskOperateOnFlagField (FlagFieldValue is the index), so a plan can ask for any of these on the next update:

FlagSelectsSet by
14ShootFlaresquad order SendFlare
15CombatSelectBestTargetSetNewBestTarget tasks
16GrenadeEscapeCPawnAgent::EscapeThreat; a vehicle's CommandEscapeProjectile
17SwitchToFireAlertCScannerFireProximity, the threat search
19 / 59EscapeVehicle / EscapeFriendlyVehicleCPawnAgent::CheckIncomingVehicle
25MercBhvHurtSetPlayHurt
32MountedWeaponthe UseMountedWeapon plans
43CombatRushTargetsquad order RushTarget
45RelocateSetNeedToRelocate, the ScanRelocate scanners
53CombatRushClashPointthe squad lieutenant, only in the Town Escape mission
55CombatNoCoverRunToThreatthe NoCoverMoveAttack and NoCoverOrNoPathFailure plans
56CombatHigherTargetSetTargetHigher in the CheckHeightDiff plans
57FallBackToStartPositionsquad order Fallback, SetFallback tasks
61ScriptedShootAtTargetDomino
63ShotByAnotherTargetCSensorySystem::SetShotByTarget

Two of these are narrower than their names suggest. CDispatcherSquadLieutenant::CheckSpecialMissionBehaviour sets 53 on every squad member without a long-range weapon, and only while the army's mission type is 6. The story-mission scripts set that type: 1 Defence Reversal, 4 Buddy Betrayal, 5 Barge Assault, 6 Town Escape, 7 Dental Plan, 8 Jack's Buddy. So the rush to a clash point is the Town Escape set piece and nothing else. SetShotByTarget sets 63 only when the shooter is the player and the soldier's current target is someone else or no one. He must also be in combat (army-member states 3-5) or alert after combat (state 2 with flag 7). The branch turns him onto the player.

C++ also sets and clears flags that no filter tests, so they only matter to the plans that check them: CTaskShoot raises 50 while firing and sets 49 when it gives up on a blocked shot; SetIsInPathFollow sets 54; the smart-terrain executor sets 60; each brain's DoStart sets 26. CBrainMercThreshold clears most of the combat flags when a wounded soldier recovers.

Links without a flag are situations: first contact (CombatFirstTime), starting from social, trespass or a vehicle, sniping, a building, reload, target too close, the range bands below, and CombatNothing as the fallback. The flag meanings are read off the names of the tasks that set and test them; the chain's order and the flag checks are read out of the code.

"Target too close" is a blackboard fact, not a flag. Every CScannerIsInDistance with CheckIsInside 1 writes ThreatTooClose while its reference is inside its distance, and the chain picks CombatTargetTooClose when the fact is there and clears it (traced in the server build). In mercbrain that plan stands and fires for at least 5 s. The combat plans start a CheckCloseTarget copy that stops them at 6 m (5 m when attacking a higher target), but only once the target is in plain sight. A move toward a hidden target is not stopped: the kill-range run at a target with no cover follows its path to the target's last seen spot with no stop distance.

A plan starts the tasks wired to its OnStart anchor and each task's exits (Success, Failure, class-specific ones) start the next. Scanners are tasks that watch a condition and fire an exit when it changes; they interrupt plans the same way. Tasks share state through the agent's blackboard (CFact<…> values such as BestTarget, NeedReload), set by CTaskUpdateBlackboard and read by CTaskCheckFactExist / CScannerFactExist.

Range bands​

CPawnAgent::FindFireRange buckets the distance to the target, rounded to whole metres:

BandDistance
kill≤ 12 m
short13-25 m
medium26-35 m
long36-50 m
none> 50 m

ComputeCurrentFireRange computes it only in the combat states (army-member states 3-5), both for the target's current position and for its blackboard BestTargetLastPosSeen. The bands are constants in code, read in the server build; the Steam build's are not matched, and on the test range soldiers 36 to 41 m from the player ran the medium band's plan.

Sniping​

The chain's sniping link takes a soldier whose archetype sets bHasALongRangeWeapon (CPawnAgent::HasALongRangeWeapon returns the flag as is) once his target is farther than the brain's SnipingRange, 20 m in mercbrain. Rocket men set it, so beyond 20 m they snipe. CombatSnipingPlan then draws the special weapon and stays until the target comes within 15 m. The traced in the server build parts:

  • What he fires depends on the weapon in hand. The shoot phase tests it with CTaskCheckPlayerAction and CheckPlayer 0, which reads the soldier's own equipped weapon's class (CheckWeaponMatch). PlayerWeapon 0 is a flamethrower, 1 a mounted weapon, 2 a machete, 3 a sniper rifle, 4 an RPG, 5 a Carl Gustav, 6 a mortar, 7 a shotgun, 8 a pistol, 9 an assault rifle, 10 an SMG and 11 an LMG. An RPG or a Carl Gustav fires through the rocket loop and a mortar through the mortar loop; anything else, a sidearm included, through the sniper loop.
  • No task can test a weapon he is not holding. To learn what his special weapon is, the soldier must draw it.
  • Closer than 20 m he uses his sidearm. The range-band plans run a fire strategy that swaps a special weapon for the primary or secondary.
  • CTaskSwitchWeapon with weaponSelected primary draws the secondary when he has no primary. desiredWeaponClass, when he carries that category, overrides it.

Combat Overhaul's brain keeps the launcher for a player in a vehicle (design log).

Grenades​

Every enemy inventory pack in gamemodesconfig.xml (assault, shotgun, sniper, RocketLauncher, Mortar, CarlGustav) gives three M67 grenades. A gadget's state (CGadget +0x24) holds its uses (+0x7C in Steam) and a flag (+0x80) that makes CGadget::DecreaseUses (Steam 0x10149690) spend none. A soldier's grenade has the flag set, so his throws never use one up (seen in game with fc2drive, GOG v1.03).

The combat brain has its own throw, CombatThrowGrenade, which runs CombatThrowProjectile. The chain picks it when the blackboard fact ThrowGrenade (CRC32 0x417D566B) is there, right after CombatTargetTooClose, and removes the fact. Nothing in the shipped game writes that fact: the code reads it only in CBrainMercCombat::DoStart, and no mercbrain task names it. So the plan never runs. Its trajectory task has no limits switched on and aims at the target itself (traced in the server build). A CTaskUpdateBlackboard that creates the fact by name does select it.

Two other throws do run:

  • The squad loses the player. The lieutenant drops a target once no member has seen it for 10 s plus its camping score. When its last target goes, CDispatcherSquadLieutenant::BroadcastTargetLost sorts the members by distance to their BestTargetLastPosSeen. If the nearest is more than 10 m from it and a roll comes out over 50 %, the two nearest get rush type 5 and the rest wait (type 3). Otherwise up to four rush the spot by the lieutenant's rush types. SearchTargetLost keeps the type at agent +0x934, and the alert brain runs type 5 as GoThrowProjectile: a tactical path to the spot, a stop 15 m short of it, and a throw at it with at most 2.5 s in the air and 20 m/s across, coming down at 25°.
  • The player in a building. DealMercSuspiciousBuilding orders a member to throw inside when IsAgentValidForGrenadeBuildingAttack passes: he is alert or active (army-member states 2 or 4), in no building himself, within 30 m of the building, with an entry near him, and his grenade has uses left. The order raises flag 20 and sets the fact GrenadeTargetBuilding (traced in the server build).

CTaskComputeProjectileTrajectory::ComputeGrenadeTrajectory with ApproachAngle on takes the flight time squared as 2(tan(angle) · d − dz) / −9.82, and refuses a throw past MaxFlyingTime or MaxHorThrowSpeed. With testTrajectoryClearance it then checks the arc with rays, and a failed check ends the task with no throw. A throw coming down at 25° does not clear a low wall 3 m in front of its target; one coming down at 45° does (seen in game with fc2drive, GOG v1.03).

When a pawn dies, CGOStateEventInventory::DropGadget (Steam 0x10CE1A80, __thiscall with the pawn on the stack, RET 4) rolls ChanceToDropGrenade. It then asks the pawn's counters CanDropGadgetUponDeath (vtable +0xA0), which says no once DamageHealth has set its flag. If both pass, it drops one grenade pickup whenever the inventory holds the grenade gadget at all, whatever its uses. A throw never takes the gadget out: CGadgetUseThrowStrategy::Throw only calls DecreaseUses, so a soldier who threw his last grenade still drops one (traced in the server build). SInventoryViewPawnImpl::OnSpawn (Steam 0x10126C00, no arguments) equips the pack whose name's CRC32 sits at the inventory's +0x08; the pawn is at +0x48.

Combat Overhaul gives every soldier one grenade that his throws spend, and asks for the combat throw (design log).

Squads​

Every army is run by a CDispatcherSquadLieutenant, a C++ commander above the individual brains. It tracks its members and their targets, and orders them through CEventMercCommand* events (SetSquadRole, SetSquadAction, SquadImmediateAction, RushTarget, CombatTarget, SetRallyPoint, SendFlare, LaunchGrenadeInBuilding, Fallback, LastManStanding and more). It decides who suppresses (IsNeededAsSuppress, per range band), when a member switches to assault (IsSwitchToAssaultNeeded), runs rush patterns, picks who fires the flare, and calls in reinforcements.

FindRoleDistribution (Steam 0x10934E10, __thiscall with three stack arguments, this unused) splits a squad of n between assault and suppress by difficulty: on the lowest setting one member assaults and the rest suppress; on the two middle settings 70 % of the squad assaults, rounded down, on the highest 90 %; a lone soldier assaults. ManageArmyMembersCombatRole counts only members in the kill, short and medium bands of where they last saw their target, and IsNeededAsSuppress makes every member past them an assaulter and every one in his kill band a suppressor, so the split holds within 35 m. A member's role is CPawnAgent +0x250, 0 assault and 1 suppress, which CTaskCheckArmyRole reads for the brain's RoleAssault and RoleSuppress; CTaskCheckSquadRole and CTaskCheckSquadAction exist but are unused (RE-verified: the server build's functions and the Steam split; the 1-and-2 split of three on the test range).

The army-member states the lieutenant and the senses switch on are, by number: 0 social, 1 idle, 2 alert, 3 passive, 4 active, 5 defensive, 6 threshold, 7 dead, 8 briefing (read off CSensoryStimProcessor::ProcessStim's switch). "The combat states 3-5" on this page are passive, active and defensive.

Two more lieutenant rules, RE-verified:

  • Camping. Once a second it scores the player for staying put: +0.5 for moving less than 1 m, +0.4 under 3 m, +0.3 under 5 m (GOG 0x109225D0, Steam 0x109335C0). The score does not decay there. It lengthens the squad's memory: the lieutenant drops a target 10 s plus the score after it was last seen, so a player who stays put is hunted longer. The targets are a list on the army, each entry holding the target, where it was seen and when (UpdateTargetList, Steam 0x1093A2A0, which prunes at most every 15 s).
  • Last man standing. A member who is up and not in the threshold or dead state is sent LastManStanding when no other such member is within 200 m (CheckLastManStanding). The order only sets flag 42 (CPawnAgent::LastManStanding). In mercbrain the combat plans' common ScannerLastManStanding tests it and plays a bark (TalkAboutLastManStanding, bark event 11), so the last man calls it out and fights on as before.
  • Roles balance suppressors against assaulters per range band (IsNeededAsSuppress); a member who suppresses has flag 9 set.

How an alert ends​

Each time a soldier's top brain restarts, CBrainMerc::DoStart picks his state again. A soldier who was searching for a lost target (flag 18) goes back to idle only once his blackboard holds ItMustHaveBeenTheWind, and in mercbrain only the idle brain's look at something glimpsed sets it. An alert entered any other way, from a gunshot or a target lost in a fight, never ends on its own:

  • SearchTargetLost loops, moving him between covers and random spots near where the target was lost. Its 20-30 s timer only plays a bark and sets flag 27.
  • WaitAlerted, what the alert brain picks when nothing else applies, waits 1,000,000 s.
  • The way home is FallbackToStartPositionBP1, chosen while flag 57 is set. It walks him, aiming along the path, to EngagementStartPosition, where he stood when he went from idle to alert, then clears 57, sets 58 and ends the alert brain. The game sets 57 only 10 s into a search while the player is inside a safe zone.

This is traced in the server build (CBrainMerc::DoStart, CBrainMercAlert::DoStart) and the shipped mercbrain, not yet matched in Dunia.dll. Combat Overhaul's brain sets flag 57 two minutes into an alert (design log).

Under fire​

A bullet stim from an enemy reaches a soldier's CSensoryStimProcessor::OnBulletShot (Steam 0x10A24770) when it hits him, lands near him, or passes close to his head: every shot tests each enemy pawn's distance from its line, against the weapon's fShotJustMissedDistance or 4 m. Each marks him under fire with the shooter's position. A near miss also makes him flinch, at most once in 3 s (CPawnAgent::SetBulletJustMissed, Steam 0x10960880, which keeps the time at +0xA94).

In mercbrain, the ranged-attack plans react only to a bullet inside a capsule 1 m in radius and 2 m tall around him: it stops his suppressive fire and starts the assault plan, which looks for cover (flag 48). A bullet that misses by more changes nothing but the flinch. All of this is traced in the server build and the brain data; the two Steam addresses were matched in Dunia.dll.

The mark itself is what CScannerIsUnderFire reads: it fires while the time since the soldier was last marked (CSensorySystem::IsUnderFire, the time at +0x10C, the shooter's position at +0x110) is within its TimeTolerance, which when negative is 1 s in army-member state 2 and 5 s otherwise (traced in the server build). In mercbrain only the sniping plans (ManageUnderFire in combat, SnipingBehavior in alert), the domino shoot and the wounded soldier's plans scan it.

A soldier who sees a squadmate killed gets flag 38, which ScanFriendDied in every range band turns into a restart of combat, and the chain's FriendDied link runs CombatSawFriendDied: he stands, stops firing, aims and looks at where his squadmate died, and 1 s later combat starts over. The flag is set on the death event (CPawnAgent::OnEvent) only when the dead man is in the soldier's sensory memory as fully seen with a visibility above his own clear line (+0x974, 0.4 by default), and UpdateFriendDiedInfos clears it 2 s after the death. His sensory memory holds his own army only in the idle and social brains: those set the focus filter to every army (0x1F), while the alert, combat, special, wounded and vehicle brains set GetLimitedFocusFilter, which leaves his own army out (traced in the server build). So a squadmate killed in a fight is never seen, and one killed in front of an idle soldier is seen, but the shot's alert brings the onlooker into combat about 2 s later, once the flag is gone: on the test range three idle riflemen, one killed by a single shot 25 m away, never ran CombatSawFriendDied (fc2drive, GOG).

Onlookers who cannot see the shooter take the alert brain's SniperAlert 0.2 s after the death. Each draws his gun, which takes 0.35 s, and runs to cover against where the shot came from. A soldier with no cover in reach crouches and flees from the shot for 3 to 4 s instead. Then he crouches and waits, looking left and right, until he finds the shooter. None went to the body (SawCorpse). On the test range, the player crouched in tall grass killed one of three idle riflemen 80 m away with a single AS50 shot. One onlooker ran 25 m to cover in 7 s and the other fled (fc2drive, GOG).

Reinforcements​

The reinforcement system calls in mercs and vehicles from CReinforcementPoints placed in the sectors. Each wave takes its archetypes from the point's own MercNames and VehicleNames (ExecutePendingReinforcementRequest). The rules, RE-verified on GOG:

  • When a region may call. A region without its own budget may call only while its counter is below 1 in world 1 and below 2 in world 2. It also needs fewer mercs than iMercDensityThreshold and density to spare (0x10921B50).
  • How many at once. Fewer than 5 reinforcement vehicles and fewer than 20 mercs, pending and active together (0x10919E40).
  • How often. A region waits 120 s between calls, 0.5 s for an instant region. After a failure it retries after 15 s, or 1 s for an instant region.
  • How far the point is. 15 m to 181 m from the target, or 15 m to 50 m for an instant region. For some armies the minimum drops away, but the maximum stays.

gamemodesconfig.xml's ReinforcementArchetypes feeds a separate path only: GetReinforcementArchetype has one caller, SpawnWildReinforcementScenario, which CPawnAgent::OnEvent starts. Which event starts it was not traced. Editing that list does not change what a point's waves bring.

Garrisons and patrols​

A post refills when its sector reloads. Soldiers do carry a CPersistComponent: every enemy_archetypes.Blue_Faction.*, Red_Faction.* and Special.* archetype has selLevel 1, as do the ghost patrols. But CPersistenceDB::SaveEntity saves a world-spawned entity only at level 2 and up, or at level 1 when the persistence budget is −1. The shipped PersistenceBudget is 1000, so soldiers are not saved.

What keeps a dead soldier gone for a while is the dynamic-entity limiter. A removed body is recorded as deleted in its sector, and the sector's spawn list skips deleted entities when it loads. When a sector's main layer unloads, ForgetDeletedInSector (GOG 0x1055A520) wipes that sector's list, and the next load spawns the full garrison again (RE-verified). On the server a corpse is removed only when its list is full; the 15 s age limit applies to the physics-body list alone. Which lists the PC build enables was not traced, and whether a budget of −1 makes soldiers persist is untested.

Ghost patrols are rebuilt each time. Every GhostPatrols.Patrols.* archetype is bIsPersistent = False with fSpeed 8. When such a patrol respawns, CGhostManager sends an event that spawns a new vehicle, rather than restoring the old one. While ghosted, out of sight, the patrol moves along its path at fSpeed × time (CGhostEntity::GhostUpdate). A blocked spawn point moves it one more second along its path. Convoy and CopKiller ghosts are persistent and disabled. This is RE-verified on the server and seen in data.

Seeing​

The archetype's SensorySystem gives a focus cone and a wider peripheral cone under three names - DesertFOV, SavannahFOV, JungleFOV, each with fLength and fAngle, the full angle in degrees. Only DesertFOV is ever read, in every kind of terrain: the target scan passes the sensory system's first cone pair (+0x88), and the one cone getter returns that same pair with no region argument (0x109f3e50, 0x109f1d50 in the GOG build, RE-verified). The other two are loaded and never used, so editing SavannahFOV or JungleFOV changes nothing. CSensorySystem::AdjustFOV sets both cones again for every target on every update:

  • Length is DesertFOV's fLength times the night term. In combat it is also times fCombatMultiplier, and when alerted before or after a fight times fPreCombatMultiplier or fPostCombatMultiplier; when idle there is no state multiplier. While he aims a sniper rifle it is times fSniperLengthMultiplier. Against the player in a vehicle it is times fPlayerInVehicleMultiplier, by day or with the vehicle's headlights on. Then it is capped: 150 m against the player, 350 m through a scope, less against other soldiers.
  • Angle is DesertFOV's fAngle, times fSniperAngleMultiplier through a scope. A soldier sitting in a vehicle sees all around him: both angles become 360°, whatever seat he is in. Which seat is in the vehicle's CVehicle properties (+0x10): the seats at +0x0C, their count at +0x10, each 0x50 bytes in the Steam Dunia.dll (0x4C in the server), with the role at +0x10 (1 the driver, 3 a Datsun's passenger), the occupant's 64-bit entity id at +0x28 and the state at +0x30, 4 for seated (seen in game: the player at a Datsun's wheel).

The night term is 1 − night × fNightTimeMultiplier. night is 0 by day and 1 at night, and ramps between them across dusk and dawn, four times kept by the dynamic environment manager. With the shipped 0.5, cones are half as long at full night. This is the only thing darkness changes. Against a target that fired a muzzle flash in the last 3 seconds the term is 1: firing at night gives you away as if it were day.

Inside the cones, VisibilityEvaluatorParameters weigh how visible the player is from 0 to 1: distance, cone edge, body coverage, occlusion, vegetation, stance and movement, each with its own weight, plus grass, whose weight is not exposed. fAmbientLightEvaluatorWeight is loaded but never read: there is no light evaluator, so no light in the scene, the sun included, reaches the AI.

Two of them depend on the cones (Steam, RE-verified against the server):

  • FOV (CFOVEvaluator::ComputeVisibility, 0x10A21380): 1 inside the focus cone's angle, then falling linearly to 1 − fFOVEvaluator_VisibilityFactorAtFOVLimit (0.5) at the peripheral cone's edge, 0 outside it. A glimpse at the edge of the periphery can therefore still be a clear sighting.
  • Distance (CDistanceEvaluator::ComputeVisibility, 0x10A20FA0, a vtable slot the analysis did not make a function): it uses the focus cone's length whatever the angle.

A soldier sees a target plainly only inside both cones. Each vision update clears the target's knowledge flags and sets one per cone the target is in; GetVisibilityValue without its "remembered" switch needs both. With the shipped 60 m focus and 40 m peripheral cones, a player 40-60 m away straight ahead counts as not plainly seen.

For each candidate target, AddPawnsToKB resets the cones, lets AdjustFOV set them, then calls CSensorySystem::AddTargetDataToKB (Steam 0x10A03120, RET 8; this the sensory system, then the visual target and the visibility context). The context there holds the final cones at +0x04, the observer at +0x08, his eye at +0x10, the target's head at +0x1C and his view direction at +0x28. The cone record keeps the archetype's own values beside the adjusted ones: focus length and angle at +0x08/+0x0C adjusted and +0x10/+0x14 as authored, peripheral at +0x1C/+0x20 and +0x24/+0x28 (SPawnFOVPerRegion::ResetFOV copies the authored ones back). The knowledge entry the call updates stores where the target was last perceived at +0x28, its head at +0x34 and its distance at +0x40. This is traced in the server build and matched in Dunia.dll.

In the range, stock and modded alike, a rifleman facing a player standing in the open 50 m away only investigated, walked to where he had noticed him, and passed a player who had stepped 5-10 m aside.

Seeing is not recognizing. Visibility becomes a threat only in CTaskFindVisualThreat (Steam 0x1099A050, RET 4): it sorts every agent he sees into clear threats (above his "clear" value) and faint ones (above "fuzzy") and succeeds once either list holds anyone, which sends a target-seen report. It keeps polling while it finds nothing. The idle brain starts it once; every alert plan starts it at its OnStart. So an alerted soldier whose search has just reported a faint sighting looks no more until his next plan starts (traced in the server build, matched in Dunia.dll). In the range no soldier was ever seen in that state: a mod that kept the search going never acted. The search reads visibility through GetVisibilityValue without its "remembered" switch, so it counts only targets plainly seen, inside both cones: a glimpse in the periphery alone is never even a faint threat, and soldiers never notice anyone from the side. SetVisibilityValues also sets two more values per state (idle 10 and 50, alert 1 and 50, threshold, special and vehicle 1 and 100, combat untouched); what reads them was not traced. The agent's ThreatLevel meter is fed only by Bang and Fear stims.

The evaluators combine as a product: each with value e and weight w contributes 1 − (1 − e) × w (CVisibilityEvaluator::Evaluate; GOG 0x10A0BFC0, Steam 0x10A1D8A0, RET 8). A weight of 0 skips the evaluator. An evaluator that returns 0 makes the whole product 0, whatever its weight. The evaluator holds its list at +0x08 and the count at +0x0C; each entry gets the context at +0x24 and keeps its weight at +0x2C, with ComputeVisibility in vtable slot 0x14 and an "always visible" test in slot 0x0C, which the distance check fills with its 2 m rule. The server names eight; Dunia.dll has no RTTI, so on Steam they are known by what each reads: distance 0x10A20FA0, FOV 0x10A21380, body sampling 0x10A21D90, occlusion 0x10A22120, vegetation 0x10A222B0 (bushes and trees), grass 0x10A226C0, stance 0x10A22BB0, speed 0x10A22DF0. The night term reaches AdjustFOV as its last argument, already forced to 1 by a muzzle flash; CSensorySystem::GetTimeOfDayFOVMultiplier (Steam 0x10A01200) gives it without, from the shipped fNightTimeMultiplier at +0x40. Within that product (RE-verified on GOG and the server):

  • Distance. Full visibility inside the first fDistanceEvaluator_FullVisibilityRatio of the cone's length, falling linearly to fDistanceEvaluator_MinVisibilityAtMaxFOVRange at its end, 0 beyond. A target within 2 m is visible outright. A player with his back to a soldier who is not in or just out of combat counts as 1 − ramp(d, 5 m, 15 m): unseen beyond 15 m.
  • Stance. Crouching (stance 1) is 1 up to 15 m, then falls linearly to 0.6 at max(35 m, ⅔ of the cone). Stance 2 and swimming are 0.6; stances 0, 3 and 4 are 1. A target at least 0.5 m under water is invisible.
  • Movement. 1 − (1 − fSpeedEvaluator_StandingStillVisibilityFactor) × (1 − s) × ramp(d, 10 m, max(20 m, cone)), where s is the target's speed against a reference speed, clamped to 0–1. So standing still only helps beyond 10 m.
  • Body coverage. For a player on foot, CPawnSamplingEvaluator (Steam 0x10A21D90, RET 4) casts three rays at points on his body and counts a third for each that gets through, scaled by the transparency of anything it passes. Walls count here; COcclusionEvaluator reads only AI occlusion volumes. In the range a player standing behind a 1.3 m barrier, or crouched behind a 1.4 m wall, had half the visibility he had in the open. The rays run from the observer's limb 2, 1.74 m up on a standing player, to the target's limb 1 or 2 at random and limbs 4 and 7, the last two moved up to 0.075 m aside. They take the collision layers 0x33, the ground and solid things but no bodies, and are asked of the physics world (this at Steam 0x11613D60), which answers them in the next frame: ask 0x1048DD40, answer by the returned id 0x1048DD50, each hit 0x30 bytes with its position first and its distance at +0x1C. CPhysWorld::RayCheck (Steam 0x1048DD30, RET 0x18) answers at once. Grass stops none of them, since no grass or bush mesh has the physics bit (flags): a soldier sees through tall grass that hides him from the player (RE-verified; the queue's answers seen in game). A CPawn's limb positions come from the limbs at +0x04 of its data block (Steam 0x1010D780, RET 8).

Grass and stealth​

The grass evaluator is the player's camouflage. It needs a CStealthComponent, which only the player archetypes carry, so it is 1 for anyone else. CStealthComponent::Update sets its flags only while the player is crouched, samples the grass every 0.25 s, and counts him as hidden once he has been crouched in high grass for more than a second without moving 0.2 m.

High grass is the vegetation the world places, not the ground. Each sample tests three points around the player, his front, left and right, and he is in high grass when two of them are. A point is in it when a placed tuft stands within 1.5 m of it, unburnt, of a mesh whose playerCoverage is at least 1 (CStealthComponent::InHighGrass, server 0x0883E250, Steam 0x106991D0 with RET 4 and its object unread; RE-verified). Only five shipped meshes have that, the tall savannah grasses and sorghum, so the multiplayer grass looks the same and hides no one. They stand 1.2 m, _bold 1.4 m. On the test range a crouched player in 1_grasssavannah_b reads in grass on the Combat Overhaul's perception line and in 1_grasssavannah_b_mp does not (fc2drive).

  • Concealment is 1 − ramp(d, 3 m, 10 m) × k. k is 0.9 for an idle observer, 0.765 for one alerted before a fight, and 0 in or just after combat. The observer's side of the player picks which grass sample counts, front, left or right. An observer looking down at more than 30° is not fooled.
  • Camouflage: with a stealth bonus and the hidden flag, outside combat, the player is invisible beyond 2 m to an idle observer and beyond 4 m to an alerted one. It never applies in the game as shipped: the evaluator reads the bonus inverted, -1 for the camo suit's stealth_camouflage plan, and asks for more than 0. Read as it is, a crouched, still player in the test range's grass went unseen (Combat Overhaul diagnostic; RE-verified and in game). Lua's Game:AddBonusPlan("stealth_camouflage") gives the suit; the console's add_bonus_plan puts its argument into that call unquoted and gives nothing.

This is RE-verified (CGrassEvaluator, GOG 0x10A10DD0).

Bushes and trees​

The vegetation check counts RealTrees only, the bushes and trees the world scatters; grass meshes never. It asks CAABBPartitionManager::GetCombinedTreeVisibility (Steam 0x105318F0, RET 8) about the line from the observer's body part 2 to the target's part 5, his torso. That walks the 16 m cells the line crosses (CamouflageHitTest) and adds up CamouflageHitTestEntry (Steam 0x1052FFE0, RET 0x20) for each RealTree in them, stopping past 1. The check is 1 less the sum, so with the shipped weight of 1 two bushes squarely on the line hide the target completely. The check takes the partition manager from a reference-counted handle in the global at Steam 0x11645C24, at its +0x0C, and flushes it (Steam 0x104DD4F0) before asking, so anything else can ask the same way.

A tree adds its species' camouflage, less the share of its leaves that have been shot off (RTxcSimulation::GetCombineCamouflage, Steam 0x10467F90). It adds it in full where the line passes within half the radius of the species' camouflage sphere, falling to nothing at the radius. The sphere is not turned with the tree. Both values sit in the species' skeleton.

SpeciesCamouflageSizeCamouflage sphere
rt_bush_ziziphus0.91.7 × 1.9 m, 1.8 m tallradius 0.67 m, 0.64 m up
rt_bush_tamarix_small0.92.4 × 2.5 m, 2.7 m tallradius 0.82 m, 1.22 m up
rt_bush_tamarix_medium0.94.0 × 4.1 m, 3.3 m tallradius 1.45 m, 0.80 m up
rt_tree_acacia0.339.7 × 8.8 m, 5.8 m tallradius 2.55 m, 4.65 m up
rt_tree_baobab_a0.1414.8 × 13.4 m, 14.1 m tallradius 5.69 m, 10.32 m up

Every savannah bush has 0.9, and its sphere is small for its size. A line across a bush's top, its side or its lower half misses most of the sphere, and the soldier sees through the bush. A tree's sphere sits in its crown, so a line under the crown passes clear, as it should (RE-verified on Steam and the server).

Hearing​

Sound reaches soldiers as stims. Only the player's archetypes carry Stim_FootSteps: type Snap, level 1, 7 m, with falloff. A weapon's muzzle stim is type Bang and falls off to level 1 at its radius, as the entity data gives it:

WeaponLevel, radius
AS5012, 200 m
M249 mounted11, 85 m, no falloff
AK-478, 75 m
Makarov, MK19 mounted7, 50 m
MK19 carried10, 50 m
MAC-108, 3 m
MP53, 5 m
Dart Rifle, 6P92, 2.5 m

The Carl Gustaf, the LPO-50, the crossbow and the DLC shotguns have no muzzle stim.

CSensoryStimProcessor::ProcessStim drops a soldier's own stims. It also drops his own army's, unless he is in the social state or the stim comes from a vehicle's AI. An idle soldier who hears a Bang files a threat report 0.2 s later at priority 7; a Snap files one at its own priority. All of this is RE-verified on the server and seen in data.

Every stim a soldier receives passes CSensoryStimProcessor::ProcessStim (Steam 0x10A25EC0, RET 4), once per listener within the stim's radius, before it switches on his state at the agent's +0x274: 0 social, 1 idle, 2 alert, 3-5 the combat states, 6 threshold, 7 dead, 8 briefing. A muzzle's Bang is stim type 1 (seen on the range: the player's AK-47 Bang reached a soldier at 60 m and not at 100 m, a Dragunov's at 100 m).

What a soldier remembers​

A sensory record of a pawn lasts 120 s. One of an object lasts 5 s, or 2 s for object types 3 and 4. A soldier also notices a target by touch, within a radius that depends on his state:

StateRadius
idle1 m
alert2 m
passive, active, defensive3 m
threshold1.5 m
social, dead, briefingnone

A dead pawn within 20 m is always taken in, whatever the soldier's focus. This is RE-verified on the server.

That visibility is compared with two thresholds that depend on the brain state. CPawnAgent::SetVisibilityValues installs them whenever the state changes:

StateField pairSoldier default
idlem_IdleFuzzyVal / m_IdleClearVal0.3 / 0.75
socialm_SocialFuzzyVal / m_SocialClearVal0.3 / 0.75
alertm_AlertFuzzyVal / m_AlertClearVal0.25 / 0.6
combatm_CombatFuzzyVal / m_CombatClearVal0.2 / 0.4
thresholdm_ThresholdFuzzyVal / m_ThresholdClearVal0.3 / 0.75
special, dead, vehiclem_Special…, m_Dead…, m_Vehicle…

Fuzzy is where he starts to sense something, clear where he positively sees the player. One caller path lowers clear to fuzzy, so the first hint is already a sighting. The pair in force sits on the agent at +0x7CC/+0x7D0 in the server build and +0x868/+0x86C in Dunia.dll (Steam), where the threat search reads it through one getter (0x10960730). This is RE-verified in both.

Intuition​

Whenever a soldier (re)acquires his target - UpdateBestTargetInfo, a squad CombatTarget order, or the CTaskSelectBestTarget task - ResetIntuitionTimer starts a window. For the next 6 seconds, in the combat states, CPawnAgent::ManageIntuition copies the target's true position and velocity into BestTargetLastPosSeen, BestTargetLastPosSeenHigh (1.5 m higher) and BestTargetLastVelSeen, seen or not. Breaking line of sight therefore does not break the track for six seconds; searching starts from where the player is, not where he was last seen. The 6 is a constant in code (Dunia.dll Steam: the MOVSS at 0x1096e83b reads it from a shared constant).

Shooting​

Whether a shot may hit is decided by CShootingSystem::GetChanceOfSuccess, then GenerateShootAtPosition / GenerateMissedShotPosition place the bullet. For a soldier (army 0 or

  1. the chance is the product of:
  • Shooter status - his own stance (fStandingFactor, fCrouchingFactor), fIronsightFactor, and his speed band (baby step, walk, jog, run, sprint), or fSwimmingFactor.
  • Target status - the same factors for the target, with fDrivingFactor scaled down by the vehicle's evasiveness.
  • Weapon range - CWeaponPropertiesCommon::GetTargetDistanceFactor at the target distance (clamped to 220 m); forced to 1 when he aims with a sniper rifle. The target distance is measured only here, and only when he has a weapon equipped; until then it holds 99 m, the constructor's value.
  • Group number - the curve named by archGroupNumberCurve (Curves.ShootingSystem.GroupNumber), evaluated at how many AIs currently shoot at the same target.
  • Timer to miss - 0 until fTimerToMissTarget seconds after the timer starts, 1 after it. Every shot misses before then. The timer starts at his first shot in combat and is stopped only when he leaves the combat states (UpdateShootingSystem), so losing sight of his target and finding it again does not restart it.
  • Hit cap - 0 once the target has taken uiMaxHitPerSecondFactor hits in the current second. The value read is the one in the target status block; the shooter's copy is unused. It is 5 in every archetype that sets it.

Inside fPointBlankDistance, once fTimerToPointBlank has run out, a soldier's chance is simply 1: every shot hits, with no timer to miss, no hit cap and no forced misses.

GenerateShootAtPosition then rolls the average of three uniform random numbers against the chance. The average clusters around 0.5, so the roll exaggerates both ends: a chance of 0.7 hits about 88 % of the time, 0.3 about 12 %.

Forced misses. After a hit, beyond point blank, the shooter misses the next N shots outright. N is drawn between two fields of the weapon's CWeaponPropertiesCommon, per difficulty - nForcedFailureMin/nForcedFailureMax × Causal, Experimented, Hardcore, Infamous - using the game's difficulty when the target is the player and the normal values otherwise. The AK-47 ships 4-8, 2-4, 1-1 and 0-0: on Infamous nothing breaks up a run of hits. Others differ:

  • The same on every difficulty: the MP5 is 3-5 throughout.
  • Falling with difficulty: the RPG-7 is 4, 3, 2, then 1-2.
  • Never: the AS50, USAS-12, 6P9, machete, MGL-140, M79, IED, Carl Gustaf, Dart Rifle, flare gun, LPO-50, carried M2, both MK19s, the mortar and the DLC weapons are all 0.

Shooters of special types 18-29 never start a streak.

The same properties name the weapon's range curve (archTargetDistanceCurve) and archSuccessfulHitCurve. Every weapon shares one range curve, Curves.ShootingSystem.DistanceAccuracy, except the mounted M249's two entries. The library also defines per-weapon curves, DistanceAccuracy_AK47 and 13 more, but no archetype names them, so editing one changes nothing (seen in data).

Missed shots land in a fMissWidth × fMissHeight box around the target.

Where a hit lands is the aiming dot: a body part, head or torso, kept in CShootingSystem (+0x1C) and set up by SetupAimingDot (Steam 0x10A193E0). The brain asks for the head at short range. After a hit the engine only zeroes the dot's offset and never rebuilds it, so a soldier who has hit keeps aiming at the same part. In game, about two thirds of the soldiers' hits on the player landed on the head; with hit locations off for the player (the player), stock never shows it.

Whether he fires at all is CTaskShoot::CanShoot (Steam 0x109792F0). CTaskShoot::Shoot calls StartShooting before it generates the shot's position, so the trigger is pulled before GenerateShootAtPosition runs. CanShoot does not test how well he sees the target, so during the intuition window a soldier fires at a player he cannot see. How visible the target is to him is CSensorySystem::GetVisibilityValue (Steam 0x10A021A0), the smoothed value his knowledge base keeps for that target. For the player it is a critically damped spring on the evaluator's value (server ComputeSmoothedVisibility, 0x08700940) that runs only between 0.05 and 0.9 and jumps to the value outside them. The threat search makes a target out only when that value is strictly above the clear line, and notices it strictly above the fuzzy line, so a visibility held exactly on the line is never made out (traced in the server build).

The shoot task's update (Steam 0x1097B920) treats its two checks differently (traced in the Steam build). When CanShoot refuses, the task stops firing, sets flag 49 on its next update and ends, so the brain picks his next behaviour. When CTaskShoot::IsAligned (Steam 0x1097A3D0, which among other tests wants the muzzle within 15° of the aim point) says no, the task stops firing but keeps running, testing it again every update, and fires as soon as it passes. While it waits, the task's own time limit is not checked.

GetDifficultyFactor and GetProgressionFactor are multiplied in but return 1 in both builds (the PC build inlines them as constants). Difficulty reaches accuracy only through the forced misses.

Where difficulty acts​

The game has three dials, and none of them watches how the player plays: the difficulty setting, the progression level (0-27, one per story or library mission) and the act. The player's reputation rises with them. Of these, the AI sees:

WhatDial
Accuracythe setting: forced misses per weapon (nForcedFailure…)
Squad rolesthe setting: FindRoleDistribution's split, which no brain reads
Enemy weaponsprogression (enemy loadouts)
Optional tacticsprogression (adaptive behaviours)
Weapon conditionthe act (soldiers)
Going down instead of dyingthe player's reputation (soldiers)
Everything else in this pagenot at all - archetypes, cones, thresholds and behaviour odds are the same on every setting

What else the setting changes is in campaign.

What sets one soldier apart​

Little. Every world 1 enemy archetype - Blue_Faction and Red_Faction × assault, light machine gunner, rocket man, shotgun man and sniper × Caucasian and Nubian, the two Special.SpecOps_* and Missions.Assassination_Target - has the same shooting and sensing values: fTimerToMissTarget 0.2, fPointBlankDistance 2.5, fTimerToPointBlank 1.5, fMissWidth 3, the same stance and speed factors, uiMaxHitPerSecond 5, fAgentHealth −1 (300 for the assassination target), WeaponJamProbabilityScale 1 and selAIInfamyMode 2. What differs (seen in data):

  • fCombatMultiplier is 4 for snipers, rocket men and the assassination target;
  • selODU, the unit type, is 4 for snipers and 1 for SpecOps;
  • bHasALongRangeWeapon, and the weapons themselves.

Three per-soldier values exist at run time, none of them used in combat (traced in the server build):

  • His own reputation. selAIInfamyMode 2 makes it random. The agent keeps a 0-1 fraction (+0x610, saved as AIInfamyValue) that places him between AIInfamyRange's lowAIInfamy 15 and highAIInfamy 30, above the current act's start level. CPawnAgent::GetRelativeInfamy compares it with the player's reputation, from much lower to much higher. CTaskCheckRelativeInfamy reads the comparison 124 times in mercbrain: 108 in the social plans, 15 in idle, 1 in the emotion strategy. It makes him back away from or stand up to a player who aims at him in a ceasefire town.
  • His stress level (+0x614, AIStressLevel). CTaskCheckStressLevel reads it only in the look and emotion strategies: where he looks and what face he makes.
  • His mental state, set every update from his army-member state (CPawnAgent::UpdateMentalState), picks animation skills and bark banks.

No soldier flees or surrenders in combat. CTaskFindSocialFleePos, the only flee, runs in the social and idle plans: aimed at, stared down, crowded. In combat, a soldier leaves a fight only through the squad's Fallback order (flag 57), the downed state or death. The opposite exists too: RushTarget (flag 43) and CombatNoCoverRunToThreat (flag 55) send him at his target.

Adaptive behaviours​

Some optional tactics are rolled against a percentage. CFCXGameplayManager::GetBehaviorChancePercentage looks the behaviour up in the AdaptativeBehavior table of gamemodesconfig.xml and reads the column for the level the Weapons service reports - the same 0-27 progression level that selects the enemy weapon packs, not the difficulty setting. The twelve shipped behaviours:

Grenade, GrenadeAndBuilding, ChaseWithVehicle, ReachSniperWithVehicle, MountedWeapon, ShootFlare, ShootInterestingObject, RescueVictim, RangeWeapon, VehicleChaseLevel2, VehicleChaseLevel3, LongRangeVehicle

Only seven of them do anything. The chance has one reader, CTaskCheckDifficultyLevel, which rolls it and exits DoIt or DontDoIt; its AdaptiveBehavior index 12 always means DontDoIt. Two of the 14 shipped brains use the task:

RowBehaviourUsed by
2ChaseWithVehiclemercbrain, once: whether a soldier takes a vehicle after a target in one
3ReachSniperWithVehiclemercbrain, twice: escaping a mortar, and the alerted sniper
4MountedWeaponmercbrain, 8 times
6ShootInterestingObjectmercbrain, 18 times
9, 10VehicleChaseLevel2, 3vehiclebrain
11LongRangeVehiclemercbrain, 5 times

Rows 0 Grenade, 1 GrenadeAndBuilding, 5 ShootFlare, 7 RescueVictim and 8 RangeWeapon have no reader, so editing them changes nothing. Flares in particular are not gated by this table. This is RE-verified: the getter's only caller in both builds, and every shipped brain unpacked.

Implemented but unused​

The task factory registers every class below, and no shipped brain instantiates any of them:

  • Squads: CTaskCheckSquadAction, CTaskCheckSquadRole, CTaskCheckArmyRoleAction, CScannerArmyMemberRole - the brain side of the squad orders, which the lieutenant sends but no plan branches on.
  • Awareness: CTaskCheckVisibleByPlayer, CTaskCheckSeeFriendNearby, CScannerSideLookOpening, CScannerAgentAimingAt, CScannerAgentHasRaisedWeapon, CScannerAgentStaredown, CScannerAgentSocialProximity.
  • Positions: CTaskFindProtectionPoint, CTaskUnReserveCover, CTaskCheckCoverDist, CTaskGetPosOnNavMesh, CTaskCheckObstaclesInRegion, CTaskCheckQueryRange.
  • Strategy: CTaskAttackStrategy, CTaskFireStrategySelector, CTaskMoveStrategy, CTaskChase, CTaskNextWeapon, CTaskSetForcedLookAtEntity, CTaskSetPostureAttribute.
  • Brains: CBrainBlackboardSelector, CBrainDrone, CBrainRescueBuddy, CBrainSmartTerrain, CPatrolBrain.

Others ship only in the buddy and special-character brains, never in a soldier's: CTaskCoverAttack, CTaskCheckUsingCover, CTaskCheckTargetRange, CTaskCheckThreatDistance, CTaskCheckCombatMercInRadius, CScannerAgentIsVisible, CScannerVisualThreat.

Switched off in mercbrain​

A blueprint copied into a brain keeps its optional branches behind CBlueprintDecision switches: the task fires IS_TRUE when its DecisionToUse is non-zero and IS_FALSE otherwise, nothing else (traced in the server build). mercbrain has 273 of them. The ones that bear on combat and ship off:

SwitchOff inWhat it gates
TryRunToPerpendicularlong, mediuma soldier with no reachable cover runs to a flanking spot 7 m to the side of his line to the target (FindPerpendicularPos's PerpendicularLength), waits 4 s and starts over; off, he runs at the target
CheckForHeightDifflong, mediumthe attack on a target above him: a firing spot for a high target, or a path up
CheckForShotgunProgressionkill (both copies)a shotgunner takes the assault role whatever his squad gave him, and pauses 1 s at each cover instead of 3 s. On in the short, medium and long bands, so he pushes from 50 m in to 12 m
CheckForMountedWeapon, CheckForVehiclekill; kill and shortgoing for a mounted gun; calling a vehicle
ScanRelocatefire alert, hurt, shot by another targetmoving when his position is compromised (flag 45)
RelocateForShotBlockCombatFireMovingmoving when a shot is blocked while he walks

TryFlee is off in every band but sits behind TryRunToThreat, which is on, so it is never reached; the same plan flees anyway when the soldier is under fire.

Some blueprints are never copied into the live brain at all. The largest, ShotgunProgression (227 instances), is an advance from cover to cover with taunts.

Firing from cover​

In mercbrain only a suppressor fires from cover: at his cover CTaskFindCoverAttack measures the obstacle's edges against the target and CTaskChooseCoverAttack picks a pop-up over a low one, a strafe out from a corner or a stand-up behind a tall one. An assaulter who reaches cover stands beside it and fires. CTaskFindCoverAttack reads the cover off the agent (+0xE4 and +0xF0 its two edges, +0x108 whether he has one) and fires NoTarget without it. The assault's cover search, with the heuristic of the squad's AttackStrategy fact or 10, finds firing spots the cover attack cannot use; the suppressor's heuristic 3 finds ones it can (traced in the server build; on the test range an assaulter's cover gave NoTarget until his search took heuristic 3).

How long each shows him, in every band: PopUpAttack crouches 3 s and stands firing 3 s, over and over, for 15 s in all; StrafeAttack walks out to the corner's firing spot and fires 5 s; StandUpAttack fires 5 s. When one ends the suppress plan ends with it and combat picks again, so the soldier searches for cover anew; every CTaskFindCover in the combat bands has canUseSameCover 1, which lets that search hand back the cover he is at.

Agent flags and path lengths​

The 64 flags are a uint64 on the CGameAgent (Steam +0x190, the low 32 first; server build +0x168), which CTaskOperateOnFlagField sets, clears or tests and CScannerFactExist with UseFlagField watches: with checkExistance 1 it fires once the flag is set, with 0 once it is clear. No mercbrain task touches flag 34, and in the server build's code only vehicles' does, on vehicle agents (CBrainVehicle, CBrainBoat, CVehicleAgent), so a soldier's flag 34 is free; Combat Overhaul sets it while the player is in the open for him. No mercbrain task touches flag 35 either, nor any of the server build's flag calls whose index reads off in the decompiled code; Combat Overhaul sets it to ask a soldier for his grenade. CTaskPathAnalyzer compares the length of the path last found (agent +0x18C in the server build) with its ShortPathValue and MediumPathValue: up to the first it fires ShortPath, up to the second MediumPath, beyond it LongPath; LongPathValue is not read. A connection to a running plan with the anchor Restart stops and starts it again (RE-verified in the server build; on the test range).

Seeing which tasks run​

Every task starts through CTask::Start (Steam 0x1031CA80, __thiscall, no arguments). A task holds the CRC32 of its instance name at +0x04, the plan it runs in at +0x08 (null at the top brain) and its agent at +0x0C, which for a soldier's brain is his CPawnAgent. The name is the hash the packed repository keys the task by, so the shipped brain's source names every hash a hook logs (RE-verified: the server build's CTask::Start, SetAgent and DispatchConnection, and the Steam CBlueprintDecision vtable; logged on the test range). Combat Overhaul's -braintrace switch logs each task a soldier's combat brain starts this way.

Task parameters​

A task's parameters are not declared in RegisterProperties. Its LoadFromXML reads each one by name through the workspace serializer, after its base class's LoadFromXML has read the inherited ones. The getter it calls gives the type: int, uint, float, bool, string, or fact (a blackboard fact name). Some parameters are groups: a position is a RefType plus a RefName, and a few tasks read Value/Enabled pairs (CTaskComputeProjectileTrajectory's MaxFlyingTime) or one bool per sense (CScannerPawnSenses). Every class's list is in JackAll's assets/ai_tasks.tsv. It covers every class the shipped brains use, including the unused ones above.

A parameter is looked up by the CStringID of its exact name, so case matters, and a name the class does not read is silently ignored. The shipped brains have one such typo: 799 of the soldier brain's CTaskUpdateBlackboard nodes set UpdateWho, but the task reads updateWho, so every one of them runs with the default. jackall-cli ai lint <brain.ai.rml> lists these.