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:
1 parent
73bae4785f
commit
7e5eb99696
18 files changed
+863
-340
No files matched your search
@@ -130,6 +130,7 @@ function customBotsBlock(plan: BattleLaunchPlan): BlkBlock {
|
||||
setParam(bots, 'wtoPlayerTeam', text(String(plan.playerTeam)));
|
||||
setParam(bots, 'wtoTeamACountries', text(plan.countriesAllies.join(';')));
|
||||
setParam(bots, 'wtoTeamBCountries', text(plan.countriesAxis.join(';')));
|
||||
if (plan.mission.groundMode !== undefined) setParam(bots, 'wtoGroundMode', text(plan.mission.groundMode));
|
||||
if (plan.maxRespawns === UNLIMITED_RESPAWNS) setParam(bots, 'wtoUnlimitedRespawns', text('1'));
|
||||
setParam(bots, 'numBotRespawnsInMultiSlot', integer(plan.airBotRespawns));
|
||||
setParam(bots, 'numTankBotRespawnsInMultiSlot', integer(plan.tankBotRespawns));
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user