Commit Graph
462 Commits
Author SHA1 Message Date
SirStone 2e6735a8bd DevControlBot: reset online model on GameStarted, feed delayed labels 2026-10-06 19:37:38 +02:00
SirStone a62391d400 elm_gun: delayed-label online queue, novelty gate, neutral/prior start 2026-10-06 19:37:38 +02:00
SirStone 02c65036d8 ELM: online mode setters and per-opponent reset 2026-10-06 19:37:38 +02:00
SirStone d011a2bfed README: sample-bot gate — ELM vs intercept on 13 held-out Nim sample bots (null/negative) 2026-10-06 09:05:36 +02:00
SirStone cd4b53ec52 README: movement-prediction gun — label centring, gate, real-battle numbers
Replace the aim-error-ELM section with the movement-prediction gun: the
true-impact label and its centred distribution, the 32-D features, held-out
training (ELM -27.8% RMSE vs plain intercept, output mean -0.36 deg), the
|correction|>0.10 gate (61.4% open), and 20-round RawRecord results showing
damage/round up against DrussGT, CassiusClay, Komarious and Phoenix.
2026-10-06 09:00:45 +02:00
SirStone 6a14b0ffd6 DevControlBot: movement-prediction features, gate, radar scan window
Rewrite elm_features.nim as a 32-D enemy-motion vector (7 scan-to-scan
displacement legs, speed stats, heading/turn/curvature, plus the single-frame
geometry). Add a WinCap=8 scan buffer to radar.nim and feed it through
buildBelief. elm_gun.nim now uses the physical bullet speed for the feature
(was the power*10 corpus artifact) and applies the trained correction only when
|correction| > GATE_TAU; below it the gun keeps the exact geometric aim. Retrain
and export weights (H=256, gate_tau=0.1).
2026-10-06 09:00:43 +02:00
SirStone 9f09204c40 elm_bench: relabel to true-impact movement correction
Add extract_predict.py, which builds the movement-prediction corpus: for each
sampled tick with the shooter fixed to DevControlBot (power 2), the label is
wrap(trueImpactBearing - geometricInterceptBearing), solved against the
observer's true trajectory. Unlike the old opponent-aim-error label this is
centred near zero (mean -0.33 deg, sd 18.3 deg).

Add train_predict.nim: round-group 5-fold evaluation, baselines (plain
intercept / constant), small H x lambda sweep, prediction-mean centring check,
and a |correction|>tau gate calibrated on held-out folds, then export.

Delete the old train_elm_gun.nim (it wrote the live weights from the old label)
and mark extract_realistic.py deprecated.
2026-10-06 09:00:39 +02:00
SirStone d166d34706 cleanup: remove obsolete tr_bots/_salvage legacy-bot duplicate
The salvage dir (rescued from /tmp on 2026-08-04) is fully superseded by the
canonical legacy_bots/ tree: all 28 jars are byte-identical duplicates, the
tr_wrappers still hardcode dead /tmp paths, and portaudit/ was one-off analysis
of a /tmp tree that no longer exists. The shim, vendor/, booter and legacy_bots/
are untouched.
2026-10-06 08:52:54 +02:00
SirStone 5b4ad80f35 Move DrussGT into legacy_bots/ with standard layout
DrussGT now lives at legacy_bots/DrussGT/{DrussGT.jar,DrussGT.sh,DrussGT.json}
like the other legacy bots. Its jar is committed and recorded in
MANIFEST.sha256 (sha256 5dfc0595...). tr_bots/DrussGT is kept as a
compatibility symlink to ../legacy_bots/DrussGT for in-flight jobs.
The vendored copy under tools/robocode_shim/vendor/drussgt/ is untouched.
2026-10-06 08:49:02 +02:00
SirStone 61d834ac59 tr_bots: add 13 Nim sample bots as first battle opponents
Wrapper dirs (Name.sh + Name.json) referencing the prebuilt binaries in
Downloads/robocode-tankroyale/sample-bots-nim-linux-1.0.7 read-only, plus
MyFirstTeam (team config). All 13 single bots smoke-tested with RawRecord
2 rounds and verified CONTIGUOUS via query.py --verify. See SAMPLE_BOTS.md.
2026-10-06 08:48:27 +02:00
SirStone 9dab21f231 Remove the geometric gate bots and its README section
The three geometric adversaries (Target, Walls, SpinBot) were force-added in
9f37db7 and are not needed: they were a one-off non-regression gate for the
old opponent-bias gun. Delete them and their README section. Keep the
score_battles.py damage/round + aim-error additions and the DrussGT bot.
2026-10-06 08:46:38 +02:00
SirStone 9f37db7523 Add geometric gate for ELM gun
Measure the ELM gun against the plain geometric gun on the three classic
geometric-movement bots (Target, Walls, SpinBot), 20 rounds each, RawRecord
observer ground truth. Verdict: ELM passes only Target (105.5 vs 104.5
dmg/round, within noise); fails Walls (13.5 vs 76.0) and SpinBot (11.0 vs
43.0). score_battles.py extended with damage/round, round wins and the
aim-error-at-fire distribution (vs the true geometric intercept).

