j134 fire fix: share ONE fire_tracker across tfil/ring/strafe/learned/surf (TR_FIRE_FIX, default on); env-gated TR_FIRE_DIAG alignment trace
This commit is contained in:
@@ -125,6 +125,10 @@ let VBulletAdmitOnly* =
|
||||
## tfil_ring — the new RANGE-WEIGHTED mover (movements/the_floor_is_lava_ring).
|
||||
## UNPROVEN: it must never become the default silently.
|
||||
let MovementName* = getEnv("TR_MOVEMENT", "strafe").strip().toLowerAscii()
|
||||
## TEMPORARY j134 diagnostic (TASK B): when `TR_FIRE_DIAG` is set, print the tick
|
||||
## of every enemy-hit / our-hit EVENT so it can be checked against the energy
|
||||
## reading tick logged by the mover. OFF by default; observability only.
|
||||
let FireDiag* = existsEnv("TR_FIRE_DIAG")
|
||||
## Per-process output paths so concurrent A/B runs do not clobber each other.
|
||||
let GunStatsPath = getEnv("GUN_STATS_PATH", "/tmp/gun_stats.jsonl")
|
||||
let ShotLogPath = getEnv("GUN_SHOTLOG_PATH", "/tmp/shot_log.jsonl")
|
||||
@@ -599,10 +603,17 @@ method onBulletFired*(bot: ModularBot, e: BulletFiredEvent) =
|
||||
|
||||
method onBulletHit*(bot: ModularBot, e: BulletHitBotEvent) =
|
||||
inc bot.realHits
|
||||
# j133 fire-detection fix: our damage to the enemy inflates the enemy's
|
||||
# energy drop this tick (it can push the enemy's own fire past the 3.0 power
|
||||
# cap and get it rejected). Tell the strafe detector, which undoes it.
|
||||
# j134 fire-detection fix (shared by EVERY mover): our damage to the enemy
|
||||
# inflates the enemy's energy drop this tick (it can push the enemy's own
|
||||
# fire past the 3.0 power cap and get it rejected). Each mover's detector
|
||||
# undoes it.
|
||||
bot.mover.noteDamageDealt(e.damage)
|
||||
bot.ringMover.noteDamageDealt(e.damage)
|
||||
bot.strafeMover.noteDamageDealt(e.damage)
|
||||
bot.surfMover.noteDamageDealt(e.damage)
|
||||
bot.learnedMover.noteDamageDealt(e.damage)
|
||||
if FireDiag:
|
||||
echo "[firediag] EV dmg tick=", bot.tick, " damage=", e.damage
|
||||
# Capture the rack BEFORE resolveOwnBullet drops the bullet's mode slot.
|
||||
let hitMode = bot.bulletMode.getOrDefault(e.bullet.bulletId, vb.rm1v1)
|
||||
# onBulletHit only fires for our own bullets (victimId != myId); see json_parse.nim.
|
||||
@@ -652,11 +663,17 @@ method onBulletHitBullet*(bot: ModularBot, e: BulletHitBulletEvent) =
|
||||
e.hitBullet.ownerId, bot.tick, false)
|
||||
|
||||
method onHitByBullet*(bot: ModularBot, e: HitByBulletEvent) =
|
||||
# j133 fire-detection fix: server rules.kt gives the SHOOTER a `3*power`
|
||||
# energy bonus when its bullet hits us, which masks the cost of a fire in the
|
||||
# same tick. Forward the enemy bullet's power so the strafe detector adds it
|
||||
# back before classifying the energy delta.
|
||||
# j134 fire-detection fix (shared by EVERY mover): server rules.kt gives the
|
||||
# SHOOTER a `3*power` energy bonus when its bullet hits us, which masks the
|
||||
# cost of a fire in the same tick. Forward the enemy bullet's power to every
|
||||
# detector, which adds it back before classifying the energy delta.
|
||||
bot.mover.noteEnemyBulletHit(e.bullet.power)
|
||||
bot.ringMover.noteEnemyBulletHit(e.bullet.power)
|
||||
bot.strafeMover.noteEnemyBulletHit(e.bullet.power)
|
||||
bot.surfMover.noteEnemyBulletHit(e.bullet.power)
|
||||
bot.learnedMover.noteEnemyBulletHit(e.bullet.power)
|
||||
if FireDiag:
|
||||
echo "[firediag] EV hit tick=", bot.tick, " power=", e.bullet.power
|
||||
# Feeds the ram bullet-rain abort window. Accumulate REAL ENERGY (the server's
|
||||
# 4p/6p-2 damage), not raw firepower, so `damageRatePerTurn` is a real
|
||||
# energy/turn rate (see movements/ram_decision.bulletDamage).
|
||||
|
||||
@@ -315,6 +315,11 @@ proc printEffectiveValues(ctx: EnvReportContext) =
|
||||
emit("TR_STRAFE_WALL_SAFE", $StrafeWallSafe, sourceOf("TR_STRAFE_WALL_SAFE"))
|
||||
emit("TR_STRAFE_ESCAPE", onOff(StrafeEscape), sourceOf("TR_STRAFE_ESCAPE"))
|
||||
emit("TR_STRAFE_FIRE_FIX", onOff(StrafeFireFix), sourceOf("TR_STRAFE_FIRE_FIX"))
|
||||
# j134: the global switch the shared `movement_harness/fire_tracker` reads.
|
||||
# Every mover's effective value is this AND (for STRAFE) TR_STRAFE_FIRE_FIX.
|
||||
emit("TR_FIRE_FIX", onOff(TfilFireFix), sourceOf("TR_FIRE_FIX"))
|
||||
# j134 TASK B diagnostic (off by default): per-reading tick/raw/correction trace.
|
||||
emit("TR_FIRE_DIAG", onOff(StrafeFireDiag), sourceOf("TR_FIRE_DIAG"))
|
||||
emit("TR_STRAFE_HEAT_GRID", onOff(StrafeHeatGrid), sourceOf("TR_STRAFE_HEAT_GRID"))
|
||||
# STRAFE's heat shape is its own RETUNE (bullet 20/10, corridor 10, wall
|
||||
# 15/5), override-able per run so the shipped field can be A/B'd on one
|
||||
@@ -504,6 +509,8 @@ proc knownEnvNames*(): seq[string] =
|
||||
"TR_STRAFE_KAPPA", "TR_STRAFE_WALL_MARGIN", "TR_STRAFE_WING_MAX",
|
||||
"TR_STRAFE_WALL_BIAS", "TR_STRAFE_WALL_SAFE", "TR_STRAFE_ESCAPE",
|
||||
"TR_STRAFE_FIRE_FIX",
|
||||
"TR_FIRE_FIX",
|
||||
"TR_FIRE_DIAG",
|
||||
"TR_STRAFE_HEAT_GRID", "TR_STRAFE_BULLET_CORE", "TR_STRAFE_BULLET_AURA",
|
||||
"TR_STRAFE_CORRIDOR_HEAT", "TR_STRAFE_WALL_HOTNESS",
|
||||
"TR_STRAFE_WALL_RADIANCE",
|
||||
|
||||
Reference in New Issue
Block a user