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
+41
View File
@@ -324,6 +324,47 @@ const BOT_LOOT_TIDE_SECONDS: float = 30.0
## Bots give up on a loot spot or an item they can't get to after this long.
const BOT_LOOT_TIMEOUT_SECONDS: float = 45.0
const BOT_PICKUP_TIMEOUT_SECONDS: float = 8.0
## M6, bots that build. An armed bot with nothing more pressing gathers with the
## boathook until its best material reaches BOT_BUILD_STOCK (in the last
## BOT_STRAND_PHASES tide phases, enough for four breakwaters): from a prop within
## BOT_HARVEST_NEAR_METRES while it loots, or BOT_HARVEST_METRES once it has nothing
## left to loot. It gives up on a prop after BOT_HARVEST_SECONDS. It doesn't start
## within BOT_GATHER_QUIET_SECONDS of last seeing an opponent or being hit, or with
## health and armor under BOT_GATHER_HEALTH.
const BOT_BUILD_STOCK: int = 60
const BOT_GATHER_QUIET_SECONDS: float = 10.0
const BOT_GATHER_HEALTH: int = 60
const BOT_HARVEST_NEAR_METRES: float = 12.0
const BOT_HARVEST_METRES: float = 24.0
const BOT_HARVEST_SECONDS: float = 12.0
## Cover: a bot shot while it reloads, within a second of first seeing its shooter, or
## with health and armor down to BOT_COVER_HEALTH, puts a wall between them, and waits
## behind it at least BOT_COVER_HOLD_SECONDS and until any reload is done. Only for a
## shooter at least BOT_COVER_MIN_METRES off, and no more often than BOT_COVER_SECONDS.
const BOT_COVER_HOLD_SECONDS: float = 2.0
const BOT_COVER_HEALTH: int = 60
const BOT_COVER_MIN_METRES: float = 6.0
const BOT_COVER_SECONDS: float = 5.0
## A badly hurt bot that could break off (BOT_DIFFICULTIES "retreat") and can afford a
## wall walls itself off and heals there instead, for up to this long.
const BOT_COVER_HEAL_SECONDS: float = 7.0
## Ramps: up toward an opponent at least BOT_RAMP_RISE_METRES higher, within
## BOT_RAMP_REACH_METRES across, and up ground at least this steep (rise over run).
## At most BOT_RAMP_MAX ramps a fight; the bot walks on BOT_RAMP_WALK_SECONDS after each.
const BOT_RAMP_RISE_METRES: float = 3.0
const BOT_RAMP_REACH_METRES: float = 24.0
const BOT_RAMP_SLOPE: float = 0.5
const BOT_RAMP_MAX: int = 5
const BOT_RAMP_WALK_SECONDS: float = 1.5
## At the last stand (a tide phase that leaves no dry ground), a bot on the last high
## point rings its own cell with breakwaters once the rise is this close.
const BOT_RING_SECONDS: float = 30.0
## In the last this many tide phases, a bot running from the tide that can't reach dry
## ground before the sea reaches its feet rings its cell with breakwaters instead, if
## the coming level is one they hold back (BREAKWATER_MAX_HEAD, less a metre).
const BOT_STRAND_PHASES: int = 3
## A fight ends for the measurement (M6) once the bot has had nobody to fight this long.
const BOT_FIGHT_GAP_SECONDS: float = 4.0
# Building
const GRID_CELL_METRES: float = 4.0