Also confirms the corpus and live feature builder both use bulletSpeed =
power*10, so there is no train/inference feature mismatch.
2026-10-06 08:37:17 +02:00
SirStone 84ad673f4b README: gun plumbing diagnosis — baseline hits stationary, the ELM default misses 2026-10-06 08:28:15 +02:00
SirStone a024a2e32b DevControlBot: fix gun plumbing — detach from body turn, non-blocking fire, degree slop
The gun turn math is written for setAdjustGunForBodyTurn(true) (absolute bearing
-> normalizeRelativeAngle(bearing - getGunDirection())), but the flag was never
set: the gun inherited the body's turn. Set the three adjust flags.

Two firing bugs found while measuring the geometric baseline against a stationary
SittingDuck:
- computeGun called the BLOCKING fire(), which calls go() itself, and the run
  loop called go() again => every shot double-stepped the server. Use setFire.
- the fire slop compared a degrees error against degToRad(FireSlopDeg) = 0.052
  deg. Compare in degrees; 1 deg (3 deg fired mid-slew, up to 3 deg off).

Baseline vs stationary: 110/112 hits, aim error sd 0.04 deg.
2026-10-06 08:28:15 +02:00
SirStone dacb650692 DevControlBot: an ELM gun, its geometric baseline, and an honest null result
Firing wired in behind a compile-time A/B switch (-d:baselineGun): both guns go
through the same predictAim() call and differ only by the learned correction, so
the measured difference is attributable. radar.nim now keeps the two most recent
scans (velocity, scan age, own displacement).

Measured over 20 recorded rounds each vs DrussGT, CassiusClay, Komarious and
Phoenix: the ELM gun LOSES to the geometric baseline on three of four opponents
(Phoenix 51.0% vs 99.5% hit rate). README has the table, the diagnosis and the
two in-game-only bugs measuring exposed (degrees/radians, and features whose
in-game range lies outside the corpus).
2026-10-05 23:48:58 +02:00
SirStone 818bad50fd Train the aim-error ELM on the pooled 9-opponent corpus and export it
train_elm_gun.nim trains H=128, lambda=1e-2, decay=1.0 over every opponent in
tools/elm_bench/gen and writes modules/ELM/elm_gun_weights.txt (trainRmse 0.431
vs a constant baseline 0.933). Pooled is the point: the gun meets opponents it
was not fitted on.
2026-10-05 23:48:58 +02:00
SirStone a94c6131fd ELM engine: export/import weights for offline training
loadWeights/exportWeights move the three matrices in and out of a live ELM so a
model can be fitted offline and shipped as a data file.
2026-10-05 23:48:58 +02:00
SirStone 16c71c527a tools/elm_bench: ring label experiment — the ring label is NOT learnable
Gate question: can a ring-based label (a 2-D offset from the belief centre to
where a ray ring touches the enemy) be predicted from our own belief state?
extract_ring.py + bench_ring.nim answer it by MERGING the ring label into
samples_realistic.ndjson, so the ring label and the incumbent 1-D aim-error
label are scored on the SAME rows, the SAME features and the SAME round-group
folds. 8119 of 8676 DrussGT shot rows get a ring label.

Verdict: worse, not richer.

  * The spike's headline is an artifact. The belief is already accurate to
    under 3 px, so a belief-anchored ring touches the enemy on its FIRST ray
    step: ringK = 1.0000 for all 172723 extracted events. The "100% at power
    <= 1.5, 0.2% at power 3.0" pattern is just whether 1 * bulletSpeed fits
    inside the +-18 px belief-error ball. The literal ring label is the 1-tick
    belief extrapolation error, clipped to BotRadius.
  * Same-tick it scores better than the 1-D label (ELM/const 0.2628 vs 0.3629)
    but a single feature, beliefTgtLatVel, already gets -71.8 of the -73.7
    points: the model is re-deriving beliefTgtLatVel * age / beliefDist, i.e.
    its own inputs.
  * Under --prev it collapses to ratio 0.9819 (-1.8%). It depends MORE on the
    same-tick assumption than the 1-D label (-63.7% -> -1.0%), not less.
  * Repaired (--kintercept: k = round(believed range / bullet speed), mean k 42,
    no clipping, 60 px spread) the label is well posed and completely
    unpredictable: best feature +0.5%, best ELM -0.4%, best |corr| 0.09.

So: the belief-extrapolation error at intercept time is not a function of what
we believed, it is the opponent's unmodelled acceleration. Do not ship a ring
label. common_libs/guns/waveelm.nim is the right shape for the same idea and
is a different thing: it fires the ring from the SHOOTER, so the ring measures
an interception radius and bearing and the ELM learns a bias correction to it.
2026-10-05 22:59:41 +02:00
SirStone 8e6af386fc tools/elm_bench/README: activation sweep (tanh / relu / step)
Full 60-config grid per activation on the same features, folds and seed, so
the three runs are directly comparable (act_sweep.log):

  tanh (default)  0.4218 mean per-fold RMSE   (constant 1.1406)
  relu            0.4338  (+2.8%)
  step            0.7476  (+77.3%)

The activation only matters where there is nonlinear structure to expose: on
base 6 and on scan-age alone all three agree to 0.0002 and are all worthless.
tanh stays the default because it is never worse, and because every other
number in this README was produced with it.

