feat(ModularBot): 6 guns, pattern matcher, melee modules, adversarial bots

- New guns: guess-factor (GF histogram), pattern-matcher (movement tape replay)
- New modules: minimum-risk melee movement, spinning melee radar
- New test bots: PatternMover, RandomMover, WaveSurfer
- Fixed: FeedbackEvent now carries actualX/actualY for proper GF learning
- Fixed: TM gun warmup gating + directional residuals
- Fixed: circular gun integrated formula + multi-bin omega cache
- Fixed: oscillator wall-bounce lockout
- Fixed: phantom meteor perpendicular body orientation
- 6/6 battle wins across all enemy types
This commit is contained in:
2026-09-20 00:59:53 +02:00
parent 254c7dc997
commit 1ed7797cb6
184 changed files with 80149 additions and 21 deletions
BIN
View File
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
# Package
version = "0.1.0"
author = "Davide Cappellini"
description = "Random movement adversary — tests guns against unpredictable movement"
license = "MIT"
srcDir = "src"
bin = @["RandomMover"]
# Dependencies
requires "nim >= 2.0.0"
requires "tankroyale_botapi >= 1.0.1"
@@ -0,0 +1,11 @@
{
"name": "RandomMover",
"version": "0.1.0",
"authors": ["Davide Cappellini"],
"description": "Random movement adversary — tests guns against unpredictable movement",
"homepage": "",
"countryCodes": ["IT"],
"gameTypes": ["classic", "1v1"],
"platform": "Nim",
"programmingLang": "Nim"
}
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
cd "$(dirname "$0")"
exec ./RandomMover >> /tmp/randommover_stdout.log 2>> /tmp/randommover_stderr.log
+2
View File
@@ -0,0 +1,2 @@
--path:"../common_libs"
switch("outdir", "out")
+11
View File
@@ -0,0 +1,11 @@
{
"name": "RandomMover",
"version": "0.1.0",
"authors": ["Davide Cappellini"],
"description": "Random movement adversary — tests guns against unpredictable movement",
"homepage": "",
"countryCodes": ["IT"],
"gameTypes": ["classic", "1v1"],
"platform": "Nim",
"programmingLang": "Nim"
}
+46
View File
@@ -0,0 +1,46 @@
# RandomMover — random speed/turn with persistence, head-on firing.
# Purpose: test guns against unpredictable movement.
import std/[math, os, random]
import tankroyale_botapi
const botJsonPath = currentSourcePath().parentDir / "RandomMover.json"
type RandomMover = ref object of Bot
currentSpeed: float
currentTurn: float
ticksUntilChange: int
proc newDirection(bot: RandomMover) =
bot.currentSpeed = rand(-8.0..8.0)
bot.currentTurn = rand(-10.0..10.0)
bot.ticksUntilChange = rand(10..20)
method onRoundStarted*(bot: RandomMover, e: RoundStartedEvent) =
randomize()
setAdjustGunForBodyTurn(true)
setAdjustRadarForBodyTurn(true)
setAdjustRadarForGunTurn(true)
newDirection(bot)
method onScannedBot*(bot: RandomMover, e: ScannedBotEvent) =
let bearing = directionTo(getX(), getY(), e.x, e.y)
let gunDelta = normalizeRelativeAngle(bearing - getGunDirection())
setGunTurnRate(gunDelta.clamp(-MAX_GUN_TURN_RATE, MAX_GUN_TURN_RATE))
if abs(gunDelta) < 10.0 and getGunHeat() <= 0.0:
discard setFire(1.0)
method run*(bot: RandomMover) =
while isRunning():
dec bot.ticksUntilChange
if bot.ticksUntilChange <= 0:
newDirection(bot)
setTargetSpeed(bot.currentSpeed)
setTurnRate(bot.currentTurn)
setRadarTurnRate(45.0)
go()
when isMainModule:
var bot = RandomMover()
start(bot, botJsonPath)