Files
WT-Offline/game-ai/ground/wto_ai_order_common.das
T
N0VAN0M4LY d5008baeff feat(ground-ai): add navmesh flank lanes, rally staging, recall, and air-aware SPAA
Complete the team commander layer with validated flank routes, coordinated
rally launches, dynamic cap recall, and air-threat-responsive SPAA:

- Add flank, rally, and recall parameters to the commander section of
  tuning/ground-ai.jsonc (flankMaxLengthRatio, flankMinSeparationM,
  rallyProgressFrac, rallyWaitSec, rallyMinFrac, rallyRadiusM,
  recallSafeHoldSec), validated in ground-ai-tuning.ts and compiled into
  WTO_AI_CMD_* constants.
- Add wto_ai_lanes_common.das:
  - Lazily build and cache per-(team, cap) center and left/right flank
    lanes using two-segment navmesh find_path_ex; reject flanks exceeding
    1.6x center path length or closer than 45 m to the center midpoint.
  - Stage offensive groups at the 40% rally point along their lane and
    launch once 2/3 of the group arrives or 25 s elapse, resetting on cap
    ownership flips.
  - Track enemy ground count and contested state on friendly caps,
    holding recall active until safe for 15 s; track enemy aircraft
    presence for team SPAA intel.
- Split mode planners and recall demand overrides into
  wto_ai_commander_plans_common.das; pull (enemies + 1) nearest support
  or reserve bots to defend contested friendly caps while always keeping
  at least one offensive assault bot.
- Update wto_ai_commander_anchors_common.das so SPAA follows behind the
  actual Assault group centroid and checks upward open-sky clearance when
  enemy aircraft are active.
- Wire WtoTaskOrder lane/relay/rally fields into wto_ai_route_common.das
  (replacing unvalidated wing relays and preserving corridor turning
  corners), wto_ai_tactics_common.das (rally staging hold), and
  wto_ai_runtime.das (1 s rally release check).

Verified root and launcher type checks, isolated 2.61.0.58 build (27
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 183 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
2026-12-03 18:46:53 +08:00

58 lines
1.7 KiB
Plaintext

// Task order contract between the team commander and per-bot hull behavior.
// Every per-bot decision reads `WtoTaskOrder` rather than guessing team intent.
options indenting = 2
options no_global_heap = true
module wto_ai_order_common shared
let public WTO_MODE_UNKNOWN = 0
let public WTO_MODE_BTTL = 1
let public WTO_MODE_CONQ = 2
let public WTO_MODE_DOM = 3
let public WTO_CMD_ASSAULT = 0
let public WTO_CMD_FLANK = 1
let public WTO_CMD_OVERWATCH = 2
let public WTO_CMD_DEFEND = 3
let public WTO_CMD_RESERVE = 4
let public WTO_CMD_SPAA = 5
let public WTO_URGENCY_LOW = 0
let public WTO_URGENCY_MED = 1
let public WTO_URGENCY_HIGH = 2
[safe_when_uninitialized]
struct public WtoTaskOrder
valid : bool = false
role : int = 0
capIndex : int = -1
laneId : int = 0
goalPos : float3 = float3(0.0, 0.0, 0.0)
routeRelayValid : bool = false
routeRelayPos : float3 = float3(0.0, 0.0, 0.0)
rallyHold : bool = false
urgency : int = 1
maxStopRangeM : float = 800.0
assignedAt : float = -100.0
expiresAt : float = -100.0
cautious : bool = false
overwatchOutside : bool = false
spaaAnchorValid : bool = false
spaaAnchorPos : float3 = float3(0.0, 0.0, 0.0)
spaaRelocateAt : float = -100.0
[never_inline]
def public wto_order_is_offensive(role : int) : bool
return role == WTO_CMD_ASSAULT || role == WTO_CMD_FLANK
[never_inline]
def public wto_order_max_stop_range(role, urgency : int; maxEngageRangeM : float) : float
if role == WTO_CMD_ASSAULT || role == WTO_CMD_FLANK
return 300.0
if role == WTO_CMD_OVERWATCH
return maxEngageRangeM
if role == WTO_CMD_DEFEND
return urgency == WTO_URGENCY_HIGH ? 300.0 : maxEngageRangeM
if role == WTO_CMD_RESERVE
return 800.0
return 300.0