README: gun plumbing diagnosis — baseline hits stationary, the ELM default misses

This commit is contained in:
2026-10-06 08:28:15 +02:00
parent a024a2e32b
commit 84ad673f4b
+48
View File
@@ -422,3 +422,51 @@ observer `turnNumber` without a per-round ratio that was not worth measuring.
What IS known: the in-game correction distribution is healthy (mean 0.030 rad,
median 0.046, 1% at the clamp), i.e. the model is operating in the regime it was
fitted in and is not saturating — it is simply wrong for this opponent class.
### Gun plumbing diagnosis — the gun, isolated from the ELM
Run against a **stationary** opponent (`SittingDuck`, 10 rounds each, `RawRecord`,
observer ground truth), geometric baseline (`-d:baselineGun`) vs the default ELM:
| build | shots | hits | hit% | bullet damage |
|---|---|---|---|---|
| geometric baseline | 112 | 110 | **98.2%** | 1100 |
| default (ELM) | 197 | 103 | **52.3%** | 1030 |
Aim error at fire = observer `BulletFiredEvent.direction` minus the bearing to the
target at fire time:
| gun | n | mean | median | sd | ≤1° | ≤5° | ≤10° |
|---|---|---|---|---|---|---|---|
| geometric | 112 | −0.00° | 0.00° | 0.04° | 100% | 100% | 100% |
| ELM | 197 | +0.23° | +1.61° | 5.82° | 12% | 60% | 93% |
**The geometric plumbing is correct.** The bearing is absolute and in the same
frame as `directionTo` (0°=east, positive=CCW);
`setGunTurnRate(normalizeRelativeAngle(aim − getGunDirection()))` is the right
idiom for `setAdjustGunForBodyTurn(true)` — the same one every working adversary
uses. Against a stationary target the baseline lands every shot within 0.05° of
the true bearing. **The default `UseElm` build is what misses**: its learned
correction is a ~+0.03 rad bias plus noise (median +1.6°, sd 5.8°) applied on top
of a shot that was already perfect. `-d:baselineGun` hits.
Two real plumbing bugs surfaced while measuring:
1. **Blocking fire.** `computeGun` called `fire()` (the blocking variant: it calls
`go()` itself) and then the run loop called `go()` again — every shot double-
stepped the server and desynced `bot.tick` from the observer's turn counter.
Replaced with `discard setFire(...)` and the loop's single `go()`.
2. **Degrees vs radians.** `abs(err) <= degToRad(FireSlopDeg)` compared a degrees
value against 0.052°, not 3° — the gun withheld fire long after it was on
target. Now compared in degrees. The 3° slop also fires mid-slew (up to 3°
off, sd 1.65°); reduced to 1° (sd 0.53°, 110 hits, damage unchanged).
Feature-domain check (`-d:gunLog`): the four structurally out-of-domain features
from job-42 (`scanAge`, `logScan`, `disp`, `gunHeat`) are **gone** from the
18-vector. Against a stationary target many remaining features are constant by
construction (`tgtSpeed`, `tgtLatVel`, `closing`, `losRate` = 0; `scanGap` = 1/30;
`bulletSpd` = 0.7; `power` = 2/3; `predErr` = 0) — expected for a stationary
target, not a bug. One thing to watch: `elmCorrection` rebuilds `bulletSpeed` as
`power*10` for the feature (the corpus convention), while the geometric intercept
uses the physical `20 − 3*power`; the corpus does the same, so the feature is
consistent, but the two lead calculations are not the same number.