Files
SirRoboGarage/common_libs/tests/measure_bridge_battle.nim
SirStone c091bf3c34 harness: upgrade to server 1.3.1, keep 0.35.5 selectable, re-baseline
All prior measurements ran on server 0.35.5. The default is now the current
1.3.1 jar, with the legacy jar kept and switchable via TR_SERVER_JAR (no code
edit). test_gauntlet_5bots.nim no longer clobbers a caller's TR_SERVER_JAR -
it used to putEnv() unconditionally, so an override was silently ignored.

RE-BASELINE (controlled RulesProbe battle, stationary bot, powers 0.1/0.5/1/2/3):

  dimension                    1.3.1              0.35.5            verdict
  bullet damage per hit        0.4/2/4/10/16       identical         SAME
  bullet speed (20-3p)         within noise        within noise      SAME
  post-fire gun heat (1+p/5)   identical           identical         SAME
  cooling                      0.1/tick            0.1/tick          SAME
  bulletDamage SCORE           exactly 100/round   104..113/round    DIFFERENT
  bulletKillBonus (20%)        20/round            20..23/round      DIFFERENT

LOUD FINDING - a SCORING rule changed, physics did not: 0.35.5 credits
OVERKILL to bulletDamage (the killing bullet's full damage even past 0 energy);
1.3.1 caps it at the energy actually removed. Every 0.35.5 score is therefore
inflated ~5-6%, and bulletKillBonus inherits the inflation. Gauntlet totals
shift accordingly (SittingDuck 1936 -> 1800, WaveSurfer 1886 -> 1669).

Consequence: score-based numbers recorded on 0.35.5 are NOT comparable to 1.3.1.
Our gun A/Bs used real HIT RATE, not score, so those conclusions stand.

Runner 1.0.2 (unchanged, no newer one on the box) is measured compatible with
the 1.3.1 server. Note TrBattleCapture uses the runner's EMBEDDED server, which
is 1.0.2 - so the capture path still runs an older engine than the gauntlet.

Also re-ran acceptance_offline_vs_online on the new default: 12/12.
2026-09-21 22:41:06 +02:00

42 lines
1.6 KiB
Nim

## Re-baseline the DrussGT bridge battle on the selected server.
##
## ModularBot (Nim) vs the real DrussGT running through tools/robocode_shim.
## DrussGT is a prebuilt Java bot dir (only .json/.sh), so the framework's
## compileBots() cannot be used for it; we drive the runner directly.
##
## BRIDGE_ROUNDS=5 TR_SERVER_JAR=<jar> \
## nim c -r --path:common_libs common_libs/tests/measure_bridge_battle.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"
let drussDir = getEnv("DRUSSGT_BOTDIR", "/tmp/tr_bots/DrussGT")
let rounds = parseInt(getEnv("BRIDGE_ROUNDS", "5"))
if not fileExists(drussDir / "DrussGT.sh"):
echo "SKIP: DrussGT bridge bot dir not found at ", drussDir
quit(0)
ensureServer()
discard compileBots(@[modularBotDir])
echo "server jar : ", getEnv("TR_SERVER_JAR", DefaultServerJar)
echo "drussgt dir: ", drussDir
let raw = runBattleRunner(getServerUrl(), @[modularBotDir, drussDir], rounds, 900_000, true)
let r = parseServerOutput(raw)
for b in r.results:
echo fmt" {b.name:<12} totalScore={b.totalScore} rank={b.rank} firstPlaces={b.firstPlaces} survival={b.survivalCount}"
echo "rounds played: ", r.rounds.len
for rr in r.rounds:
var line = " round " & $rr.round & ":"
for b in rr.results:
let st = if b.survived: "surv" else: "dead"
line &= fmt" {b.name}={b.score}({st})"
echo line