Also records why there is no RBF/gaussian option: g(b*||x - a||) reads the
distance to a centre in input space, so it needs centre + width parameters,
its own init and its own Thm 2.2 validation - a different node architecture,
not a different nonlinearity. It would buy nothing here anyway: the signal is
one linear term in beliefPredErr.
2026-10-05 22:59:10 +02:00
SirStone fcaa7ba183 tools/raw_recorder + tr_bots/_salvage: recorder source and the legacy port
tools/raw_recorder/RawRecord.java + shadow/GameRecorder.java  the observer
    that writes the .battle.gz corpora in data/ (gitignored, regenerable)
  tools/raw_recorder/query.py, sample_outline.md               query helpers
    and the shape of a capture
  tr_bots/_salvage/                                           the port audit:
    portaudit/{methods,static}.py, shim/, and the tr_wrappers/*.json + *.sh
    for 29 rescued legacy bots, with legacy_bots/MANIFEST.sha256
2026-10-05 22:43:41 +02:00
SirStone e2d1968a77 Bots: env reporting, TFIL movement, gun selector and docs refresh
DevControlBot   DevControlBot.sh env-file handling and defines, tfil.nim
                  survival-movement rework, README
  ModularBot      .env.example, ModularBot.nim, env_report.nim, vbullet_draw.nim
  PPO_Bot         enemy_tracker.nim
  common_libs     gun_harness/selector.nim
  tests           env_report, lead_gain_legacy, rack_membership,
                  rack_stat_width, tm_pattern_registration adjustments
  docs            env_reference.md, goto-controller-algorithm.md
2026-10-05 22:43:30 +02:00
SirStone 7505fbf089 common_libs/guns: WaveElm ring gun, GUNK knowledge gun, online ELM
guns/elm.nim          online sequential ELM (ridge/RLS), fixed random
                        hidden layer, one pass, no backprop
  guns/waveelm.nim      the WaveElm gun: a simulated omnidirectional expanding
                        ring of probes fired from the SHOOTER, where the ELM
                        learns a BIAS CORRECTION to the ring's reconstructed
                        position (predicting the position outright was measured
                        and refuted: it collapses on abrupt/burst movement)
  guns/gun_knowledge.nim  GUNK: a learned additive angular residual on top of
                        the self-consistent lead forecast. Only answers "which
                        absolute gun direction", nothing else
  guns/docs/            the open-access OS-ELM / ELM reference set plus
                        fetch_papers.sh, which re-downloads it idempotently

Plus the matching test and measurement harnesses (test_waveelm*, test_elm,
test_gun_knowledge, test_knowledge_registration, gk_aim_probe,
measure_gk_{residual,virtual}.py) and the docs README with the citations.
2026-10-05 22:43:22 +02:00
SirStone 68c6af98dc gitignore: also cover ring_*.ndjson.merged 2026-10-05 22:43:07 +02:00
SirStone 8cc62ec825 tools/ring_spike: can a RING label be extracted from the corpora?
Feasibility spike for a ring-based training label. N rays are fired
simultaneously from the shooter's BELIEF centre at bullet speed; the label is
a 2-D positional error from the belief centre to the contact point on the enemy
circle (BotRadius 18 px). Belief is reconstructed with strict --prev
semantics (a bot cannot act on a scan delivered at the end of tick T until
T+1), so the spike already measures the label under the harder assumption.

Also fixes a latent crash in ring_contact: the `last`-sample fallback was
computed and then overwritten by an unconditional p[0], p[1], so any enemy
track with a gap raised TypeError instead of falling back.

Result is NOT what it first looks like -- see the ring-label section of
tools/elm_bench/README.md. The contact search degenerates to k = 1 (the belief
is already within BotRadius of the enemy), and the reported 100% hit rate at
power <= 1.5 versus 0.2% at power 3.0 is an artifact of bullet speed versus
the size of the belief error, not of ray geometry.
2026-10-05 22:42:53 +02:00
SirStone 6d0dd987ca tools/elm_bench: aim-error ELM benchmark suite + findings
Extractors, benchmarks and analysis for "can we predict an opponent's aim
error from our own belief state?". All labels come from BulletFiredEvents;
all features come only from the shooter's own state and its ScannedBotEvent
history (the target's true state is used for the label and never for a
feature, verified by a ground-truth-poisoning re-extraction).

  extract.py / extract_realistic.py   label + oracle features / realistic ones
  gen_analysis.py, analyse_realistic.py, audit_independent.py
  bench.nim, bench_realistic.nim, cross_opponent.nim, online.nim
  gen/*.ndjson                          the per-opponent sample tables
  README.md                             the write-up, ~1200 lines

Headline: DrussGT applies about 13% of the correct lead, and that 13% is
computable from one feature (beliefPredErr) as label ~ 0.8663*predErr +
0.0418. ELM ALL-21 pools to RMSE 0.4220 against a constant 1.1463 (-63%).
The network is not the finding; the single linear term is. Cross-opponent,
--prev leakage audit and an independent re-derivation are in the README.

The top-level samples_realistic*.ndjson are byte-identical to gen/DrussGT* and
are gitignored; gen/ is the authoritative copy.
2026-10-05 22:42:39 +02:00
SirStone 7598f7db4a ELM: pluggable hidden activation (tanh / relu / step)
ActivationKind (atanTanh default, atanRelu, atanStep) on ElmConfig, plus
applyActivation, activationName and parseActivation. The hidden units stay
pure additive nodes: every activation sees the same pre-activation s = a.x + b
and differs only in the scalar nonlinearity g.

tanh is unchanged and bit-identical to the previous version, so existing
callers cannot regress. Two init details are activation-aware, because relu and
step are dead for s <= 0: they get bias U[0,1] instead of U[-1,1], and hidden
weight scale 8/sqrt(inputDim) instead of 1/sqrt(inputDim) (at the tanh scale
the pre-activations barely straddle 0, the Gram matrix loses rank and Thm 2.2
interpolation fails outright).

No RBF option: g(b*||x - a||) reads the distance to a centre in input space,
which is a different node architecture (extra centre + width parameters, its
own init and its own Thm 2.2 validation), not a different g.

Adds tests/test_elm.nim (9 suites) and a `nimble test` task. All pass.
2026-10-05 22:42:12 +02:00
SirStone fe8b1eddff Add curated legacy Robocode roster (28 bots) and Tank Royale booter
Curated roster: 34 classic-Robocode archives were downloaded, measured in real
Tank Royale battles and curated to 28 usable bots, now in legacy_bots/<Name>/
(<Name>.jar + <Name>.json + <Name>.sh) with checksums in MANIFEST.sha256.
Six were dropped as NOT_USEFUL and deleted from tr_bots/_salvage/legacy_bots/
and tr_bots/_salvage/tr_wrappers/, with the rationale recorded in
legacy_bots/README.md and tools/robocode_shim/LEGACY_BOTS.md:

  - Nene, Seraphim  - Azuma-framework melee bots, completely inert (0 scans,
                      0 shots); getRobotRunnable() returns null so the shim has
                      no driver path for them.
  - Aurora          - fires 6 shots and crawls.
  - FloodMini, LightningBug, Aristocles - near-stationary turrets: they scan and
                      fire but land 0 hits and take 10+ hits every round.

DrussGT is the reference bot and is deliberately NOT in legacy_bots/: it lives in
tr_bots/DrussGT and is now vendored with its sources under
tools/robocode_shim/vendor/drussgt/.

Repo-relative paths replace /tmp: every <Name>.sh resolves the shim and the
vendor jars via $REPO (../..), and none hardcodes a server URL, a /tmp data
path, or anything under ~/Downloads. SERVER_URL/SERVER_SECRET come from the
environment, which the booter populates from its own -Dserver.url /
-Dsystem.secret system properties.

Booter: tools/booter/robocode-tankroyale-booter-0.35.5-all.jar, copied from a
local tank-royale build, plus a README covering the real CLI. Note the command
is `boot`; the upstream README's `run` is stale. Verified it discovers all 28
kept bots via both `dir` and `info`.

Licensing: every third-party jar here reads "not stated in jar", and DrussGT is
GPL. The repo owner has explicitly waived this - the repository is PRIVATE and
lives on their own LAN. Do not mirror or redistribute without revisiting that.

.gitignore flipped back to tracking legacy_bots/**/*.jar; an over-broad *.jar
rule already cost us the only copy of DrussGT.jar once.
2026-10-04 22:18:28 +02:00
SirStone 67d185880d DevControlBot 1.2.0: TFIL survival movement + universal battle runner
Ported "the floor is lava" (TFIL) movement into DevControlBot as a
self-contained module, DevControlBot/modules/tfil.nim. It has no runtime
dependency on common_libs/: the port is a standalone implementation,
parity-verified against the common_libs original over 2000 differential
ticks with zero divergences. Do not re-introduce the dependency and do
not edit the original to match.

