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
+9 -3
View File
@@ -47,17 +47,23 @@ func test_percentile_uses_nearest_rank() -> void:
func test_bots_leap_and_humans_without_commands_stay_aboard() -> void:
# Every match starts on the drop carrier. A human who sends nothing rides it; the bot
# leaps at its own fixed moment and falls away.
# leaps once the spot it chose is in gliding reach, before the route ends, and falls
# away.
var loop: ServerLoop = ServerLoop.new(99, 1, 1)
var human: SimEntity = loop.sim.entities.find(1)
var bot: SimEntity = loop.sim.entities.find(2)
assert_eq(human.drop_state, Drop.ABOARD)
assert_eq(bot.drop_state, Drop.ABOARD)
for _index: int in Tuning.TICK_RATE_HZ * 24:
var leapt_tick: int = -1
while not loop.sim.drop.is_over(loop.sim.tick):
loop.run_tick()
if leapt_tick < 0 and bot.drop_state != Drop.ABOARD:
leapt_tick = loop.sim.tick
if leapt_tick >= 0 and loop.sim.tick >= leapt_tick + Tuning.TICK_RATE_HZ * 5:
break
assert_eq(human.drop_state, Drop.ABOARD)
assert_true(human.position.distance_to(loop.sim.drop.barge_position(loop.sim.tick)) < 0.001)
assert_ne(bot.drop_state, Drop.ABOARD, "the bot should have leapt")
assert_true(leapt_tick >= 0, "the bot should have leapt before the route ended")
assert_true(bot.position.y < Tuning.BARGE_ALTITUDE - 20.0, "the bot should be falling, at %s" % bot.position)
+11 -6
View File
@@ -105,17 +105,16 @@ func test_a_clients_world_agrees_with_the_servers_through_a_scripted_match() ->
var most_pending: int = 0
var most_pieces: int = 0
var scripted: SimEntity = sim.entities.find(loop.scripted[0].player_id)
var shielded: bool = false
while flow.phase != Match.RESULTS and loop.ticks < LIMIT_TICKS and differed == 0:
_round()
most_pending = maxi(most_pending, client.replica.pending_count())
most_pieces = maxi(most_pieces, sim.structures.count())
if not shielded and scripted.drop_state == Drop.NONE and scripted.on_ground:
# Since H9 unarmed bots brawl, and on this seed one meets the scripted player
# early. Full armor keeps it alive to harvest and build, which this test needs
# to replicate; the fight itself isn't what's under test.
shielded = true
if scripted.drop_state == Drop.NONE and scripted.on_ground and not scripted.eliminated and loop.scripted[0].step != ScriptedPlayer.DONE:
# On this seed bots meet the scripted player soon after landing. Topping up its
# health and armor until its script is done keeps it alive to harvest and
# build, which this test needs to replicate; the fights aren't under test.
scripted.armor = Tuning.PLAYER_MAX_ARMOR
scripted.health = Tuning.PLAYER_MAX_HEALTH
if not landed and mine.drop_state == Drop.NONE and mine.on_ground and not mine.eliminated:
# On the ground: hand it driftwood for two walls and a floor, and let it
# try the walls.
@@ -129,6 +128,12 @@ func test_a_clients_world_agrees_with_the_servers_through_a_scripted_match() ->
# server finds the driftwood gone before it runs that tick.
refused = true
mine.materials[Materials.DRIFTWOOD] = 0
if loop.ticks == 4 * 60 * Tuning.TICK_RATE_HZ + 10 and sim.props.destroyed.is_empty():
# Bots no longer shoot up the scenery much (H3), so break a prop near the
# scripted player for the props' replication to be tested.
var near: PackedInt32Array = sim.props.near(scripted.position, 200.0)
if not near.is_empty():
sim.damage_prop(near[0], 1 << 20)
if loop.ticks % 150 == 0:
if not _agrees("during the match"):
differed += 1