j131 learned movement: real bullet-endpoint resolution (TR_LEARNED_REAL_EVENTS, default off) + exact-geometry Gate A/B (inversion NOT fixed; state still the constraint)

This commit is contained in:
2026-09-26 11:54:11 +02:00
parent d5047598b5
commit cc332138b3
6 changed files with 569 additions and 14 deletions
+21
View File
@@ -620,6 +620,15 @@ method onBulletHitWall*(bot: ModularBot, e: BulletHitWallEvent) =
bot.strafeMover.removeBulletNear(e.bullet.x, e.bullet.y)
bot.surfMover.removeBulletNear(e.bullet.x, e.bullet.y)
bot.learnedMover.removeBulletNear(e.bullet.x, e.bullet.y)
# Real wall endpoint of an ENEMY bullet. On the running server (0.35.5) a
# BulletHitWallEvent is delivered only to the bullet's OWNER
# (`addPrivateBotEvent(bullet.botId, ...)`), so this branch is a no-op live;
# it is wired so a server that exposes enemy wall hit-points feeds the
# exact-geometry wave resolution instead of the arrival-deadline proxy.
if e.bullet.ownerId != getMyId():
discard bot.learnedMover.resolveEnemyBullet(
e.bullet.x, e.bullet.y, degToRad(e.bullet.direction),
e.bullet.ownerId, bot.tick, false)
method onBulletHitBullet*(bot: ModularBot, e: BulletHitBulletEvent) =
discard bot.resolveOwnBullet(e.bullet.bulletId) # bullet-vs-bullet: free the slot
@@ -630,6 +639,13 @@ method onBulletHitBullet*(bot: ModularBot, e: BulletHitBulletEvent) =
bot.strafeMover.removeBulletNear(e.bullet.x, e.bullet.y)
bot.surfMover.removeBulletNear(e.bullet.x, e.bullet.y)
bot.learnedMover.removeBulletNear(e.bullet.x, e.bullet.y)
# `e.bullet` is OUR bullet; `e.hitBullet` is the bullet it struck. When that
# is an ENEMY bullet, the event exposes its real endpoint + heading - a real
# resolution for a wave that would otherwise wait for the deadline.
if e.hitBullet.ownerId != getMyId() and e.hitBullet.bulletId != 0:
discard bot.learnedMover.resolveEnemyBullet(
e.hitBullet.x, e.hitBullet.y, degToRad(e.hitBullet.direction),
e.hitBullet.ownerId, bot.tick, false)
method onHitByBullet*(bot: ModularBot, e: HitByBulletEvent) =
# Feeds the ram bullet-rain abort window. Accumulate REAL ENERGY (the server's
@@ -637,6 +653,11 @@ method onHitByBullet*(bot: ModularBot, e: HitByBulletEvent) =
# energy/turn rate (see movements/ram_decision.bulletDamage).
bot.ramDmgAccum += bulletDamage(e.bullet.power)
bot.moveTracker.registerHit(e.bullet.power, e.bullet.direction, getX(), getY())
# A real ENEMY bullet hit us: its endpoint (our impact point) + heading give
# the wave's EXACT straight line, so resolve and drop that live wave now.
discard bot.learnedMover.resolveEnemyBullet(
e.bullet.x, e.bullet.y, degToRad(e.bullet.direction),
e.bullet.ownerId, bot.tick, true)
proc enemyEnergyForReport(bot: ModularBot): float =
## Last-scanned energy of the enemy the report is about (current target,
+1 -1
View File
@@ -511,7 +511,7 @@ proc knownEnvNames*(): seq[string] =
LearnedDecayEveryEnv, LearnedDecayShiftEnv, LearnedAlphaEnv,
LearnedTravelEnv, LearnedReversalEnv, LearnedPrefDistEnv,
LearnedDistBandEnv, LearnedRadialFracEnv, LearnedWallMarginEnv,
LearnedGlobalEnv, LearnedLabelEnv, LearnedLogEnv,
LearnedGlobalEnv, LearnedLabelEnv, LearnedRealEventsEnv, LearnedLogEnv,
# harness vars (read by the test framework, inherited by the bot, so they
# must NOT be reported as typos)
"TR_SERVER_JAR", "TR_BATTLE_RUNNER", "TR_BATTLE_RUNNER_DIR",