Debug graphics (per-tile lava heat, tracked bullets and their danger
corridors, enemy core/aura, reachable hull, committed tile) are OFF by
default and compile-time gated behind -d:tfilDebug; see README.md for
the plain `nim c` invocation, since nimble runBot does not forward
compile flags.

Wired into DevControlBot.nim: movement computed between commandRadar()
and go(), fire-event tracking wired up, staleness handling for scanned
enemies, and body colour set to BLACK at init (movement and radar both
claim colour now).

Also adds tools/test_runner, a shared battle-test runner usable by any
garage, with an Observer adversary for quick floor checks.
2026-10-04 18:16:24 +02:00
SirStone de0dd50d6e Purge AGENTS.md of code explanation; keep inventory and diagrams
AGENTS.md is now an inventory of what exists plus the mermaid behaviour
diagrams — not a narration of the code. The source and its doc comments are
the carrier of truth for how the bot works; a prose retelling in AGENTS.md
only goes stale against them.

Removed: blocks that duplicated what the source already says, a stale line
that contradicted DevControlBot.sh's actual no-argument behaviour, and the
prior bug-fix history (which is a record of the past, not guidance for the
next change). 384 -> 238 lines.

Kept byte-identical: the behaviour diagrams, the rules (git, version/tag,
colour convention), the build and run commands, and the physics and
coordinates references.

Two constraints stay as one-liners, because they are the two ways this bot
has actually been broken: command the radar BEFORE go(), and keep all radar
logic in modules/radar.nim.
2026-10-04 16:55:05 +02:00
SirStone caa096d6c9 Add radar lock and melee sweep to DevControlBot
The bot now drives its radar every tick. It still never moves and never
fires: body, turret and gun stay white ("not programmed"), while the
radar paints itself black at init to mark itself as working.

- modules/radar.nim replaces the earlier multi-module radar design with a
  single module holding the whole of it: target memory, mode selection
  and both commands
