j133 strafe fire detection: correct the enemy energy delta for the server's +3*power hit bonus and our own damage, never drop a too-large drop (TR_STRAFE_FIRE_FIX, default on); catch 98.89%->100% of enemy fires on the 70-battle corpus

This commit is contained in:
2026-09-26 12:18:21 +02:00
parent 0566264b06
commit 799438bbe9
8 changed files with 640 additions and 16 deletions
+9
View File
@@ -599,6 +599,10 @@ 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.
bot.strafeMover.noteDamageDealt(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.
@@ -648,6 +652,11 @@ 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.
bot.strafeMover.noteEnemyBulletHit(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).
+2
View File
@@ -314,6 +314,7 @@ proc printEffectiveValues(ctx: EnvReportContext) =
emit("TR_STRAFE_WALL_BIAS", $StrafeWallBias, sourceOf("TR_STRAFE_WALL_BIAS"))
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"))
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
@@ -502,6 +503,7 @@ proc knownEnvNames*(): seq[string] =
"TR_STRAFE_TILT_GAIN",
"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_STRAFE_HEAT_GRID", "TR_STRAFE_BULLET_CORE", "TR_STRAFE_BULLET_AURA",
"TR_STRAFE_CORRIDOR_HEAT", "TR_STRAFE_WALL_HOTNESS",
"TR_STRAFE_WALL_RADIANCE",