## Corpse measurement: run a real melee where bots kill each other and log ## ModularBot's tracker-vs-server disagreement per tick. ## ## The tracker probe (ModularBot TR_TRACKER_PROBE=1) records, each tick: ## tracker_alive (bot.enemyTracker.allAlive().len), server_ec (getEnemyCount()), ## each tracked enemy's lastSeenTick, the dead map and any reconcile prunes. ## The queue probe records the event queue BEFORE removeOldEvents deletes events. ## ## TR_TRACKER_RECONCILE defaults to 0 here so the RAW corpse behaviour is ## measured (a corpse can only be removed by a BotDeathEvent fast-path). ## ## MELEE_ROUNDS=20 TR_SERVER_JAR= \ ## nim c -r --path:common_libs common_libs/tests/measure_corpse_melee.nim import std/[os, strformat, strutils] import test_framework/server_manager import test_framework/bot_compiler import test_framework/runner_process import test_framework/battle_result const repoRoot = currentSourcePath().parentDir.parentDir.parentDir modularBotDir = repoRoot / "ModularBot_garage" samplesDir = "/home/davide/Downloads/robocode-tankroyale/sample-bots-nim-linux-1.0.7" let drussDir = getEnv("DRUSSGT_BOTDIR", "/tmp/tr_bots/DrussGT") let rounds = parseInt(getEnv("MELEE_ROUNDS", "20")) let probePath = getEnv("TR_TRACKER_PROBE_PATH", "/tmp/tracker_probe_melee.jsonl") # RAW behaviour: no reconciliation, so any corpse persists until a BotDeathEvent. putEnv("TR_TRACKER_RECONCILE", getEnv("TR_TRACKER_RECONCILE", "0")) putEnv("TR_TRACKER_PROBE", "1") putEnv("TR_TRACKER_PROBE_PATH", probePath) if fileExists(probePath): removeFile(probePath) var bots = @[modularBotDir] for name in ["Fire", "Corners", "Crazy", "RamFire", "SpinBot"]: let d = samplesDir / name if dirExists(d): bots.add d if fileExists(drussDir / "DrussGT.sh"): bots.add drussDir echo "server jar : ", getEnv("TR_SERVER_JAR", DefaultServerJar) echo "probe path : ", probePath echo "reconcile : ", getEnv("TR_TRACKER_RECONCILE") echo "bots : ", bots echo "rounds : ", rounds ensureServer() discard compileBots(@[modularBotDir]) let raw = runBattleRunner(getServerUrl(), bots, rounds, 1_800_000, true) let r = parseServerOutput(raw) for b in r.results: echo fmt" {b.name:<12} totalScore={b.totalScore} rank={b.rank} survival={b.survivalCount}" echo "rounds played: ", r.rounds.len