RECORDANDRONCO/tools/balance_report.py
type-two 975f305fa1 Round 4: balance-arena harness with lua telemetry, minimap radar, damage smoke, harvester-attack warning, Needle Drop + Compression maps
Fixes a critical bug: undeployed MCV vans now count for short-game survival —
previously every match ended at tick 1 (all players 'defeated', local player
'won'). The bot-vs-bot shellmap claim from earlier rounds was invalid for the
same reason: shellmaps stall with Bot: players and matches insta-ended. The
arena map + tools/balance_report.py is the real, verified harness.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 02:09:20 +10:00

35 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Summarize a shellmap bot-war from lua.log BAL telemetry.
Usage: balance_report.py [path-to-lua.log]
"""
import os, re, sys
path = sys.argv[1] if len(sys.argv) > 1 else os.path.expanduser('~/Library/Application Support/OpenRA/Logs/lua.log')
rows = []
for line in open(path):
m = re.search(r'BAL t=(\d+) (\w+) cash=(\d+) stored=(\d+) units=(\d+) buildings=(\d+)', line)
if m:
rows.append((int(m[1]), m[2], int(m[3]), int(m[4]), int(m[5]), int(m[6])))
m = re.search(r'BAL t=(\d+) (\w+) ELIMINATED', line)
if m:
print(f'*** {m[2]} ELIMINATED at tick {m[1]} (~{int(m[1]) // 25}s)')
if not rows:
sys.exit('no BAL telemetry found')
bots = sorted({r[1] for r in rows})
print(f'{"tick":>6} ' + ''.join(f'{b + " $/store/u/b":>28}' for b in bots))
ticks = sorted({r[0] for r in rows})
for t in ticks[:: max(1, len(ticks) // 12)]:
line = f'{t:>6} '
for b in bots:
r = next((x for x in rows if x[0] == t and x[1] == b), None)
line += f'{f"{r[2]}/{r[3]}/{r[4]}/{r[5]}" if r else "-":>28}'
print(line)
print('\nfinal:')
for b in bots:
r = [x for x in rows if x[1] == b][-1]
print(f' {b}: cash={r[2]} stored={r[3]} units={r[4]} buildings={r[5]}')