feat(patcher,server): wire ground AI tuning, bot weights, and pack build
Add ground-ai.jsonc tuning validation, realistic tank class weights for customBots pools, on-demand game.vromfs.bin / ailist.blk injection in @wto/patcher, and launcher/CLI build integration while keeping all ground AI layers disabled by default in shipped configuration.
This commit is contained in:
1 parent
18637cf1ff
commit
4ac3484f56
17 files changed
+836
-75
No files matched your search
@@ -0,0 +1,144 @@
|
||||
/**
|
||||
* Typed, range-validated reader for `tuning/ground-ai.jsonc`.
|
||||
*/
|
||||
import type { DiscoveredMod } from '@wto/mods';
|
||||
import type { GroundAiConfig } from '@wto/patcher';
|
||||
import { tuningFiles } from './tuning-loader.ts';
|
||||
import { TuningError, type TuningReader } from './tuning-reader.ts';
|
||||
|
||||
export type GroundAiTuning = GroundAiConfig;
|
||||
|
||||
const DRIVE_MODES = new Set(['vehicle_phys', 'movesys']);
|
||||
|
||||
export function loadGroundAiTuning(
|
||||
dataFolder: string | null,
|
||||
report: (line: string) => void,
|
||||
mods: readonly DiscoveredMod[] = [],
|
||||
): GroundAiTuning {
|
||||
return readGroundAiTuning(tuningFiles(dataFolder, report, undefined, mods).read('ground-ai'));
|
||||
}
|
||||
|
||||
export function readGroundAiTuning(reader: TuningReader): GroundAiTuning {
|
||||
const layers = reader.object('layers');
|
||||
const cadence = reader.object('cadence');
|
||||
const diag = reader.object('diagnostics');
|
||||
return {
|
||||
enabled: reader.bool('enabled'),
|
||||
layers: {
|
||||
macro: layers.bool('macro'),
|
||||
tactics: layers.bool('tactics'),
|
||||
navigation: layers.bool('navigation'),
|
||||
fireControl: layers.bool('fireControl'),
|
||||
},
|
||||
cadence: {
|
||||
maxBots: cadence.int('maxBots', { min: 1, max: 64 }),
|
||||
macroTickSec: cadence.number('macroTickSec', { min: 0.1, max: 5 }),
|
||||
tacticsTickSec: cadence.number('tacticsTickSec', { min: 0.05, max: 2 }),
|
||||
navTickSec: cadence.number('navTickSec', { min: 0.05, max: 2 }),
|
||||
},
|
||||
macro: readMacroSection(reader.object('macro')),
|
||||
crowd: readCrowdSection(reader.object('crowd')),
|
||||
terrain: readTerrainSection(reader.object('terrain')),
|
||||
navigation: readNavigationSection(reader.object('navigation')),
|
||||
tactics: readTacticsSection(reader.object('tactics')),
|
||||
fireControl: readFireControlSection(reader.object('fireControl')),
|
||||
diagnostics: {
|
||||
telemetry: diag.bool('telemetry'),
|
||||
telemetryIntervalSec: diag.number('telemetryIntervalSec', { min: 0.5, max: 60 }),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function readMacroSection(macro: TuningReader): GroundAiTuning['macro'] {
|
||||
const recaptureMinBots = macro.int('recaptureMinBots', { min: 1, max: 8 });
|
||||
const recaptureMaxBots = macro.int('recaptureMaxBots', { min: 1, max: 12 });
|
||||
if (recaptureMaxBots < recaptureMinBots) {
|
||||
throw new TuningError('tuning file ground-ai.jsonc: macro.recaptureMaxBots must be >= macro.recaptureMinBots');
|
||||
}
|
||||
return {
|
||||
openingSplitSec: macro.number('openingSplitSec', { min: 0, max: 180 }),
|
||||
capMaxInsiders: macro.int('capMaxInsiders', { min: 1, max: 8 }),
|
||||
recaptureMinBots,
|
||||
recaptureMaxBots,
|
||||
capStickyBonusM: macro.number('capStickyBonusM', { min: 0, max: 800 }),
|
||||
deathZoneRadiusM: macro.number('deathZoneRadiusM', { min: 10, max: 250 }),
|
||||
deathZoneTtlSec: macro.number('deathZoneTtlSec', { min: 5, max: 300 }),
|
||||
deathZoneMinKills: macro.int('deathZoneMinKills', { min: 1, max: 16 }),
|
||||
spaaRearOffsetM: macro.number('spaaRearOffsetM', { min: 40, max: 600 }),
|
||||
spaaRelocateSec: macro.number('spaaRelocateSec', { min: 5, max: 180 }),
|
||||
enemySpawnAvoidM: macro.number('enemySpawnAvoidM', { min: 60, max: 600 }),
|
||||
};
|
||||
}
|
||||
|
||||
function readCrowdSection(crowd: TuningReader): GroundAiTuning['crowd'] {
|
||||
return {
|
||||
personalSpaceM: crowd.number('personalSpaceM', { min: 6, max: 40 }),
|
||||
clusterRadiusM: crowd.number('clusterRadiusM', { min: 12, max: 80 }),
|
||||
clusterMaxAllies: crowd.int('clusterMaxAllies', { min: 1, max: 10 }),
|
||||
disperseStepM: crowd.number('disperseStepM', { min: 8, max: 65 }),
|
||||
disperseHoldSec: crowd.number('disperseHoldSec', { min: 1, max: 15 }),
|
||||
};
|
||||
}
|
||||
|
||||
function readTerrainSection(terrain: TuningReader): GroundAiTuning['terrain'] {
|
||||
return {
|
||||
maxClimbSlopeDeg: terrain.number('maxClimbSlopeDeg', { min: 10, max: 42 }),
|
||||
maxDropSlopeDeg: terrain.number('maxDropSlopeDeg', { min: 8, max: 40 }),
|
||||
maxWaterDepthM: terrain.number('maxWaterDepthM', { min: 0.2, max: 2.5 }),
|
||||
collisionMarginM: terrain.number('collisionMarginM', { min: 0.05, max: 2.0 }),
|
||||
crestLookaheadM: terrain.number('crestLookaheadM', { min: 8, max: 80 }),
|
||||
ridgeMaxDwellSec: terrain.number('ridgeMaxDwellSec', { min: 2, max: 60 }),
|
||||
ridgeMaxShots: terrain.int('ridgeMaxShots', { min: 1, max: 10 }),
|
||||
};
|
||||
}
|
||||
|
||||
function readNavigationSection(nav: TuningReader): GroundAiTuning['navigation'] {
|
||||
const driveMode = nav.string('driveMode');
|
||||
if (!DRIVE_MODES.has(driveMode)) {
|
||||
throw new TuningError(`tuning file ground-ai.jsonc: navigation.driveMode must be "vehicle_phys" or "movesys" (found "${driveMode}")`);
|
||||
}
|
||||
const steerSign = nav.number('steerSign', { min: -1, max: 1 });
|
||||
if (steerSign !== 1 && steerSign !== -1) {
|
||||
throw new TuningError('tuning file ground-ai.jsonc: navigation.steerSign must be 1 or -1');
|
||||
}
|
||||
return {
|
||||
driveMode,
|
||||
maxPhysBots: nav.int('maxPhysBots', { min: 0, max: 64 }),
|
||||
steerSign,
|
||||
deadEchoSec: nav.number('deadEchoSec', { min: 0.3, max: 10 }),
|
||||
cornerBrakeAccel: nav.number('cornerBrakeAccel', { min: 0.5, max: 8 }),
|
||||
pivotAngleDeg: nav.number('pivotAngleDeg', { min: 25, max: 150 }),
|
||||
stuckWindowSec: nav.number('stuckWindowSec', { min: 1, max: 15 }),
|
||||
stuckMinMoveM: nav.number('stuckMinMoveM', { min: 0.5, max: 10 }),
|
||||
unstickReverseSec: nav.number('unstickReverseSec', { min: 0.8, max: 10 }),
|
||||
tacticalReverseDistM: nav.number('tacticalReverseDistM', { min: 10, max: 90 }),
|
||||
tacticalReverseMaxSec: nav.number('tacticalReverseMaxSec', { min: 2, max: 25 }),
|
||||
};
|
||||
}
|
||||
|
||||
function readTacticsSection(tactics: TuningReader): GroundAiTuning['tactics'] {
|
||||
return {
|
||||
visionRangeM: tactics.number('visionRangeM', { min: 200, max: 3500 }),
|
||||
visionFovDeg: tactics.number('visionFovDeg', { min: 40, max: 180 }),
|
||||
peripheralRangeM: tactics.number('peripheralRangeM', { min: 30, max: 800 }),
|
||||
engineAudioRangeM: tactics.number('engineAudioRangeM', { min: 10, max: 250 }),
|
||||
shotAudioRangeM: tactics.number('shotAudioRangeM', { min: 50, max: 1200 }),
|
||||
radioShareRangeM: tactics.number('radioShareRangeM', { min: 50, max: 1500 }),
|
||||
memoryTtlSec: tactics.number('memoryTtlSec', { min: 1, max: 45 }),
|
||||
targetStickinessSec: tactics.number('targetStickinessSec', { min: 0.5, max: 20 }),
|
||||
peekCooldownSec: tactics.number('peekCooldownSec', { min: 1, max: 30 }),
|
||||
};
|
||||
}
|
||||
|
||||
function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl'] {
|
||||
return {
|
||||
maxEngageRangeM: fc.number('maxEngageRangeM', { min: 150, max: 3000 }),
|
||||
baseAlignDeg: fc.number('baseAlignDeg', { min: 0.1, max: 3.0 }),
|
||||
closeHitRadiusM: fc.number('closeHitRadiusM', { min: 0.25, max: 2.2 }),
|
||||
barrelSettleDegSec: fc.number('barrelSettleDegSec', { min: 0.2, max: 12.0 }),
|
||||
settleHoldSec: fc.number('settleHoldSec', { min: 0.05, max: 1.5 }),
|
||||
unstabilizedStopSpeedMps: fc.number('unstabilizedStopSpeedMps', { min: 0.1, max: 3.0 }),
|
||||
stabilizedCreepSpeedMps: fc.number('stabilizedCreepSpeedMps', { min: 1.5, max: 15.0 }),
|
||||
friendlyCorridorM: fc.number('friendlyCorridorM', { min: 1.0, max: 10.0 }),
|
||||
};
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import { readResearchTuning, type ResearchTuning } from '../research/research-tu
|
||||
import { readRedeemTuning, type RedeemTuning } from '../store/redeem-tuning.ts';
|
||||
import { readStoreTuning, type StoreTuning } from '../store/store-tuning.ts';
|
||||
import type { DiscoveredMod } from '@wto/mods';
|
||||
import { readGroundAiTuning, type GroundAiTuning } from './ground-ai-tuning.ts';
|
||||
import { readLimitsTuning, type LimitsTuning } from './limits-tuning.ts';
|
||||
import { tuningFiles } from './tuning-loader.ts';
|
||||
|
||||
@@ -29,6 +30,7 @@ export interface Tuning {
|
||||
readonly clans: ClanTuning;
|
||||
readonly battle: BattleTuning;
|
||||
readonly battleEconomy: BattleEconomyTuning;
|
||||
readonly groundAi: GroundAiTuning;
|
||||
readonly limits: LimitsTuning;
|
||||
}
|
||||
|
||||
@@ -50,6 +52,7 @@ export function loadTuning(
|
||||
clans: readClanTuning(files.read('clans')),
|
||||
battle: readBattleTuning(files.read('battle')),
|
||||
battleEconomy: readBattleEconomyTuning(files.read('battle-economy')),
|
||||
groundAi: readGroundAiTuning(files.read('ground-ai')),
|
||||
limits: readLimitsTuning(files.read('limits')),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user