- two commands, picked from the only fact the bot is sure of (the API's
  getEnemyCount()): one enemy plus a target in hand -> LOCK, servo onto
  its bearing; anything else -> SWEEP at 45 deg/tick, the radar's physics
  cap, a full revolution every 8 ticks
- the lock turns by the delta to the target's bearing plus 5 deg PAST it,
  so the radar CROSSES the bearing every tick instead of settling on it.
  That crossing is what produces a fresh ScannedBotEvent every tick: a
  scan per tick, with no rescan to wait for. Turning by the bare error
  parks the radar on the bearing and the scans stop
- commandRadar() is called before go() on every path, so there is no idle
  branch to fall into and switching modes costs zero turns
- idea derived from ModularBot's radar (Apache-2.0) via common_libs/;
  common_libs/ is not edited in place
- AGENTS.md gains mermaid behaviour diagrams plus pointers to the physics
  and coordinate references
- version bumped to 1.1.0 in both DevControlBot.nimble and
  DevControlBot.json so the two agree

Compiled against robocode_tankroyale_botapi 1.0.7.
2026-10-04 16:22:42 +02:00
SirStone 305c3977a6 Add PLAN.md rule, garage .gitignore, remove hardcoded server port hint
- AGENTS.md: mark PLAN.md as user-owned (never modify; it stays tracked)
- move the .env ignore rule to the garage root so it covers any depth
- drop the hardcoded "port 7654" hint from the no-server message; the target
  is now reported from the resolved SERVER_URL. The 7654 fallback remains
  only as the upstream TR default.
2026-10-03 16:39:02 +02:00
SirStone 59fad00b5c Add DevControlBot garage: skeleton bot with release/debug build script
A minimal Tank Royale bot that boots and stands still. Body, gun and radar
are set to white once at init (team convention: white = not programmed yet);
the tick loop only calls go().

- DevControlBot/ holds the single bot module, its metadata JSON, the
  BotLauncher entry script and the nimble file
- DevControlBot.sh is a thin wrapper around the runBot nimble task:
  release build by default, --debug for the classic diagnostic build
- dependencies resolve at run time from the global nimble store via
  `nimble path`; optional .env (gitignored) supplies env vars such as
  SERVER_URL, with existing environment variables taking precedence
- build happens in a throwaway mktemp dir removed on exit; no artifacts
2026-10-03 16:32:27 +02:00
SirStone 7632aaba06 docs: record the aim-capture blind spot - aim_fire only logs shots that passed setFire
j178 flagged it and it is real: the capture cannot show WHY a shot did not
happen (gun still hot, turret not aligned). A missing aim_fire record is
ambiguous, not a refusal. Docs only, no code change. Adds the TR_CAPTURE_AIM
row + a 'Known limitations' note to docs/env_reference.md section 8, and a
two-line pointer next to the knob in .env.example.
2026-09-27 18:53:59 +02:00
SirStone 208f4a9092 j177: aim capture - log what the model BELIEVED, not what it did
j176 could not attribute the 11.9 deg aim error at 450+ px: the corpus had
no gun id and no bot-side belief, so staleness was an inverse (unidentifiable)
problem and a good gun was indistinguishable from a bad one. Both are cheap to
log and impossible to recover later.

New default-off knob TR_CAPTURE_AIM (presence-only). It appends TWO record
kinds to the EXISTING TR_RECORD_WORLDSTATE file:

  aim_scan - one per onScannedBot, written BEFORE the tracker update, so it is
    the pre-update belief by construction: tick, raw scanned values
    (ex,ey,eh,es,ee), our own state (sx,sy,sh,ss), the gun in force, the
    PREVIOUS belief (bx,by,bh,bs,blst), the scan parity age = tick - blst,
    and the radar-lock context (rlock, rdir, lbear, boff).
  aim_fire - one per real shot: gun, power, the aim angle handed to setFire,
    the turret angle and the signed turret error, gunHeat, the predicted
    intercept (ax,ay) and implied TOF, and the exact WorldState the predictor
    consumed (ex,ey,eh,es,ee,sx,sy) with the tick it came from (lst).

Row builders live in a new pure module src/aim_capture.nim - no bot API, no
env reads - so the offline guard test and the live bot go through the SAME
builders and a field the test proves present is a field the bot writes.
Per-tick world-state rows also gain a `gun` id. offline_range.nim skips
aim_* lines (they carry no `ex`), so the annotations are inert to the replay.
No aim model changed.

Knob registered in env_report.nim (context field, effective-value emit) and
knownEnvNames(); documented in .env.example. Defaults OFF, diagnostic only,
never live-tested.

Verification (no battle, no Java, no server, no GUI):
  - default parity: per-gun shots/hits over 20026 ticks of
    tr_drussgt_vs_modularbot.jsonl byte-for-byte identical to the golden
    generated from the PRE-CHANGE tree (git archive 55e92bc); the golden was
    regenerated from that pre-change tree and re-diffed, so it is not
    self-referential. Boot [env] block of the pre- and post-change binaries is
    identical except pid/cmdline/build line and the new knob's own line.
  - test_aim_capture: ALL PASS (every aim_scan/aim_fire key present, plus the
    annotation-inertness replay).
  - guards: test_tfil_commit_env 159/0, test_env_report 25/0,
    test_tfil_ring_weights 24/0, test_vbullet_draw 30/0.
  - .env.example round-trip (env_report via the j172 harness): 210 effective
    values + 70 [x]/[modules] lines, 0 diffs, 0 dropped keys, 0 warnings.
  - clean `git archive HEAD` + nim c -d:release: [SuccessX].
