feat(ground-ai): add task order, mode-aware commander v1, and world fixes

Replace the per-bot greedy cap scorer (wto_ai_macro_common.das) with a
whole-team commander and explicit task order contract, and fix the world,
spec, and navigation bugs found during the codebase audit:

- Classify ground battle modes (bttl, conq, dom) in multiplayer-missions
  v5 from mislist.blk categories (with suffix fallback for event maps) and
  emit wtoGroundMode in customRules/customBots.
- Add the commander section to tuning/ground-ai.jsonc with range and sum
  validation, compiled into WTO_AI_CMD_* constants.
- Split zone/mode/spawn refresh into wto_ai_world_zones_common.das and fix
  four world snapshot bugs: stop double-recording deaths in wreck scans
  and deduplicate with a ring cursor, refresh units before spawn fallback
  while retrying real respawn points, fall back battleCenter to spawns
  when capCount is 0, and relax cap radius clamping to 10..180 m.
- Fix limited-traverse yaw overwrite in wto_ai_specs_common.das and
  compute pivot turn angle against wishDir in wto_ai_nav_common.das.
- Introduce WtoTaskOrder (wto_ai_order_common.das) and whole-team
  commander v1 (wto_ai_commander_common.das +
  wto_ai_commander_anchors_common.das): mode-aware role quotas (Bttl,
  Conq, Dom), deterministic distance + vehicle-suitability matching,
  20-second role hysteresis, separate total-assigned vs cap-insider
  counters, frontline-relative SPAA anchors, EventZoneCaptured immediate
  rebalance, and per-team WTO_AI|CMD telemetry.

Verified root and launcher type checks, multiplayer-missions v5 dataset
extraction (1140 missions with Bttl/Conq/Dom classification), isolated
2.61.0.58 build (18 ground AI modules packed), and clean in-engine
daScript compilation/load (wto_ai_runtime.das loaded in 155 ms, 0 compile
errors). Live battle tuning and acceptance deferred until the full
pipeline is wired.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 17:20:17 +08:00
1 parent 73bae4785f
commit 7e5eb99696
18 files changed
+863 -340

No files matched your search

@@ -34,6 +34,7 @@ export function readGroundAiTuning(reader: TuningReader): GroundAiTuning {
tacticsTickSec: cadence.number('tacticsTickSec', { min: 0.05, max: 2 }),
navTickSec: cadence.number('navTickSec', { min: 0.05, max: 2 }),
},
commander: readCommanderSection(reader.object('commander')),
macro: readMacroSection(reader.object('macro')),
crowd: readCrowdSection(reader.object('crowd')),
terrain: readTerrainSection(reader.object('terrain')),
@@ -68,6 +69,42 @@ function readLineupWeights(weights: TuningReader): TankLineupWeights {
};
}
function readCommanderSection(cmd: TuningReader): GroundAiTuning['commander'] {
const pct = { min: 0, max: 100 };
const bttlAssaultPct = cmd.int('bttlAssaultPct', pct);
const bttlFlankPct = cmd.int('bttlFlankPct', pct);
const bttlOverwatchPct = cmd.int('bttlOverwatchPct', pct);
if (bttlAssaultPct + bttlFlankPct + bttlOverwatchPct > 100) {
throw new TuningError('tuning file ground-ai.jsonc: commander Bttl percentages must sum to <= 100');
}
const conqAssaultPct = cmd.int('conqAssaultPct', pct);
const conqFlankPct = cmd.int('conqFlankPct', pct);
if (conqAssaultPct + conqFlankPct > 100) {
throw new TuningError('tuning file ground-ai.jsonc: commander Conq assault + flank percentages must sum to <= 100');
}
const conqHoldDefendPct = cmd.int('conqHoldDefendPct', pct);
const conqHoldOverwatchPct = cmd.int('conqHoldOverwatchPct', pct);
if (conqHoldDefendPct + conqHoldOverwatchPct > 100) {
throw new TuningError('tuning file ground-ai.jsonc: commander Conq hold percentages must sum to <= 100');
}
return {
rebalanceSec: cmd.number('rebalanceSec', { min: 1.0, max: 30.0 }),
roleHoldSec: cmd.number('roleHoldSec', { min: 0.0, max: 120.0 }),
bttlAssaultPct,
bttlFlankPct,
bttlOverwatchPct,
conqAssaultPct,
conqFlankPct,
conqHoldDefendPct,
conqHoldOverwatchPct,
domAssaultPct: cmd.int('domAssaultPct', pct),
domMaxDefendersPerCap: cmd.int('domMaxDefendersPerCap', { min: 0, max: 4 }),
overwatchStandOffM: cmd.number('overwatchStandOffM', { min: 25.0, max: 350.0 }),
flankStandOffM: cmd.number('flankStandOffM', { min: 25.0, max: 300.0 }),
spaaFollowOffsetM: cmd.number('spaaFollowOffsetM', { min: 40.0, max: 500.0 }),
};
}
function readMacroSection(macro: TuningReader): GroundAiTuning['macro'] {
const recaptureMinBots = macro.int('recaptureMinBots', { min: 1, max: 8 });
const recaptureMaxBots = macro.int('recaptureMaxBots', { min: 1, max: 12 });