From 84ad673f4bf6ad1cc6e6c10747cb0456e7ade465 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Tue, 6 Oct 2026 08:28:15 +0200 Subject: [PATCH] =?UTF-8?q?README:=20gun=20plumbing=20diagnosis=20?= =?UTF-8?q?=E2=80=94=20baseline=20hits=20stationary,=20the=20ELM=20default?= =?UTF-8?q?=20misses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DevControlBot_garage/README.md | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/DevControlBot_garage/README.md b/DevControlBot_garage/README.md index 38c3c9c..6ec39ca 100644 --- a/DevControlBot_garage/README.md +++ b/DevControlBot_garage/README.md @@ -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.