2026-09-27 18:44:24 +02:00
pi 55e92bc5e0 docs: the range-vs-approach ceiling - melee unavailable vs DrussGT, the 16 deg is a lead-model number, pre-multiply premise dead 2026-09-27 15:05:14 +02:00
SirStone 486e2a69c6 docs(env): 6-block env reference + .env.example, every claim traceable
Rewrites docs/env_reference.md and ModularBot_garage/.env.example so a reader
can act on the file without re-deriving anything, and so every claim in it
can be checked.

WHAT
  177 knobs documented across a 6-block format:
  WHAT / VALUES / STATUS / GOTCHA / TRY. Values are the built-in defaults,
  so `.env.example` is behaviourally identical to a clean run. No default
  value changed anywhere; the only added key is TR_FIRE_LAG=0, which is real
  (fire_tracker.nim:164).

WHY (traceability)
  Every STATUS line now cites the job or commit behind the claim it makes.
  A documented default is only useful if you can tell whether it was
  verified or copied by hand; the citation makes that decidable without
  re-running the experiment.

  The presence-gated list was wrong: it claimed 7 knobs, the true number is
  10. Three knobs were also wrongly labelled presence-gated; they are
  value-based and are now documented as such.

  All 31 `# TRY:` example values were checked against the code that parses
  them, so no example is rejected when copied.

VERIFICATION
  Round-trip (j172 probe: printEnvReport clean vs .env.example applied
  through the repo's own env_dotenv loader, reports diffed): 0 mismatches,
  0 warnings, 0 dropped keys (177 in file, 177 seen). Re-run after this
  commit's comment edit, unchanged.
  test_tfil_commit_env 159 PASS / 0 FAIL
  test_env_report        25 PASS / 0 FAIL
  test_tfil_ring_weights 24 PASS / 0 FAIL (earlier in the series)

Also drops the stale "snapshot of commit 5e32ec1" pin from .env.example: a
pinned hash goes stale the moment the next commit lands, which makes the
"regenerate when a default changes" instruction worse than none. The line
now just says the values mirror current defaults.
2026-09-27 14:52:16 +02:00
SirStone 940fa44631 docs(env_reference): the two j165 ring knobs were MISSING entirely
TR_TFIL_RING_COMMIT_ARRIVAL and TR_TFIL_RING_NOREV_SPEED were in .env.example
and in the boot env report but had zero mentions in this file - the trap this
document exists to prevent. Added to the movement table, and the 'defaults read
at' line pointer corrected from the stale 116-133 to the real 188-196 / 173-175
(j165 shifted them). Both are labelled NEVER LIVE-TESTED.
2026-09-27 14:00:26 +02:00
SirStone 0df7763765 merge j160-ramfloor: the energy-reserve FIRING FLOOR + ENEMY-EXHAUSTION ram trigger (default off)
TR_RAM_FLOOR_ENERGY and TR_RAM_ENEMY_ENERGY, both default 0.0, plus
common_libs/movements/ram_decision.nim, the fire gate in ModularBot.nim, two
offline measure_* tools and the A/B record.

The j163 A/B (450 runs/arm, 0 env mis-set) is a clean negative: round-win
40.30% -> 39.70%, sign-flip p=0.7676, MDE 4.73 pp. DO NOT ADOPT;
TR_RAM_FLOOR_ENERGY stays 0.0. The mechanism barely fired (0.04% of ticks, not
the 9.6% the offline ruler predicted), so the null does not prove the knob
inert.

# Conflicts:
#	common_libs/tests/test_tfil_commit_env.nim
2026-09-27 14:00:06 +02:00
SirStone 07866c99bd merge j165-ring-commit: port tfil's arrival commitment to tfil_ring (default off)
TR_TFIL_RING_COMMIT_ARRIVAL (default off) and TR_TFIL_RING_NOREV_SPEED
(default 0.0), plus the tfil_ring replay ruler and its default-parity golden
fixture. Offline parity is byte-for-byte over 20,026 ticks with the knobs unset.
Never live-tested: the first live test of the_floor_is_lava_ring.nim under these
knobs should be a real experiment, not a formality.
2026-09-27 13:55:22 +02:00
SirStone 51bfa57067 j163: RESULT - the firing floor is a clean negative, and the offline energy corpus missed the live game by 200x
450 runs/arm x 2 arms (15 opponents x 30 runs x 3 rounds, conc=6, 0 failed,
0 never started, 0 env mis-set), frozen binary d9a39c3b8472, TR_MOVEMENT=tfil.
Round-win 40.30% -> 39.70% (-0.59 pp, CI -3.90..+2.72, sign-flip exact-2^15
p=0.7676, MDE 4.73 pp); wins/run 0.200 -> 0.182 (MDE 0.1420); damage/run
113.65 -> 112.70 (p=0.5298, MDE 4.19). Deviation disclosed: 30 runs/opponent
instead of 42 (throughput 14-22 runs/min vs 22.7-23.2 assumed); full 15-opponent
panel and both arms kept, runs reduced.

Headline is the mechanism failure: firing was suppressed on 0.04% of ticks,
not the 9.6% the offline ruler predicted (~200x smaller); only 4.8% of shots
happen in the low-energy zone and the floor removed 14% of those; rounds ending
at self energy <=0 were 40.6% live vs 61.2% implied by the offline corpus;
median self energy at death 14.1 -> 15.5. The pre-registered 'we cannot measure
the damage cost directly' call was correct.

DO NOT ADOPT. TR_RAM_FLOOR_ENERGY stays 0.0, do not re-test. The null does not
prove the knob inert - the mechanism barely fired.
2026-09-27 13:55:19 +02:00
SirStone fe77056459 j165: port tfil's arrival commitment to tfil_ring, default off
The_floor_is_lava_ring carried raw commitTicks with no arrival guard and no
no-reversal guard. Port the behaviour of tfil's j144 fix on RING-SPECIFIC env
names (TR_TFIL_RING_COMMIT_ARRIVAL, TR_TFIL_RING_NOREV_SPEED) so the two forks
never share a namespace. Both default OFF: with them unset the ring mover is
byte-for-byte the pre-change mover over the whole 20026-tick fixture replay
(golden generated from git show HEAD:..., checked by tfil_ring_replay.nim).

Structural differences from tfil, all noted in the code:
  * ring has no TfilTileReplanMode - the tile-crossing cancel is unconditional
    self-tile, so the arrival guard is just 'not TfilRingCommitArrival'.
  * ring has no replanReason enum, so the arrival/danger/expiry outcomes are a
    local bool; the default-off path keeps ring's original dec/no-dec exactly.
  * ring's MinCommitTicks is 0 (tfil's is 5), so the arrival branch is evaluated
    from the first committed tick. Left as is: changing it would change the
    default path.
  * ring's ScoredTile carries no turnDeg, so the no-reversal offsets are
    computed by ringTileOffTravel at the pick site.
