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
@@ -19,6 +19,8 @@ export interface ResourcePaths {
|
||||
readonly appIcon: string;
|
||||
/** Bundled example mod templates seeded into an empty mods folder on first use. */
|
||||
readonly modTemplates: string;
|
||||
/** Modular ground AI daScript sources injected into `game.vromfs.bin` when active. */
|
||||
readonly groundAiScripts: string;
|
||||
}
|
||||
|
||||
export function resourcePaths(): ResourcePaths {
|
||||
@@ -35,6 +37,7 @@ export function bundledResourcePaths(): ResourcePaths {
|
||||
networkHookLibrary: join(process.resourcesPath, 'native', 'wto_ws.dll'),
|
||||
appIcon: join(process.resourcesPath, 'icon.ico'),
|
||||
modTemplates: join(process.resourcesPath, 'mod-templates'),
|
||||
groundAiScripts: join(process.resourcesPath, 'game-ai', 'ground'),
|
||||
};
|
||||
}
|
||||
// The app path is apps/launcher; the repository is two levels up.
|
||||
@@ -44,6 +47,7 @@ export function bundledResourcePaths(): ResourcePaths {
|
||||
networkHookLibrary: join(repository, 'build', 'native', 'wto_ws.dll'),
|
||||
appIcon: join(repository, 'apps', 'launcher', 'resources', 'icon.ico'),
|
||||
modTemplates: join(repository, 'mod-dev-docs', 'templates'),
|
||||
groundAiScripts: join(repository, 'game-ai', 'ground'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface BuildRequest {
|
||||
readonly port: number;
|
||||
readonly patches: string;
|
||||
readonly networkHookLibrary: string;
|
||||
readonly groundAiScripts: string;
|
||||
readonly decalCache?: string;
|
||||
readonly hookLogging: boolean;
|
||||
readonly acceptedUnavailable: readonly string[];
|
||||
|
||||
@@ -8,15 +8,18 @@ import {
|
||||
computeModsBuildFingerprint,
|
||||
copyPlayerDecalCache,
|
||||
CORE_BUILD_PACKS,
|
||||
GAME_PACK_FILE,
|
||||
isGroundAiActive,
|
||||
playerDecalCacheProblem,
|
||||
prepareOptionalStockPacks,
|
||||
readPlayerDecalIndexFiles,
|
||||
readStockGameFiles,
|
||||
syncExternalModFiles,
|
||||
writeGameCopy,
|
||||
type GameCopyBuild,
|
||||
type GameCopyFile,
|
||||
} from '@wto/patcher';
|
||||
import { multiVehiclePackIds } from '@wto/server';
|
||||
import { loadGroundAiTuning, multiVehiclePackIds } from '@wto/server';
|
||||
import type { BuildCommand, BuildReply, BuildRequest } from './build-protocol.ts';
|
||||
|
||||
let prepared: {
|
||||
@@ -61,13 +64,34 @@ function resolveOrderedMods(modsDir: string | undefined, enabledModIds: readonly
|
||||
return ordered;
|
||||
}
|
||||
|
||||
function logModBuildSummary(result: GameCopyBuild): void {
|
||||
if (result.gamePack) {
|
||||
console.info(`[build] injected ${result.gamePack.modules.length} ground AI module(s) into ${result.gamePack.archiveFolder}`);
|
||||
}
|
||||
if (result.mods.enabledModIds.length === 0) return;
|
||||
console.info(
|
||||
`[build] applied ${result.mods.enabledModIds.length} mod(s): ${result.mods.enabledModIds.join(', ')} ` +
|
||||
`(pack overlays=${result.mods.packOverlays.length}, addons=${result.mods.addonMounts.length}, ` +
|
||||
`gui=${result.mods.guiPatches.applied.length} ok/${result.mods.guiPatches.failures.length} failed, ` +
|
||||
`exe=${result.mods.exePatches.applied.length} ok/${result.mods.exePatches.failures.length} failed)`,
|
||||
);
|
||||
for (const failure of [...result.mods.guiPatches.failures, ...result.mods.exePatches.failures]) {
|
||||
console.warn(`[build] mod "${failure.modId}" patch "${failure.patchId}" skipped: ${failure.reason}`);
|
||||
}
|
||||
}
|
||||
|
||||
function build(request: BuildRequest): void {
|
||||
checkBuildLocation(request);
|
||||
const decalCache = importedDecals(request.decalCache);
|
||||
const decalIndexFiles = decalCache ? readPlayerDecalIndexFiles(decalCache) : undefined;
|
||||
const enabledMods = resolveOrderedMods(request.modsDir, request.enabledModIds);
|
||||
const touchedPacks = touchedClientPacks(enabledMods);
|
||||
const optionalPacksInBuild = touchedPacks.filter((pack) => !CORE_BUILD_PACKS.has(pack));
|
||||
const groundAiConfig = loadGroundAiTuning(request.dataPath, console.info, enabledMods);
|
||||
const groundAiActive = isGroundAiActive(groundAiConfig);
|
||||
const touchedSet = new Set<ModdableClientPack>(
|
||||
touchedClientPacks(enabledMods).filter((pack) => !CORE_BUILD_PACKS.has(pack)),
|
||||
);
|
||||
if (groundAiActive) touchedSet.add(GAME_PACK_FILE);
|
||||
const optionalPacksInBuild = [...touchedSet];
|
||||
const extraStockPacks = optionalPacksInBuild.length > 0
|
||||
? prepareOptionalStockPacks(request.copyPath, request.stockPath, optionalPacksInBuild)
|
||||
: undefined;
|
||||
@@ -83,6 +107,7 @@ function build(request: BuildRequest): void {
|
||||
hookLogging: request.hookLogging,
|
||||
...(enabledMods.length > 0 ? { mods: enabledMods } : {}),
|
||||
...(extraStockPacks ? { extraStockPacks } : {}),
|
||||
groundAi: { scriptsFolder: request.groundAiScripts, config: groundAiConfig },
|
||||
});
|
||||
const unavailable = [...result.exePatches.failures, ...result.guiPatches.failures, ...result.nativeModules.failures];
|
||||
const accepted = new Set(request.acceptedUnavailable);
|
||||
@@ -91,18 +116,12 @@ function build(request: BuildRequest): void {
|
||||
send({ kind: 'failed', error: 'launch_build_unavailable' });
|
||||
return;
|
||||
}
|
||||
if (result.mods.enabledModIds.length > 0) {
|
||||
console.info(
|
||||
`[build] applied ${result.mods.enabledModIds.length} mod(s): ${result.mods.enabledModIds.join(', ')} ` +
|
||||
`(pack overlays=${result.mods.packOverlays.length}, addons=${result.mods.addonMounts.length}, ` +
|
||||
`gui=${result.mods.guiPatches.applied.length} ok/${result.mods.guiPatches.failures.length} failed, ` +
|
||||
`exe=${result.mods.exePatches.applied.length} ok/${result.mods.exePatches.failures.length} failed)`,
|
||||
);
|
||||
for (const failure of [...result.mods.guiPatches.failures, ...result.mods.exePatches.failures]) {
|
||||
console.warn(`[build] mod "${failure.modId}" patch "${failure.patchId}" skipped: ${failure.reason}`);
|
||||
}
|
||||
}
|
||||
const fingerprint = computeModsBuildFingerprint(enabledMods, request.port, request.patches);
|
||||
logModBuildSummary(result);
|
||||
const fingerprint = computeModsBuildFingerprint(
|
||||
enabledMods,
|
||||
request.port,
|
||||
`${request.patches}|groundAi=${JSON.stringify(groundAiConfig)}`,
|
||||
);
|
||||
prepared = { request, files: result.files, decalCache, enabledMods, optionalPacksInBuild, fingerprint };
|
||||
send({ kind: 'prepared', total: prepared.files.length });
|
||||
}
|
||||
|
||||
@@ -160,14 +160,15 @@ function pickCategoryPool(
|
||||
const mrank = vehicleMrank(vehicle, query.difficulty, query.requiredClass);
|
||||
return mrank >= query.minMrank && mrank <= query.maxMrank;
|
||||
});
|
||||
const source = inWindow.length > 0 ? inWindow : sortedByCloseness.slice(0, query.limitPerType);
|
||||
return roundRobinByCountry(source, orderedCountries, query.limitPerType);
|
||||
const source = inWindow.length > 0 ? inWindow : sortedByCloseness.slice(0, query.limitPerType);
|
||||
return roundRobinByCountry(source, orderedCountries, query.limitPerType, category);
|
||||
}
|
||||
|
||||
function roundRobinByCountry(
|
||||
vehicles: readonly CatalogueVehicle[],
|
||||
orderedCountries: readonly string[],
|
||||
limit: number,
|
||||
category: 'tank' | 'aircraft' | 'ship',
|
||||
): BotPoolEntry[] {
|
||||
const buckets = new Map<string, CatalogueVehicle[]>(orderedCountries.map((country) => [country, []]));
|
||||
for (const vehicle of vehicles) buckets.get(vehicle.country)?.push(vehicle);
|
||||
@@ -177,7 +178,8 @@ function roundRobinByCountry(
|
||||
for (const country of orderedCountries) {
|
||||
const vehicle = buckets.get(country)?.[index];
|
||||
if (!vehicle) continue;
|
||||
out.push({ name: vehicle.name, country: stripCountryPrefix(country), weight: 1 });
|
||||
const weight = category === 'tank' ? tankBotPoolWeight(vehicle) : 1;
|
||||
out.push({ name: vehicle.name, country: stripCountryPrefix(country), weight });
|
||||
added = true;
|
||||
if (out.length >= limit) break;
|
||||
}
|
||||
@@ -186,6 +188,15 @@ function roundRobinByCountry(
|
||||
return out;
|
||||
}
|
||||
|
||||
function tankBotPoolWeight(vehicle: CatalogueVehicle): number {
|
||||
if (vehicle.unitClass === 'exp_SPAA') return 0.12;
|
||||
if (vehicle.isLightTank) return 0.45;
|
||||
if (vehicle.unitClass === 'exp_tank_destroyer') return 0.55;
|
||||
if (vehicle.unitClass === 'exp_heavy_tank') return 0.85;
|
||||
if (vehicle.unitClass === 'exp_tank') return 1.15;
|
||||
return 1;
|
||||
}
|
||||
|
||||
function unitClassOfVehicleType(type: VehicleType | undefined): UnitClass | undefined {
|
||||
if (type === 'Tank') return 'tank';
|
||||
if (type === 'Aircraft') return 'aircraft';
|
||||
|
||||
+23
-2
@@ -7,24 +7,45 @@
|
||||
* will start the service the same way. Stops on Ctrl+C.
|
||||
*/
|
||||
import { parseArgs } from 'node:util';
|
||||
import { discoverMods, type DiscoveredMod } from '@wto/mods';
|
||||
import { LOOPBACK, startServer } from './server.ts';
|
||||
|
||||
function resolveCliMods(modsDir: string | undefined, modIds: readonly string[] | undefined): DiscoveredMod[] {
|
||||
if (!modsDir || !modIds || modIds.length === 0) return [];
|
||||
const discovered = discoverMods(modsDir);
|
||||
const byId = new Map(discovered.mods.map((mod) => [mod.manifest.id, mod]));
|
||||
return modIds.map((id) => {
|
||||
const mod = byId.get(id);
|
||||
if (!mod) throw new Error(`enabled mod "${id}" was not found in ${modsDir}`);
|
||||
return mod;
|
||||
});
|
||||
}
|
||||
|
||||
async function main(): Promise<number> {
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
game: { type: 'string' },
|
||||
data: { type: 'string' },
|
||||
port: { type: 'string' },
|
||||
'mods-dir': { type: 'string' },
|
||||
mod: { type: 'string', multiple: true },
|
||||
},
|
||||
});
|
||||
const port = Number(values.port);
|
||||
if (!values.game || !values.data || !Number.isInteger(port) || port < 1 || port > 65535) {
|
||||
console.error('usage: cli.ts --game <game folder> --data <data folder> --port <n>');
|
||||
console.error('usage: cli.ts --game <game folder> --data <data folder> --port <n> [--mods-dir <dir> --mod <id>...]');
|
||||
return 2;
|
||||
}
|
||||
let service;
|
||||
try {
|
||||
service = await startServer({ gameFolder: values.game, dataFolder: values.data, port, report: (line) => console.log(line) });
|
||||
const mods = resolveCliMods(values['mods-dir'], values.mod);
|
||||
service = await startServer({
|
||||
gameFolder: values.game,
|
||||
dataFolder: values.data,
|
||||
port,
|
||||
report: (line) => console.log(line),
|
||||
...(mods.length > 0 ? { mods } : {}),
|
||||
});
|
||||
} catch (error) {
|
||||
const code = (error as NodeJS.ErrnoException).code;
|
||||
console.error(code === 'EADDRINUSE' ? `port ${port} is already in use; choose another port` : String(error));
|
||||
|
||||
@@ -27,11 +27,14 @@ import type { Dataset } from './dataset.ts';
|
||||
import { shopEntriesByName } from './shop-tree.ts';
|
||||
|
||||
const VEHICLE_ECONOMY = 'config/wpcost.blk';
|
||||
const UNIT_TAGS = 'config/unittags.blk';
|
||||
|
||||
export interface CatalogueVehicle {
|
||||
readonly name: string;
|
||||
readonly country: string;
|
||||
readonly unitClass: string;
|
||||
/** True when config/unittags.blk tags the vehicle with type_light_tank. */
|
||||
readonly isLightTank?: boolean;
|
||||
readonly rank: number;
|
||||
/** wpcost.blk reqAir; absent when empty or missing. */
|
||||
readonly requires?: string;
|
||||
@@ -70,15 +73,27 @@ export interface CatalogueVehicle {
|
||||
|
||||
export const vehicleCatalogue: Dataset<readonly CatalogueVehicle[]> = {
|
||||
id: 'vehicle-catalogue',
|
||||
version: 6,
|
||||
version: 7,
|
||||
extract: (source) => {
|
||||
const shopEntries = shopEntriesByName(source);
|
||||
const treeOrder = new Map([...shopEntries.keys()].map((name, index) => [name, index]));
|
||||
return source.readBlk('char.vromfs.bin', VEHICLE_ECONOMY).blocks.map((vehicle) => catalogueVehicle(vehicle, shopEntries.get(vehicle.name), treeOrder.get(vehicle.name) ?? -1));
|
||||
const lightTanks = lightTankNames(source.readBlk('char.vromfs.bin', UNIT_TAGS));
|
||||
return source.readBlk('char.vromfs.bin', VEHICLE_ECONOMY).blocks.map((vehicle) =>
|
||||
catalogueVehicle(vehicle, shopEntries.get(vehicle.name), treeOrder.get(vehicle.name) ?? -1, lightTanks.has(vehicle.name)),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
function catalogueVehicle(vehicle: BlkBlock, shopEntry: BlkBlock | undefined, treeOrder: number): CatalogueVehicle {
|
||||
function lightTankNames(unitTagsRoot: BlkBlock): ReadonlySet<string> {
|
||||
const names = new Set<string>();
|
||||
for (const unit of unitTagsRoot.blocks) {
|
||||
const tags = unit.blocks.find((block) => block.name === 'tags');
|
||||
if (tags && boolField(tags, 'type_light_tank') === true) names.add(unit.name);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
function catalogueVehicle(vehicle: BlkBlock, shopEntry: BlkBlock | undefined, treeOrder: number, isLightTank: boolean): CatalogueVehicle {
|
||||
const requires = stringField(vehicle, 'reqAir');
|
||||
const researchType = stringField(vehicle, 'researchType');
|
||||
const requiredUnlock = stringField(shopEntry, 'reqUnlock');
|
||||
@@ -90,6 +105,7 @@ function catalogueVehicle(vehicle: BlkBlock, shopEntry: BlkBlock | undefined, tr
|
||||
name: vehicle.name,
|
||||
country: stringField(vehicle, 'country') ?? '',
|
||||
unitClass: stringField(vehicle, 'unitClass') ?? '',
|
||||
...(isLightTank ? { isLightTank: true } : {}),
|
||||
rank: numberField(vehicle, 'rank') ?? 0,
|
||||
...(requires ? { requires } : {}),
|
||||
researchPoints: numberField(vehicle, 'reqExp') ?? 0,
|
||||
|
||||
@@ -11,5 +11,6 @@ export { editSaveAccount, editSaveCurrencies, listSaveSummaries, readSaveDetails
|
||||
export { listSaveAvatars, readSaveAvatar } from './saves/save-avatars.ts';
|
||||
export { importOfficialBackup, previewOfficialBackup } from './saves/import/official-backup.ts';
|
||||
export { prepareTransferredProfile } from './saves/transferred-profile.ts';
|
||||
export { loadGroundAiTuning, type GroundAiTuning } from './tuning/ground-ai-tuning.ts';
|
||||
export { readLauncherTuning, writeLauncherTuning, type LauncherTuningPatch } from './tuning/launcher-tuning.ts';
|
||||
export { multiVehiclePackIds } from './store/store-pack-ids.ts';
|
||||
@@ -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')),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// Ground battle AI modular configuration.
|
||||
// Shipped defaults keep takeover layers off; per-client overrides live in <dataDir>/tuning/ground-ai.jsonc
|
||||
// and compile into game/wtoai/wto_ai_config_common.das when building the game copy.
|
||||
{
|
||||
"enabled": true,
|
||||
|
||||
"layers": {
|
||||
"macro": false,
|
||||
"tactics": false,
|
||||
"navigation": false,
|
||||
"fireControl": false
|
||||
},
|
||||
|
||||
"cadence": {
|
||||
"maxBots": 64,
|
||||
"macroTickSec": 0.5,
|
||||
"tacticsTickSec": 0.25,
|
||||
"navTickSec": 0.2
|
||||
},
|
||||
|
||||
"macro": {
|
||||
"openingSplitSec": 40.0,
|
||||
"capMaxInsiders": 2,
|
||||
"recaptureMinBots": 2,
|
||||
"recaptureMaxBots": 4,
|
||||
"capStickyBonusM": 165.0,
|
||||
"deathZoneRadiusM": 55.0,
|
||||
"deathZoneTtlSec": 60.0,
|
||||
"deathZoneMinKills": 3,
|
||||
"spaaRearOffsetM": 185.0,
|
||||
"spaaRelocateSec": 28.0,
|
||||
"enemySpawnAvoidM": 180.0
|
||||
},
|
||||
|
||||
"crowd": {
|
||||
"personalSpaceM": 14.0,
|
||||
"clusterRadiusM": 28.0,
|
||||
"clusterMaxAllies": 2,
|
||||
"disperseStepM": 24.0,
|
||||
"disperseHoldSec": 4.2
|
||||
},
|
||||
|
||||
"terrain": {
|
||||
"maxClimbSlopeDeg": 25.0,
|
||||
"maxDropSlopeDeg": 20.0,
|
||||
"maxWaterDepthM": 0.6,
|
||||
"collisionMarginM": 0.3,
|
||||
"crestLookaheadM": 28.0,
|
||||
"ridgeMaxDwellSec": 10.0,
|
||||
"ridgeMaxShots": 2
|
||||
},
|
||||
|
||||
"navigation": {
|
||||
"driveMode": "vehicle_phys",
|
||||
"maxPhysBots": 64,
|
||||
"steerSign": 1.0,
|
||||
"deadEchoSec": 1.2,
|
||||
"cornerBrakeAccel": 1.75,
|
||||
"pivotAngleDeg": 75.0,
|
||||
"stuckWindowSec": 3.6,
|
||||
"stuckMinMoveM": 2.0,
|
||||
"unstickReverseSec": 3.0,
|
||||
"tacticalReverseDistM": 34.0,
|
||||
"tacticalReverseMaxSec": 9.5
|
||||
},
|
||||
|
||||
"tactics": {
|
||||
"visionRangeM": 1250.0,
|
||||
"visionFovDeg": 115.0,
|
||||
"peripheralRangeM": 230.0,
|
||||
"engineAudioRangeM": 65.0,
|
||||
"shotAudioRangeM": 380.0,
|
||||
"radioShareRangeM": 450.0,
|
||||
"memoryTtlSec": 12.0,
|
||||
"targetStickinessSec": 4.5,
|
||||
"peekCooldownSec": 6.0
|
||||
},
|
||||
|
||||
"fireControl": {
|
||||
"maxEngageRangeM": 1350.0,
|
||||
"baseAlignDeg": 0.42,
|
||||
"closeHitRadiusM": 0.85,
|
||||
"barrelSettleDegSec": 1.8,
|
||||
"settleHoldSec": 0.2,
|
||||
"unstabilizedStopSpeedMps": 0.45,
|
||||
"stabilizedCreepSpeedMps": 5.5,
|
||||
"friendlyCorridorM": 3.2
|
||||
},
|
||||
|
||||
"diagnostics": {
|
||||
"telemetry": false,
|
||||
"telemetryIntervalSec": 5.0
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user