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>
This commit is contained in:
2026-11-15 01:13:25 -05:00
co-authored by Claude Opus 5.5
parent 4177bfff76
commit eb239c5424
15 changed files with 1135 additions and 16 deletions
+2 -2
View File
@@ -300,8 +300,8 @@ What isn't sent: props, chests' places and their contents, which the client roll
itself from the seed, as it does the island; and a piece's health, which follows from
how far its building had got, the ticks since, and the damage it has taken. So a
piece being built costs nothing on the wire. A scripted match of 12,198 ticks with 24
players made 121 messages, 2.3 KB in all. Bots don't build yet, so a match of people
building will make far more: a new piece is about 16 bytes to each client.
players made 121 messages, 2.3 KB in all. That was before bots built (M6); a match with
building makes more: a new piece is about 16 bytes to each client.
`ClientWorld` applies them to the client's world. `NetWorld.world_hash()` covers
everything replicated this way, and a client that has applied every message up to a
+46
View File
@@ -112,6 +112,52 @@ Every match ended with one player standing before the tide's clock ran out. Matc
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
+5 -1
View File
@@ -60,7 +60,11 @@ from it, so a whole session can be replayed from one seed.
Bots fill empty slots. They pick a landing spot, loot, fight, bandage themselves and keep
ahead of the tide, knowing only what a player would. They come in three difficulties,
easy, normal and hard, which differ in reaction time, sight range and aim; a server
mixes them unless told otherwise. Bots don't build yet, don't break crates, and don't
mixes them unless told otherwise. Bots build too: once armed, they gather with the
boathook (crates included) when nothing more pressing is going on. In a fight they put
up a wall when shot from ambush, while reloading or when worn down, wall themselves off
to heal instead of running when badly hurt, and build ramps up to someone on a cliff
or a steep rise. At the last stand they ring their spot with breakwaters. They don't
use powder kegs or the line thrower. Offline play is a local server filled with bots,
the same game code as online play. A downed duo partner can be revived, within `REVIVE_SECONDS`.