TR_TFIL_COMMIT_MARGIN (tfil's hysteresis) is deliberately NOT ported: it is a
third knob, outside the two named, and inert at its 0.0 default.

No other tfil mechanism touched: no turn-cost tiebreak, TR_TFIL_ARRIVE_TICKS,
TR_FIRE_LAG, heat-field override, corridor bound, hold, or geometry weighting.
No default changed anywhere.
2026-09-27 13:27:02 +02:00
SirStone 6cfb1698f1 j163: PRE-REGISTER the 2-arm firing-floor A/B (A floor=0 vs B floor=5) before any battle 2026-09-27 12:59:51 +02:00
SirStone 64e23e29d1 j162: measure whether the bot ever runs out of energy (offline, no battles)
Decisive measurement for the j160 firing floor, on the recorded closed-loop
corpus (8149 recordings / 35163 rounds / 34.46M ticks, state only):

* 61.2% of rounds end with self energy crossing 0. Energy at death: median
  0.83, p90 8.90, max 24.83 -- the bot dies BROKE, so the floor's premise is
  real. Time at energy<=0 is a median of 1 tick: the round ends on the
  crossing tick, there is no recoverable disabled window.
* Reserve that would have absorbed the killing blow: median 0.40, p75 2.00,
  p90 6.90.
* Cannot climb back out: at energy<=5 the next tick brings a landed hit 0.232%
  of the time and death 0.663% (2.9x). At <=20 recovery is 2x more likely,
  which is why a floor at 20 is the wrong value.
* Cost: floor 5 blocks 9.58% of ticks, median run 53, mean run 118, banking
  ~9.9 energy against a p75 overshoot of 2.0.
* Measured caveat: the recorded ledger closes exactly (residual -0.00 over
  35065 rounds), so these captures do NOT charge firepower cost; the cost
  column is derived from the game rules, and the landed-hit power (mode 1.0,
  mean 1.42) is what sets the bracket.

Honest read: worth an A/B, materially different in magnitude from the geometry
arm (smaller damage cost, stronger and directly measured safety claim), so NOT
the clean 'protects against nothing' negative.

docs/ram_floor_exhaustion_ab.md: replaces the draft with the measurement plus a
re-sized A/B proposal (4 arms, 42 runs/opponent/arm, 630 runs/arm for MDE 0.10
wins/run, ~2.7 h at the measured 23 battles/min). NOT RUN -- no battle, server
or GUI was started. Both knobs remain default 0.0.
2026-09-27 12:58:14 +02:00
SirStone 23bce2dad5 j160 (default-off): the energy-reserve FIRING FLOOR + ENEMY-EXHAUSTION ram trigger
TR_RAM_FLOOR_ENERGY (0.0 = off): at/below this self energy we start no NEW
shot, holding back the reserve for a final ram exchange. Justified by the only
energy gain in the game being +3*power per bullet hit LANDED, so not firing
denies the enemy its only refill. Blocks only NEW shots (gunHeat already gates
committed ones) and is bypassed while ramming.

TR_RAM_ENEMY_ENERGY (0.0 = off): last-scanned enemy energy <= this -> ram
mode. Enemy energy IS observable (ScannedBotEvent.energy, schemas.nim:306),
1-8 ticks stale. This is the shipped finisher with its energy tolerance
promoted to a knob, keeping the self>enemy surplus guard because RAM_DAMAGE
0.6 applies to BOTH bots on every contact tick.

Open-loop measurement (measure_ramfloor_energy, 8149 recordings / 29871
rounds / 33.8M ticks): 'both low' is COMMON (10.4% of ticks below 20, 15.1%
below 25) but neither side goes low first (enemy 52.7% / us 47.3%), and the
owner's literal trigger - enemy so low it cannot fire (energy <= 1.95) - is
only 2.5% of ticks, 1.1% while we are healthy.

Guards 136 -> 147 in test_tfil_commit_env.nim, all green. A/B PRE-REGISTERED
in docs/ram_floor_exhaustion_ab.md and NOT RUN.
2026-09-27 12:46:46 +02:00
SirStone 4a1f3e1c88 j159: live 2-arm A/B result — geometry draw weighting costs 8.8 damage/run, wins null; keep TR_TFIL_GEO_MODE=off 2026-09-27 12:44:38 +02:00
SirStone 7c5bc9ccbd j159: PRE-REGISTER the tfil geo A/B (geo draw weighting vs uniform) before any battle 2026-09-27 12:16:36 +02:00
SirStone 2223ca667e j154 (default-off): the DERIVED bounded hold TR_TFIL_HOLD_MAX_TICKS + panic release
Budget derived from the server source (tank-royale 0.35.5): calcGunHeat(p) =
1 + p/5, coolDown 0.1/tick, fire only at heat == 0, calcBulletDamage(3.0) = 16
-> two max-power shots are 16 ticks apart and 32 damage is the most the enemy
can land in that window (brute force over the 0.1 power grid: 8/11/16/24/32
ticks -> 16/18/32/32/48). 16 = CommitTicks + 1, the first window that admits
the enemy's second shot.

Knob defaults to 0 = today's behaviour byte-for-byte (checked over 20026
ticks). Hold is taken only on a replan tick with an empty safe set, at most N
ticks per streak, released the tick a safe tile exists, counter reset on the
pick. PANIC RELEASE: a tracked bullet whose closest approach is within its core
at t* in [0, min(N,16)] overrides the hold immediately. The gun is untouched.

