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

@@ -41,9 +41,13 @@ interface AirfieldLayoutData {
readonly airfieldLayoutProblem?: string;
}
export type GroundBattleMode = 'bttl' | 'conq' | 'dom';
export interface MissionHeader extends AirfieldLayoutData {
readonly name: string;
readonly path: string;
/** Ground mission tactical layout derived from mislist category (or suffix fallback for events). */
readonly groundMode?: GroundBattleMode;
readonly level?: string;
readonly type?: string;
readonly environment?: string;
@@ -72,7 +76,7 @@ export interface MultiplayerMissions {
export const multiplayerMissions: Dataset<MultiplayerMissions> = {
id: 'multiplayer-missions',
version: 4,
version: 5,
extract(source: DatasetSource): MultiplayerMissions {
const section = blockAt(source.readBlk('char.vromfs.bin', MISSION_LIST), MULTIPLAYER_SECTION);
if (!section) throw new Error(`${MISSION_LIST} has no "${MULTIPLAYER_SECTION}" block`);
@@ -82,6 +86,7 @@ export const multiplayerMissions: Dataset<MultiplayerMissions> = {
missions: stringList(block, 'm'),
}));
const groundModeByMission = indexGroundModes(categories);
const paths = source.listFiles('mis.vromfs.bin');
const pathByName = missionPathsByLowerName(paths);
const knownPaths = new Set(paths);
@@ -94,12 +99,34 @@ export const multiplayerMissions: Dataset<MultiplayerMissions> = {
const document = source.readBlk('mis.vromfs.bin', path);
const airfields = path.startsWith(AIR_HISTORICAL_MISSION_FOLDER)
? readAirfieldLayouts(source, document, knownPaths, airfieldsByPath) : { airfieldLayouts: [] };
missions[name] = readHeader(name, path, document, airfields);
const groundMode = groundModeByMission.get(name) ?? groundModeFromName(name);
missions[name] = readHeader(name, path, document, airfields, groundMode);
}
return { categories, missions };
},
};
function indexGroundModes(categories: readonly MissionCategory[]): Map<string, GroundBattleMode> {
const byName = new Map<string, GroundBattleMode>();
for (const category of categories) {
const mode: GroundBattleMode | undefined =
category.name === 'air_ground_Bttl' ? 'bttl'
: category.name === 'air_ground_Conq' ? 'conq'
: category.name === 'air_ground_Dom' ? 'dom'
: undefined;
if (!mode) continue;
for (const name of category.missions) if (!byName.has(name)) byName.set(name, mode);
}
return byName;
}
function groundModeFromName(name: string): GroundBattleMode | undefined {
if (/_Bttl\d*$/i.test(name)) return 'bttl';
if (/_Conq\d*$/i.test(name)) return 'conq';
if (/_Dom\d*$/i.test(name)) return 'dom';
return undefined;
}
function missionPathsByLowerName(paths: readonly string[]): Map<string, string> {
const byName = new Map<string, string>();
const repeated = new Set<string>();
@@ -114,11 +141,12 @@ function missionPathsByLowerName(paths: readonly string[]): Map<string, string>
}
function readHeader(
name: string, path: string, document: BlkBlock, airfields: AirfieldLayoutData,
name: string, path: string, document: BlkBlock, airfields: AirfieldLayoutData, groundMode?: GroundBattleMode,
): MissionHeader {
const settings = blockAt(document, 'mission_settings');
const mission = blockAt(settings, 'mission');
const optional = {
groundMode,
level: stringField(mission, 'level'),
type: stringField(mission, 'type'),
environment: stringField(mission, 'environment'),