H3: Balance pass from 200 bot matches (make balance)

make balance (tools/balance.sh, tools/balance.gd, BalanceReport) plays 200
bot-only matches in four processes under nice and reports match length,
players standing over time, causes of death, eliminations by weapon and by
difficulty, judged against the new BALANCE_* targets in Tuning and the
GDD's Balance section.

Before: median match 5.0 min, 3.4 of 24 standing at 2 min, the boathook
41% of eliminations. After, over seeds 1001-1200: median 13.1 min (p10 9.2,
p90 14.6), top weapon the rivet repeater at 31.7%. Passes.

Changes, each traced from single-match runs (docs/BALANCE.md):
- Fix: bots leapt from the barge on a timer and landed hundreds of metres
  short of their spot; they now leap when it's in gliding reach or the
  barge starts drawing away from it.
- Bots spread their landings, only brawl whoever hit them, pick out new
  opponents within 30 m, roam locally and hold ground, run from a gun when
  unarmed, and (normal and hard) break off when badly hurt.
- Aim error widened; rivet repeater damage 17 to 15.
- Tide: lower early levels, longer holds; every match ends within 17.75 min.

Tests: BalanceReport, the new bot behaviours, the tide length. Tests that
leaned on old bot luck now pin or set up what they check. make match moves
to seed 29, where the scripted player still builds.

Closes #56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 06:28:15 -05:00
co-authored by Claude Opus 5.5
parent ffb68a1e89
commit 38812120df
24 changed files with 774 additions and 61 deletions
+13 -3
View File
@@ -12,8 +12,9 @@ static func tick_limit() -> int:
## Plays one match of `bots` bots on `seed_value`. `difficulty` -1 mixes the levels.
## Returns {"seed", "finished", "ticks", "winner", "winner_difficulty", "timed_out",
## "causes": {cause: count}, "places": {difficulty name: [place, ...]},
## "eliminations": {difficulty name: count}, "shots", "slow_ticks", "timing",
## "state_hash"}.
## "eliminations": {difficulty name: count}, "weapon_kills": {item id: count},
## "death_seconds": [seconds into the match of each fall], "shots", "slow_ticks",
## "timing", "state_hash"}. Seconds count from the barge leaving.
static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficulty: int = -1) -> Dictionary:
var loop: ServerLoop = ServerLoop.new(seed_value, 0, bots, null, difficulty)
var flow: Match = loop.match_flow
@@ -23,7 +24,7 @@ static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficul
var result: Dictionary = {
"seed": seed_value, "finished": false, "winner": 0, "winner_difficulty": "",
"timed_out": false, "causes": {}, "places": {}, "eliminations": {}, "shots": 0,
"slow_ticks": [],
"slow_ticks": [], "weapon_kills": {}, "death_seconds": [],
}
var limit: int = tick_limit()
while loop.ticks < limit and flow.phase != Match.RESULTS:
@@ -52,6 +53,15 @@ static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficul
if row["place"] != 1:
var cause: String = row["cause"]
result["causes"][cause] = int(result["causes"].get(cause, 0)) + 1
for record: Dictionary in flow.placements:
if record["left"]:
continue
result["death_seconds"].append(snappedf(float(record["tick"]) / Tuning.TICK_RATE_HZ, 0.1))
if record["cause"] == "weapon" and int(record["by"]) != 0:
var def: ItemDef = ItemCatalog.get_def(int(record["item"]))
# The boathook isn't in the catalog: its code is ItemCatalog.NONE.
var weapon: String = def.id if def != null else (ItemCatalog.BOATHOOK if int(record["item"]) == ItemCatalog.NONE else "unknown")
result["weapon_kills"][weapon] = int(result["weapon_kills"].get(weapon, 0)) + 1
result["timing"] = loop.timing_stats()
result["state_hash"] = loop.sim.state_hash()
return result