feat(ground-ai): add sample-based lead estimation, exit watch, and bounded bias

Replace direct reads of true enemy velocity with an own-sight sample
estimator, add 2-5 s last-seen exit watching, and sample bounded aiming
bias once per shooting opportunity:

- Add the estimation section to tuning/ground-ai.jsonc (watchMinSec,
  watchMaxSec, velSampleMinSpanSec, velStableSpanSec, velJumpResetMps,
  baseAimSigmaM, leadErrorFrac, maxBiasM), validated in
  ground-ai-tuning.ts and compiled into WTO_AI_EST_* constants.
- Add wto_ai_estimate_common.das:
  - Maintain a 6-sample timestamped ring buffer from each bot's own
    visual sightings; compute smoothed observed velocity and convergence
    quality, dropping quality and re-seeding bias on sudden braking/turns
    or target switches.
  - On LOS loss from an active ground engagement, freeze watchPos at the
    last-seen exit point, clear observed velocity, and draw one random
    2-5 s watch duration; stationary overwatch/defend bots hold their
    post while watching, whereas pushing/retreating bots keep moving
    while keeping their turret on the exit.
  - Compute lead from observed velocity and loaded-shell flight time,
    sampling one bounded bias vector per shooting opportunity (target,
    shot count, state, 12 m position cell) that narrows as observation
    quality improves and still passes the single fire-permission gate.

Verified root and launcher type checks, isolated 2.61.0.58 build (25
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 184 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 18:23:12 +08:00
1 parent 80113bdd2e
commit 45ff082a36
8 files changed
+223 -14

No files matched your search

@@ -42,6 +42,7 @@ export function readGroundAiTuning(reader: TuningReader): GroundAiTuning {
perception: readPerceptionSection(reader.object('perception')),
stateMachine: readStateMachineSection(reader.object('stateMachine')),
tactics: readTacticsSection(reader.object('tactics')),
estimation: readEstimationSection(reader.object('estimation')),
fireControl: readFireControlSection(reader.object('fireControl')),
diagnostics: {
telemetry: diag.bool('telemetry'),
@@ -230,6 +231,29 @@ function readTacticsSection(tactics: TuningReader): GroundAiTuning['tactics'] {
};
}
function readEstimationSection(est: TuningReader): GroundAiTuning['estimation'] {
const watchMinSec = est.number('watchMinSec', { min: 0.5, max: 10.0 });
const watchMaxSec = est.number('watchMaxSec', { min: 1.0, max: 15.0 });
if (watchMaxSec < watchMinSec) {
throw new TuningError('tuning file ground-ai.jsonc: estimation.watchMaxSec must be >= watchMinSec');
}
const velSampleMinSpanSec = est.number('velSampleMinSpanSec', { min: 0.05, max: 2.0 });
const velStableSpanSec = est.number('velStableSpanSec', { min: 0.2, max: 6.0 });
if (velStableSpanSec <= velSampleMinSpanSec) {
throw new TuningError('tuning file ground-ai.jsonc: estimation.velStableSpanSec must be > velSampleMinSpanSec');
}
return {
watchMinSec,
watchMaxSec,
velSampleMinSpanSec,
velStableSpanSec,
velJumpResetMps: est.number('velJumpResetMps', { min: 1.0, max: 20.0 }),
baseAimSigmaM: est.number('baseAimSigmaM', { min: 0.0, max: 2.0 }),
leadErrorFrac: est.number('leadErrorFrac', { min: 0.0, max: 1.0 }),
maxBiasM: est.number('maxBiasM', { min: 0.0, max: 6.0 }),
};
}
function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl'] {
const closeRangeM = fc.number('closeRangeM', { min: 30, max: 250 });
const midRangeM = fc.number('midRangeM', { min: 100, max: 600 });