Files
claudeandClaude Opus 5.5 eb239c5424 M6: Bots that build
Bots now gather materials with the boathook and build with the same build
command and Building.check a player's client goes through:

- Gathering: an armed bot with nothing more pressing gathers from props
  nearby (12 m while looting, 24 m once there's nothing left to loot) up to
  60 of a material, or 120 in the last three tide phases. Not within 10 s of
  seeing an opponent or being hit, and not when hurt.
- Cover: a wall toward a shooter who catches it reloading, from ambush or
  worn down to 60, then waits behind it to reload or heal.
- Wall and heal: a badly hurt bot that would break off walls itself off and
  heals where it stands instead, if it can afford a wall.
- Ramps: a staircase of ramps, each from the top of the last, up to an
  opponent on a cliff or a steep rise (at most 5 a fight).
- Breakwaters: late in the match, a bot the tide would catch before it
  reached dry ground, or one at the last stand, rings its cell with four
  breakwaters and stays inside while they hold.

Measured with the new `make bot-builds` (tools/bot_builds.gd): every other
bot builds and the rest are a control group. Over 40 matches, seeds 501 to
540: builders built in 53% of the fights they began with materials for a
wall (12% of all fights; most fights are in the landing, before anyone has
gathered), lost 58% of the fights they built in against 67% of the rest,
and placed 12.1 on average against the control's 12.8. Overall fight losses
(65.8% / 65.7%) and wins (20 / 20) came out level; docs/BALANCE.md has the
numbers and the earlier batches that led to the careful gathering. Worst
p99 tick 3.4 ms of the 12 ms budget.

Closes #29

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:13:25 -05:00

176 lines
9.6 KiB
Markdown

# Balance
How Tidewall's pacing and weapons were tuned, from batches of bot-only matches. The
targets are in [GDD.md](GDD.md#balance) and in `src/sim/tuning.gd` (`BALANCE_*`).
## How to measure
`make balance` (`tools/balance.sh`) plays 200 bot-only matches of 24 players from seed
1001, in four processes under `nice`, and writes `build/balance/report.txt`:
- match length from the barge leaving to the last player standing, as quantiles;
- how many players are still standing at each two minutes;
- causes of every fall, and the share the sea took;
- eliminations by weapon, the boathook included;
- wins, eliminations and mean place by bot difficulty.
It fails if there are fewer than 200 matches, any match lacks a winner, the median
length is outside 12 to 18 minutes, or one weapon has more than 35% of weapon
eliminations. `BALANCE_MATCHES`, `BALANCE_FIRST`, `BALANCE_JOBS` and `BALANCE_DIR`
change the batch. A 30-match look takes about two minutes on four cores.
Bot-only matches are what the server can play on its own. They are not people: they
show where the numbers are badly off, not how a match feels. Eric's playtest (R6) is
the check on that.
## What the first batches showed (2026-11-14)
The starting point, 30 matches on seeds 1001 to 1030:
| | Before |
|---|---|
| Median match | 5.0 min (p10 3.3, p90 7.3) |
| Players standing at 2 min | 3.4 of 24 |
| Ended by the tide's clock | 0 of 30 |
| Top weapon | the boathook, 41% |
Most of a lobby fell within two minutes of the drop. Tracing single matches showed why,
in order of how much each mattered:
1. **Bots leapt from the barge on a timer, not when their landing spot was in reach.**
A bot that picked a spot further along the route leapt early and came down hundreds
of metres short, then walked across the island unarmed. This was a bug in
`NavBot._ride`.
2. **Unarmed bots started boathook brawls** with anyone within 6 m, so the landing was a
melee. The boathook took 41% of all eliminations.
3. **Bots went looking for fights.** A bot picked out any opponent within its sight
(45 to 90 m) and chased them, and with nothing to loot it walked to a random safe
point anywhere on the island, every 40 seconds, so the last few always met.
4. **Bots never broke off.** Fights ran until someone fell. An unarmed bot kept looting
while someone shot at it.
5. **The tide's endgame came at about 9 minutes.** Phase 3's rise to 30 m left the last
few players on ground small enough that they always met then.
## Changes
| Change | Where | Why |
|---|---|---|
| Bots leap once their landing spot is in gliding reach, or once the barge starts drawing away from it | `NavBot._ride` | Finding 1, a bug |
| Bots weigh `BOT_LANDING_CHOICES` (8) landing spots and take the one with the fewest other bots' landings within `BOT_LANDING_SPREAD_METRES` (60 m) | `BotBrain._drop`, `BotWorld.landings` | Spread the landing |
| An unarmed bot only swings its boathook at whoever hit it | `BotBrain.think` | Finding 2 |
| Bots pick out a new opponent only within `BOT_ENGAGE_METRES` (30 m); one who shoots them is fought as far as they can see | `BotBrain._sense` | Finding 3 |
| With nothing to loot, bots roam to safe ground within `BOT_ROAM_METRES` (60 m) and hold it for `BOT_HOLD_SECONDS` (45 s) | `BotBrain._hunt`, `BotWorld.random_safe_near` | Finding 3; the single biggest change to match length |
| An unarmed bot runs from a gun held in view; a hurt bot with something to heal with breaks off at its difficulty's `retreat` health (normal 35, hard 50, easy never) | `BotBrain._check_retreat` | Finding 4, and the judgement issue #76 asked of hard bots |
| Aim error: easy 7 to 9 degrees, normal 3.5 to 5.5, hard 1.5 to 3 | `BOT_DIFFICULTIES` | Bots hit nearly every shot at close range |
| Tide: lower early levels (6, 14, 24, 34, 46, 58, 75 m, was 8, 18, 30, 42, 54, 64, 75) and longer holds (150, 130, 120, 110, 90, 60, 45 s); rises unchanged. With sudden death every match ends within 17.75 minutes | `TIDE_PHASES` | Finding 5: move the squeeze later, and keep the longest match inside 18 minutes |
| Rivet repeater damage 17 to 15 | `WEAPONS` | It was the top weapon at 33%, close to the limit, as the commonest gun with the highest damage per second |
Tried and dropped: doubling the weapons guaranteed at points of interest
(`LOOT_MIN_POI_WEAPONS` to 48). It made no clear difference to how many bots were armed
early; the leap bug was the real cause. It stays at one per player.
Each step, on the same 30 seeds (median minutes, players standing at 2 min):
| Step | Median | At 2 min |
|---|---|---|
| Start | 5.0 | 3.4 |
| Unarmed bots don't start brawls | 5.4 | 4.0 |
| Engage range, local roaming, aim error | 8.7 | 5.6 |
| Landing spread | 8.7 | 5.8 |
| Longer holds | 9.7 | 5.8 |
| Retreat | 9.4 | 5.7 |
| Leap fix, running from guns | 9.0 | 5.0 |
| Lower levels, longer schedule | 9.5 | 5.1 |
| Holding ground | 14.0 | 5.5 |
## The 200-match result
`make balance` on seeds 1001 to 1200, with every change above (2026-11-14). It passes.
| | Before (30 matches) | After (200 matches) |
|---|---|---|
| Median match | 5.0 min | **13.1 min** (target 12 to 18) |
| p10 to p90 | 3.3 to 7.3 min | 9.2 to 14.6 min |
| Shortest, longest | 1.2, 8.8 min | 2.2, 16.4 min |
| Players standing at 2, 6, 10, 14 min | 3.4, 0.7, 0.0, 0.0 | 6.4, 3.6, 2.4, 0.7 |
| Ended by the tide's clock | 0 | 0 |
| Falls to the sea | 0.4% | 2.1% |
| Top weapon | boathook 41% | rivet repeater 31.7% (limit 35%) |
Eliminations by weapon over the 200 matches: rivet repeater 31.7%, dock carbine 27.4%,
signal revolver 22.4%, fowling piece 11.5%, harpoon gun 4.5%, whaler's longgun 2.3%,
boathook 0.3%. The three commonest guns take most eliminations, as they should; the
rarer heavy weapons are under-used by bots, which don't yet lead long shots well or
fight at the ranges the longgun suits.
By difficulty: hard won 148 matches, normal 42 and easy 10, with 2,053, 1,434 and 1,013
eliminations and mean places of 11.93, 12.41 and 13.12. Hard bots are now clearly the
strongest, which issue #76 found they weren't: breaking off at 50 health and the wider
gap in aim both count.
Every match ended with one player standing before the tide's clock ran out. Matches end
when the rising water brings the last few together: half of them end between 11 and 14
minutes, from phase 4's rise to phase 6's hold.
## Bots that build (M6, 2026-11-15)
`make bot-builds` (`tools/bot_builds.sh`) plays bot-only matches in which every other
bot gathers and builds and the rest don't, so the two groups meet the same islands,
opponents and difficulty mix. Each bot counts its fights (a stretch with an opponent in
which shots or swings were traded), whether it began them with the materials for a
wall, whether it placed a piece in them, and whether it fell.
What bots build: a wall toward a shooter who catches them reloading, from ambush or
worn down; a wall to heal behind instead of running when badly hurt; ramps up to
someone on a cliff or a steep rise; and, late in the match, a ring of breakwaters round
their cell when the tide would catch them or at the last stand.
The first batches had builders gathering up to 120 of a material whenever a prop was
in reach. Over 40 matches (seeds 501 to 540) they won 15 to the control group's 25 and,
on seeds 521 to 540, lost 70% of their fights to the control group's 63%. Fights they
built in went better, so the cost was in gathering: standing at a prop facing away
from trouble, and time not spent looting. Gathering now waits until 10 s after the
last sight of an opponent or hit taken, not when hurt, and stops at 60 (120 in the last
three tide phases, for a ring).
With that, over seeds 501 to 540:
| | builders | control |
|---|---|---|
| fights | 584 | 594 |
| fights lost | 65.8% | 65.7% |
| mean place | 12.1 | 12.8 |
| wins | 20 | 20 |
- Builders began 23% of their fights with the materials for a wall, and built in 53% of
those, 12% of all their fights. Most fights are in the landing rush, before anyone has
gathered anything.
- In the fights they built in they lost 58% (41 of 71); in the rest, 67%.
- They place better on average, by 0.2 to 1.0 places in every 20-match batch measured.
- They don't yet win fights or matches more often overall. Building helps a bot in the
fights it builds in. The time spent gathering, and fewer than a quarter of fights
begun with materials, leave the totals level.
- Breakwater rings are rare: few matches last to the last stand, and few bots by then
have 120 of one material. Tests cover the ring itself.
- The worst p99 tick in any of these matches was 3.4 ms, inside the 12 ms budget.
`make bot-builds` checks what held: builders build in over a third of the fights they
can afford to, lose fewer of the fights they build in than of the rest, and place no
worse than the control group.
## Known and left open
- **The landing is still bloody.** About three quarters of a bot lobby falls in the first
two minutes, mostly unarmed bots shot by the first to find a gun. People are likely
to spread out and hide more than bots do; R6 will show it. More could be done in
bot looting (they give up on a hut whose chest someone else just emptied and set off
across the island unarmed). Noted on #74 (H10, bot follow-ups).
- **The sea takes few players.** Bots read the forecast well and leave in time, so
drowning is rare. The tide still decides where the endgame is.
- **Hard bots win three quarters of matches.** Against people that is what a "hard"
setting should be, but if R6 finds them unfair, `retreat` and `aim_error` in
`BOT_DIFFICULTIES` are the levers.
- **The whaler's longgun and harpoon gun are rarely the weapon that finishes someone.**
They are rare (rarity 2 and 1) and bots use them poorly; no change was made from bot
data alone.