Files
EscapistsReintroduced/docs/aggression-ai.md
T
jakub 1b1a8b5173 Add mission customization, HQ support and aggression-driven AI
Integrate faction and random settings menus, generated objectives, scouts, convoys, air support, mortar stations and body-intel recovery. Add identified-body aggression, finite hunter UAZ deployment, dedicated objective defence and maximum AI skill with separate reduced aim accuracy. Include policy tests, native probes, evidence and documentation.
2026-09-23 15:07:14 +02:00

6.9 KiB
Raw Blame History

Identified-body escalation and objective defence

Implemented 2026-09-23 in the combined Core addon. These are server-owned mission services; clients do not request spawns or supply casualty counts.

Aggression and hunter UAZs

Only a fresh BODY report delivered to HQ identifies a body for aggression. The identity is the immutable formation SourceId plus original roster slot. A status-known death can subsequently be identified once; multiple observers, repeat deliveries and status reports cannot inflate this counter. Missing or silent units do not count.

ERR_HQWatchRules.Aggression(bodies) is clamp(floor(bodies / 3), 0, 30). Hunters(level) is ceil(level / 2), capped at 15:

Identified bodies Aggression Cumulative UAZ allowance
0–2 0 0
3–8 1–2 1
9–14 3–4 2
45 15 8
87–89 29 15
90+ 30 15

The existing confirmed-loss infantry response budget remains independent. The new allowance creates additional hunter UAZ-PKM vehicles, separate from supply convoys, each with the selected primary enemy faction's driver and gunner. There are at most 15 deployments per round, not an endless replacement pool. Destroyed, captured or failed vehicles consume their deployment; surviving entities and loot remain physical. Surviving AI crew retain their HQ registration and skill profile when a driving task ends; capture releases the mission binding. The status string distinguishes active vehicles from the cumulative allowance.

Deployment waits until the prison is unlocked and checks friendly-site road access, terrain, collision, the force-ledger cap and a 400 m player exclusion radius. A blocked candidate is retried after 30 seconds; native crew readiness has a 30-second deadline. Vehicles are registered only with their actual original native agents and seat occupants. Faction selection, inventory, radio fitting and body/intel ownership use existing mission services.

Without delivered sightings, hunters patrol roads between friendly objectives. With fresh actionable HQ memory, they intercept a road near the last reported/predicted position. Destination selection does not query live player positions. Orders must traverse the existing physical radio network. Loss of communications prevents new orders; it does not magically reveal a player or cancel the last received order.

Objective crews

Radio, supply/medical, extraction and outpost locations have permanent local defence roles. HQ still receives their real reports, but cannot borrow them for searches, couriers, resupply or reinforcement assignments elsewhere. Prison patrols retain their existing release behaviour, and mortar/scout/air-support reservations remain specialized.

Within 600 m of an objective, existing living guards are reused. If no guards remain, the site can receive one finite 3–5-member relief crew per round, preserving the site's original faction. Spawning is deferred within 200 m of players and requires standable terrain. Complete native expansion is required before admission. Its native Defend waypoint uses the actual terrain-height objective position and a 40 m radius. No recurring refill loop is introduced.

The mission currently has a medical supply stash, not a spawned hospital building. This stash participates in objective defence. New objective sites can use the same service by registering their site kind in ERR_ObjectiveDefence.Objective.

Skill, accuracy and perception

Mission-owned hostile military AI use EAISkill.CYLON for maximum skill while the native aim-error node uses the REGULAR random-error distribution. This avoids CYLON's zero-error shooting. Recognition uses the native alerted factor (2.5) even in safe/suppressed states, preserving equipment factors and the engine's visibility/occlusion checks. This does not create through-wall vision or knowledge of unseen players.

The authorized original AI code supplied the scoped skill/equipment and detection-hook approach. The separate aim-error reduction is new: no corresponding independent accuracy hook was found in the inspected original. Native SCR_AIGetAimErrorOffset and SCR_AICombatComponent implementations were used to separate these behaviours.

Actual enemy-detection events activate local native combat and bring forward the next HQ report; report delivery still obeys radio routing. Primary-enemy units share HQ. Other hostile factions receive the same scoped skill/aim policy but do not leak intelligence to a mutually hostile faction. Specialist scouts and flight crews retain their authored equipment. Captured/ineligible actors are excluded from the profile, and normal teardown restores prior skill and native perception.

Audit trail and adjustment

The complete HQ journal is $logs:rereintroduced-hq.log (existing filename retained). Relevant events:

  • AGGRESSION: delivered body source/slot, distinct-body count, level and allowance.
  • HUNTER SPAWN, READY, WAIT, ORDER, FAILED, RELEASE: why/where each UAZ deployed, base, crew size, radio order and lifecycle.
  • REGISTER, SPAWN MEMBER: group and force identity, faction, prefab, position, members, home and dedicated role.
  • ROLE RESERVED, OBJECTIVE DEFENCE: site assignment, reuse or relief deployment and reassignment restriction.
  • CONTACT LOCAL: observed position, source group and local role; at most one diagnostic per group per ten seconds.
  • SPAWN PURPOSE: links body-inspection teams to their reported-body destination.

SPAWN GROUP also appears in the normal script/console log for mission groups, including non-primary factions. Coordinates are world metres. Changes are event-driven or throttled, not a per-frame unit dump. Existing radio, order, status, search and support journal records remain available.

Verification

Production-method policy tests cover body/status deduplication, three-body thresholds, 30/15 caps, reset, authority/capture boundaries, maximum skill binding/restoration, regular aim-error selection and native perception fallback. The native aggression fixture exercises actual body intake, a physical UAZ with seated crew, radio delivery and movement, objective reservations, medical-stash reinforcement admission and teardown. This is local native Workbench validation, not a dedicated-server multiplayer or full 15-UAZ performance benchmark.

Final local run: /tmp/erri-aggression-native7/logs/logs_2026-09-23_15-01-06. All 14 native assertions and the completion marker passed: full medical defence at terrain height, seated driver/gunner, real radio delivery, driving over 30 m, bounded deployment and surviving-crew profile after release. Source stayed unchanged during the run. The runner reported a transient empty-argv Wine enfMain during cleanup; a subsequent explicit private-prefix idle check passed. Existing external localization/resource messages remain in the native log; this is not a clean-log claim. python tools/check.py passed, and the final hunter lifecycle and affected skill/body/registration policy tests passed separately.