Files
SirRoboGarage/tools/ab/arms_fire_lag.txt
T
SirStone d21f7ce5f5 j147: the 1-tick fire-detection lag is OURS — measure it, then back-date it (TR_FIRE_LAG)
MEASURED LIVE (common_libs/tests/measure_fire_ghost_lag.py, 4 sessions, 1777
matched ghost spawns, both movers): the server dispatches a turn's fire AFTER
our go() for that same turn, so a turn-T shot's energy drop first reaches our
scan at turn T+1 — and a bullet takes its FIRST step during the turn it is
fired, so the true bullet is already one whole bullet step (11-20 px) downrange.
Both movers place the ghost at the SCANNED enemy position (where the bullet was
born), so the whole ghost trajectory is the true one shifted one turn later and
the arrival deadline is a full tick late.

MEASURED: detection lag +1 tick on 100% of 1777 matched spawns; ghost-vs-
observer displacement 19.06 px mean / 22.00 p90 (tfil) and 16.08 / 21.81
(strafe); arrival-deadline error 0.99 / 0.77 ticks. NOT a rendering artefact:
the draw/advance order is correct (advanceBullets -> detectFires -> build).

THE FIX: TR_FIRE_LAG (int, default 0 = today byte-for-byte) in the shared
fire_tracker, applied by both movers at spawn: x = origin + dir*speed*lag.
The deadline needs no separate change — both movers derive it from the ghost's
own position, so a correct position gives a correct deadline.
WITH IT: displacement 19.06 -> 5.37 px mean (the residue is the enemy's own
<=8 px scan staleness) and the deadline error 0.99 -> 0.06 ticks.

Guards: test_tfil_commit_env 77 -> 87 checks (default golden parity, exact
n-step back-date, deadline shortens by exactly lag, junk/negative degrade to 0,
reaped exactly one tick earlier); test_env_report + test_env_dotenv green.
TR_FIRE_LAG registered in env_report + knownEnvNames + .env.example +
docs/env_reference.md. Live A/B pre-registered in docs/movement_campaign.md
(Batch 8) with its MDE stated up front; arms tools/ab/arms_fire_lag.txt.
TR_FIRE_DIAG gains a per-round ROUND line (the tick->getTurn anchor) and a
per-spawn SPAWN line (the ghost's drawn position).
2026-09-26 23:08:57 +02:00

39 lines
2.5 KiB
Plaintext

# ─────────────────────────────────────────────────────────────────────────────
# arms_fire_lag.txt — j147: the ONE-TICK DETECTION LAG, four arms on the frozen
# movement panel (tools/ab/panel_movement.txt). Two movers (tfil, strafe) x
# {lag 0, lag 1}; the lag knob is the ONLY difference inside a mover pair.
#
# WHY. MEASURED LIVE (common_libs/tests/measure_fire_ghost_lag.py, 4 sessions,
# 1777 matched ghost spawns): the server dispatches a turn's fire AFTER our
# go() for that same turn, so the energy drop of a turn-T shot first reaches our
# scan at turn T+1 (our bot tick T). A bullet takes its FIRST step during the
# turn it is fired, so by then the true bullet is already `speed` px (11..20 px,
# one whole bullet step) downrange and the arrival deadline is a full tick short.
# Both movers place the ghost at the SCANNED enemy position, i.e. exactly where
# the bullet was born: the whole ghost trajectory is the true one shifted one
# turn later. The measured ghost-vs-observer displacement is 19.1 px mean /
# 22.0 p90 (tfil) and 16.1 / 21.8 (strafe), deadline error 0.99 / 0.77 ticks.
# With TR_FIRE_LAG=1 the displacement falls to 5.4 / 9.0 px (the residue is the
# ENEMY's own scan staleness, <= 8 px) and the deadline error to 0.06 ticks.
#
# `TR_FIRE_LAG` default 0 = today's behaviour byte for byte, so arm 1 and arm 3
# ARE the shipped movers.
#
# Pre-registered in docs/movement_campaign.md ("Batch 8 — the fire-detection
# lag") BEFORE any of these battles ran. References: `tfil_off`, `strafe_off`.
#
# Format: name | ENV=value ENV=value | label
# ─────────────────────────────────────────────────────────────────────────────
# 1. tfil as shipped (the reference for arm 2).
tfil_off | TR_MOVEMENT=tfil | today's tfil, the ghost is born at the scanned enemy (reference)
# 2. tfil with the measured lag back-dated at spawn.
tfil_lag1 | TR_MOVEMENT=tfil TR_FIRE_LAG=1 | tfil, every detected fire back-dated one bullet step
# 3. strafe as shipped (the reference for arm 4).
strafe_off | TR_MOVEMENT=strafe | today's strafe, the ghost is born at the scanned enemy (reference)
# 4. strafe with the measured lag back-dated at spawn.
strafe_lag1 | TR_MOVEMENT=strafe TR_FIRE_LAG=1 | strafe, every detected fire back-dated one bullet step