j134 fix: tracker must take the mover's switch per-call (instance flag was silently off on the object-literal construction path) + apply the correction on the reading that carries the server's turn-N+1 energy change (two-slot buffer); live-verified alignment

This commit is contained in:
2026-09-26 12:56:26 +02:00
parent 6ad5d99922
commit 882733819b
8 changed files with 133 additions and 79 deletions
+6 -4
View File
@@ -312,7 +312,7 @@ proc resetRound*(m: var LearnedSurferModule) =
proc initLearnedSurfer*(): LearnedSurferModule =
result.debugGraphics = false
result.fire = initFireTracker(LearnedFireFix)
result.fire = initFireTracker()
result.sbc = initCountedSbc(LS_NADE, LS_BINS,
max(0, LearnedDecayEvery),
max(0, LearnedDecayShift))
@@ -498,11 +498,13 @@ proc prevEnergySet(m: var LearnedSurferModule, id: int, energy: float) =
proc noteEnemyBulletHit*(m: var LearnedSurferModule, power: float) =
## `onHitByBullet` -> the shooter's `3*power` bonus (no-op when off).
m.fire.noteEnemyBulletHit(power)
if LearnedFireFix:
m.fire.noteEnemyBulletHit(power)
proc noteDamageDealt*(m: var LearnedSurferModule, damage: float) =
## `onBulletHit` -> our same-tick damage to the enemy (no-op when off).
m.fire.noteDamageDealt(damage)
if LearnedFireFix:
m.fire.noteDamageDealt(damage)
proc detectFire(m: var LearnedSurferModule, id: int, ex, ey, eenergy: float,
ws: WorldState) =
@@ -510,7 +512,7 @@ proc detectFire(m: var LearnedSurferModule, id: int, ex, ey, eenergy: float,
## drop IS a wave; the state is the wave-relative state at THIS tick (the
## fire tick). Window 0.09..3.01, LEARNED's shipped window; the shared
## tracker corrects the delta and splits an over-cap drop across waves.
for drop in m.fire.detect(id, eenergy, 0.09, 3.01):
for drop in m.fire.detect(id, eenergy, 0.09, 3.01, LearnedFireFix):
let botX = ws.selfX
let botY = ws.selfY
let bspeed = 20.0 - 3.0 * drop