Files
WT-Offline/apps/launcher/src/shared/schemas/tuning.ts
T
N0VAN0M4LY 688406bb76 fix(ground-ai): improve firing on the move
Share a distance-based speed cap between tactics and the fire gate.
Brake toward it and try a short halt when speed or aim keeps blocking
a ready shot.

Measure tracking drift relative to the aim direction and use the
close-range alignment window for quick shots. Expose the controls in
the launcher and record measured and permitted speeds in diagnostics.

Verified both TypeScript typechecks, 2.61.0.58 and 2.61.0.60 patch
checks and builds, and daScript loading in the guarded 2.61.0.58 client.
2026-12-04 07:35:31 +08:00

251 lines
10 KiB
TypeScript

import { z } from 'zod';
export const AUTO_TARGET_PICKS = ['lowestRank', 'highestRank', 'treeOrder'] as const;
export const GROUND_AI_MODES = ['stock', 'fire', 'drive', 'full'] as const;
export const GROUND_AI_DRIVE_MODES = ['vehicle_phys', 'movesys'] as const;
const GroundAiLoadoutSchema = z.object({
lowReadyRackThreshold: z.number().int().min(1).max(60),
topUpAmmoCount: z.number().int().min(4).max(80),
primaryAmmoPct: z.number().int().min(50).max(100),
secondaryMinRounds: z.number().int().min(0).max(20),
penetrationCompareDistM: z.number().int().min(100).max(2000),
});
const GroundAiLineupWeightsSchema = z.object({
spaa: z.number().min(0.01).max(10),
lightTank: z.number().min(0.01).max(10),
tankDestroyer: z.number().min(0.01).max(10),
heavyTank: z.number().min(0.01).max(10),
mediumTank: z.number().min(0.01).max(10),
other: z.number().min(0.01).max(10),
});
const GroundAiCadenceSchema = z.object({
maxBots: z.number().int().min(1).max(64),
macroTickSec: z.number().min(0.1).max(5),
tacticsTickSec: z.number().min(0.05).max(2),
navTickSec: z.number().min(0.05).max(2),
});
const GroundAiCommanderSchema = z.object({
rebalanceSec: z.number().min(1).max(30),
roleHoldSec: z.number().min(0).max(120),
bttlAssaultPct: z.number().int().min(0).max(100),
bttlFlankPct: z.number().int().min(0).max(100),
bttlOverwatchPct: z.number().int().min(0).max(100),
conqAssaultPct: z.number().int().min(0).max(100),
conqFlankPct: z.number().int().min(0).max(100),
conqHoldDefendPct: z.number().int().min(0).max(100),
conqHoldOverwatchPct: z.number().int().min(0).max(100),
domAssaultPct: z.number().int().min(0).max(100),
domMaxDefendersPerCap: z.number().int().min(0).max(4),
overwatchStandOffM: z.number().min(25).max(350),
flankStandOffM: z.number().min(25).max(300),
spaaFollowOffsetM: z.number().min(40).max(500),
flankMaxLengthRatio: z.number().min(1.05).max(3),
flankMinSeparationM: z.number().min(15).max(200),
rallyProgressFrac: z.number().min(0.1).max(0.75),
rallyWaitSec: z.number().min(3).max(60),
rallyMinFrac: z.number().min(0.25).max(1),
rallyRadiusM: z.number().min(15).max(140),
recallSafeHoldSec: z.number().min(3).max(60),
});
const GroundAiMacroSchema = z.object({
openingSplitSec: z.number().min(0).max(180),
capMaxInsiders: z.number().int().min(1).max(8),
recaptureMinBots: z.number().int().min(1).max(8),
recaptureMaxBots: z.number().int().min(1).max(12),
capStickyBonusM: z.number().min(0).max(800),
deathZoneRadiusM: z.number().min(10).max(250),
deathZoneTtlSec: z.number().min(5).max(300),
deathZoneMinKills: z.number().int().min(1).max(16),
spaaRearOffsetM: z.number().min(40).max(600),
spaaRelocateSec: z.number().min(5).max(180),
enemySpawnAvoidM: z.number().min(60).max(600),
});
const GroundAiCrowdSchema = z.object({
personalSpaceM: z.number().min(6).max(40),
clusterRadiusM: z.number().min(12).max(80),
clusterMaxAllies: z.number().int().min(1).max(10),
disperseStepM: z.number().min(8).max(65),
disperseHoldSec: z.number().min(1).max(15),
});
const GroundAiTerrainSchema = z.object({
maxClimbSlopeDeg: z.number().min(10).max(42),
maxDropSlopeDeg: z.number().min(8).max(40),
maxWaterDepthM: z.number().min(0.2).max(2.5),
collisionMarginM: z.number().min(0.05).max(2),
crestLookaheadM: z.number().min(8).max(80),
ridgeMaxDwellSec: z.number().min(2).max(60),
ridgeMaxShots: z.number().int().min(1).max(10),
});
const GroundAiNavigationSchema = z.object({
driveMode: z.enum(GROUND_AI_DRIVE_MODES),
maxPhysBots: z.number().int().min(0).max(64),
steerSign: z.union([z.literal(1), z.literal(-1)]),
deadEchoSec: z.number().min(0.3).max(10),
controlTimeoutSec: z.number().min(0.3).max(10),
cornerBrakeAccel: z.number().min(0.5).max(8),
movingFireSpeedRampMps: z.number().min(0.2).max(5),
pivotAngleDeg: z.number().min(25).max(150),
stuckWindowSec: z.number().min(1).max(15),
stuckMinMoveM: z.number().min(0.5).max(10),
unstickReverseSec: z.number().min(0.8).max(10),
tacticalReverseDistM: z.number().min(10).max(90),
tacticalReverseMaxSec: z.number().min(2).max(25),
});
const GroundAiPerceptionSchema = z.object({
foliageTransparency: z.number().min(0.001).max(1),
nearSpotRangeM: z.number().min(20).max(250),
firingSpotRangeM: z.number().min(150).max(1500),
fastSpotSec: z.number().min(0.05).max(1.5),
normalSpotSec: z.number().min(0.1).max(3),
farSpotSec: z.number().min(0.3).max(6),
decayPerSec: z.number().min(0.2).max(10),
frontConeHalfDeg: z.number().min(10).max(90),
peripheralCloseM: z.number().min(30).max(250),
});
const GroundAiStateMachineSchema = z.object({
preaimAngleDeg: z.number().min(1).max(30),
movingShotWaitSec: z.number().min(0.25).max(5),
shortHaltMaxSec: z.number().min(0.5).max(12),
shortHaltCooldownSec: z.number().min(0.5).max(20),
turnLaunchSpeedMps: z.number().min(0.5).max(6),
coverMinDistM: z.number().min(2).max(30),
coverMaxDistM: z.number().min(6).max(80),
coverRetreatBudgetSec: z.number().min(1.5).max(20),
reloadAdvanceAngleDeg: z.number().min(0).max(45),
hullAngleTriggerDeg: z.number().min(15).max(75),
hullAngleTargetDeg: z.number().min(0).max(35),
maxTotalHaltSec: z.number().min(3).max(40),
stalemateMissShots: z.number().int().min(1).max(8),
stalemateNoShotHalts: z.number().int().min(1).max(6),
repositionMinMoveM: z.number().min(5).max(80),
repositionStepM: z.number().min(15).max(120),
repairSafeEnemyDistM: z.number().min(30).max(400),
});
const GroundAiTacticsSchema = z.object({
visionRangeM: z.number().min(200).max(3500),
visionFovDeg: z.number().min(40).max(180),
peripheralRangeM: z.number().min(30).max(800),
engineAudioRangeM: z.number().min(10).max(250),
shotAudioRangeM: z.number().min(50).max(1200),
radioShareRangeM: z.number().min(50).max(1500),
memoryTtlSec: z.number().min(1).max(45),
targetStickinessSec: z.number().min(0.5).max(20),
peekCooldownSec: z.number().min(1).max(30),
});
const GroundAiEstimationSchema = z.object({
watchMinSec: z.number().min(0.5).max(10),
watchMaxSec: z.number().min(1).max(15),
velSampleMinSpanSec: z.number().min(0.05).max(2),
velStableSpanSec: z.number().min(0.2).max(6),
velJumpResetMps: z.number().min(1).max(20),
baseAimSigmaM: z.number().min(0).max(2),
leadErrorFrac: z.number().min(0).max(1),
maxBiasM: z.number().min(0).max(6),
});
const GroundAiFireControlSchema = z.object({
maxEngageRangeM: z.number().min(150).max(3000),
closeRangeM: z.number().min(30).max(250),
midRangeM: z.number().min(100).max(600),
longRangeM: z.number().min(300).max(1500),
midSlowSpeedRatio: z.number().min(0.1).max(1),
midSlowMaxMps: z.number().min(1).max(15),
closeRangeMaxSpeedKmh: z.number().min(3.6).max(100),
pointBlankMaxSpeedKmh: z.number().min(3.6).max(100),
stopSpeedMaxMps: z.number().min(0.1).max(2),
longRangeWindowSec: z.number().min(1).max(15),
baseAlignDeg: z.number().min(0.1).max(3),
closeHitRadiusM: z.number().min(0.25).max(2.2),
barrelSettleDegSec: z.number().min(0.2).max(12),
closeSettleHoldSec: z.number().min(0.02).max(0.5),
settleHoldSec: z.number().min(0.05).max(1.5),
unstabilizedStopSpeedMps: z.number().min(0.1).max(3),
stabilizedCreepSpeedMps: z.number().min(1.5).max(15),
friendlyCorridorM: z.number().min(1).max(10),
ballisticStepMaxM: z.number().min(5).max(80),
ballisticSweepRadiusM: z.number().min(0.02).max(0.5),
maxPreFireChecksPerTick: z.number().int().min(1).max(16),
});
const GroundAiDiagnosticsSchema = z.object({
telemetry: z.boolean(),
telemetryIntervalSec: z.number().min(0.5).max(60),
});
export const GroundAiTuningSchema = z.object({
mode: z.enum(GROUND_AI_MODES),
loadout: GroundAiLoadoutSchema,
lineupWeights: GroundAiLineupWeightsSchema,
cadence: GroundAiCadenceSchema,
commander: GroundAiCommanderSchema,
macro: GroundAiMacroSchema,
crowd: GroundAiCrowdSchema,
terrain: GroundAiTerrainSchema,
navigation: GroundAiNavigationSchema,
perception: GroundAiPerceptionSchema,
stateMachine: GroundAiStateMachineSchema,
tactics: GroundAiTacticsSchema,
estimation: GroundAiEstimationSchema,
fireControl: GroundAiFireControlSchema,
diagnostics: GroundAiDiagnosticsSchema,
});
export const GroundAiTuningPatchSchema = z.object({
mode: z.enum(GROUND_AI_MODES).optional(),
loadout: GroundAiLoadoutSchema.partial().optional(),
lineupWeights: GroundAiLineupWeightsSchema.partial().optional(),
cadence: GroundAiCadenceSchema.partial().optional(),
commander: GroundAiCommanderSchema.partial().optional(),
macro: GroundAiMacroSchema.partial().optional(),
crowd: GroundAiCrowdSchema.partial().optional(),
terrain: GroundAiTerrainSchema.partial().optional(),
navigation: GroundAiNavigationSchema.partial().optional(),
perception: GroundAiPerceptionSchema.partial().optional(),
stateMachine: GroundAiStateMachineSchema.partial().optional(),
tactics: GroundAiTacticsSchema.partial().optional(),
estimation: GroundAiEstimationSchema.partial().optional(),
fireControl: GroundAiFireControlSchema.partial().optional(),
diagnostics: GroundAiDiagnosticsSchema.partial().optional(),
});
export const TuningValuesSchema = z.object({
rewardMultiplierSilverLions: z.number().min(0).max(100),
rewardMultiplierResearchPoints: z.number().min(0).max(100),
friendlyKillPenaltyMul: z.number().min(0).max(100),
maxPlayers: z.number().int().min(2).max(64),
smallTeamsMaxPlayers: z.number().int().min(2).max(64),
brSpreadMrank: z.number().int().min(0).max(12),
subModeChance: z.number().min(0).max(1),
botPoolLimitPerType: z.number().int().min(4).max(200),
tankBotRespawns: z.number().int().min(1).max(10),
airBotRespawns: z.number().int().min(1).max(10),
strikeUcavSpawnScore: z.number().int().min(1).max(10000),
nuclearEscalationStrategicBombers: z.boolean(),
silverLions: z.number().int().nonnegative(),
goldenEagles: z.number().int().min(0).max(0x7fffffff),
preferLineSuccessor: z.boolean(),
autoTargetPick: z.enum(AUTO_TARGET_PICKS),
groundAi: GroundAiTuningSchema,
});
export const TuningPatchSchema = TuningValuesSchema.omit({ groundAi: true }).partial().extend({
groundAi: GroundAiTuningPatchSchema.optional(),
});
export const TuningViewSchema = z.object({ defaults: TuningValuesSchema, effective: TuningValuesSchema });
export type GroundAiTuningValues = z.output<typeof GroundAiTuningSchema>;
export type GroundAiTuningPatch = z.output<typeof GroundAiTuningPatchSchema>;
export type TuningValues = z.output<typeof TuningValuesSchema>;
export type TuningPatch = z.output<typeof TuningPatchSchema>;
export type TuningView = z.output<typeof TuningViewSchema>;