Also fixes a stray '&' that stopped test_tfil_commit_env.nim from compiling at
all, and enforces the 'a hold never interrupts a live commitment' invariant
j153 documented but did not implement. Registers TR_TFIL_HOLD_MAX_TICKS in
env_report + knownEnvNames + .env.example.

No battle, no A/B run.
2026-09-27 10:23:46 +02:00
SirStone 38fbc6ecd1 j152 (default-off): geometry shapes the tile DRAW (TR_TFIL_GEO_MODE/TAU) + the offline sweep with the diversity cost
The owner: choose the tile pool not only from the heat point but from the
geometric position too. Heat stays the hard filter; the draw over the
survivors is re-weighted by turn and/or distance. Three weighting forms
(soft softmax / top-K third / rejection band), one env name carrying both
axes. Default = off = today's uniform draw, byte-for-byte (golden parity).

WHAT DIFFERS FROM j9 (TR_TFIL_TURN_BIAS, a live null): that was a tiebreak
weight among the non-empty safe set only. This runs on the WHOLE pool the
draw already runs on, including the 2 promoted least-hot tiles the ~65%
forced picks choose from.

OFFLINE (8 fixtures x 3 seeds, no java): headline 'tile actually reached at
tta' 4.5% -> 16.9% at TR_TFIL_GEO_MODE=both-soft TR_TFIL_GEO_TAU=45, with
no diversity collapse (distinct tiles 220 -> 219, normalised entropy
0.87 -> 0.86, top-tile share 7.0% -> 8.6%). perpE — the perpendicular rate
in the FORCED population — does not move in ANY arm: that pool is 2 tiles
ranked by heat alone and the only lever is a coin flip.

Also registers j150's TR_TFIL_DIAG / TR_TFIL_DANGER_THRESHOLD in
env_report + knownEnvNames + .env.example (test_env_report was red) and
documents DANGER_THRESHOLD as quantisation-limited: heat comes in 5s, so
the effective steps are 10/15/20 and 10-14 admits zero extra tiles.

No battle, no server, no A/B run.
2026-09-27 10:22:24 +02:00
SirStoneandClaude Opus 4.8 94ffc63160 j153: the open-loop ruler for "hold when trapped" + the A/B proposal (NOT run)
Measures, on the recorded fixtures and with NO counterfactual replay: how long
until a safe tile appears at a forced pick, whether the enemy had just fired,
whether our own tile is already hot, and all three split by distance. Registers
nothing and changes no default: the knob TR_TFIL_HOLD_WHEN_TRAPPED and its
implementation live in the concurrently edited working tree.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-09-27 10:16:53 +02:00
SirStoneandClaude Opus 4.8 a01141c959 j151 (default-off): hard arrival bound TR_TFIL_ARRIVE_TICKS + the offline per-pick ruler that found it
Measures the owner's two complaints per pick (turn angle, heat on the path
vs at the destination, time-to-arrive, and whether the destination is hot on
the recorded true future when we would arrive), split by empty vs non-empty
safe set. Result: the path IS scored (hard filter + least-hot fallback), but
there was NO time term at all -- 65% of picks outran the 15-tick commitment
and the chosen tile was reached 6.5% of the time. The bound refuses a
candidate we cannot reach in TR_TFIL_ARRIVE_TICKS (default 0 = off = today).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-09-27 09:57:25 +02:00