M5: Bot looting, combat and tide awareness

BotBrain plays a match with the commands a player sends: it picks a landing
marker near the barge's route, loots points of interest (following their own
walking routes into huts, lofts and piers), fights opponents it can see,
bandages itself, and gets to ground the coming tide will leave dry. BotWorld
is the map every bot shares: loot markers, routes, and each tide phase's safe
ground, which is the dry land joined to the island's highest walkable ground.

Three difficulties (Tuning.BOT_DIFFICULTIES) set reaction time, sight range
and aim error. The server mixes them unless --bot-difficulty says otherwise.

NavGrid labels connected regions when it is built, so a goal that is cut off
is turned down without a search of the whole island (about 70 ms each).

make bot-matches plays 20 bot-only matches and checks winners, drownings and
difficulty. Seeds 101 to 120: 20 of 20 with a winner, 7 of 460 deaths were
drownings (1.5%), easy bots placed worst (13.7 against 11.8 and 12.0) and
hard bots took the most eliminations (186 against 137 and 132).

Closes #28

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 02:42:10 -05:00
co-authored by Claude Opus 5.5
parent 793caf2b12
commit 4db605c33d
23 changed files with 1691 additions and 19 deletions
+24 -2
View File
@@ -139,8 +139,30 @@ per server tick across all bots; others wait their turn.
`NavBot` follows a path: it steers at the next waypoint, sprints on long dry stretches,
jumps when it stops making progress, and after a few tries marks the point blocked and
plans around it. The brains in M5 choose its goals; until then the server's bots roam
between random reachable places.
plans around it. A goal the grid's regions show to be cut off (inside a ring of rock,
behind a hut's walls) is turned down without a search, which would otherwise cover the
whole island before giving up.
`BotBrain` decides where a bot goes and what it presses, and gives `NavBot` its goals.
It knows what a player would: the map (`BotWorld`: loot markers at the points of
interest and the ground each tide level will leave dry), the tide forecast, items
within a few metres, opponents in view with a clear line to them, and who just hit it.
Each tick, in order of urgency, it gets to ground the coming tide won't reach, fights a
visible opponent if it is armed, bandages itself when nobody is in view, picks up
useful items and opens chests, walks to the next loot marker, and otherwise wanders the
safe ground. Difficulty (`Tuning.BOT_DIFFICULTIES`) sets its reaction time, how far it
sees and how far its aim wanders.
Two things the brain handles itself, because the grid is flat terrain only:
- Huts, lofts and piers. Their doors and steps are finer than the grid, so a bot walks
to the foot of the point of interest's own walking route and follows its points in,
then back out the same way, before anything else, even if it must flee.
- Safe ground. For each tide phase it is the dry land joined to the island's highest
walkable ground, so it only shrinks, each phase's inside the last. A bot off it
leaves when the time before the next rise only just covers the walk.
`tools/bot_matches.gd` (`make bot-matches`) plays whole bot-only matches on a run of
seeds and reports winners, causes of death and how each difficulty placed.
## Terrain
+6 -2
View File
@@ -57,8 +57,12 @@ during a match waits in the lobby for the next one. Every timer can be changed p
server through `MatchRules`. Match 0 uses the server's seed; later matches derive theirs
from it, so a whole session can be replayed from one seed.
Bots fill empty slots. 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`.
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
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`.
## The island