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
+39
View File
@@ -223,6 +223,45 @@ const BOT_STUCK_REPATHS: int = 3
## Each bot re-checks its remaining path against grid changes this often, in ticks.
const BOT_PATH_CHECK_TICKS: int = 15
# Bot brains. Bots loot, fight, heal and keep ahead of the tide with only what a player
# would know: what they can see, the map's points of interest, and the tide forecast.
## Per difficulty: `reaction` is seconds between first seeing an opponent and firing,
## `aim_error` the most their aim wanders off the target in degrees, `sight` how far
## they can pick an opponent out in metres, and `lead` how much of a moving target's
## travel they allow for with slow shots (0 none, 1 all of it).
const BOT_DIFFICULTIES: Array[Dictionary] = [
{"name": "easy", "reaction": 0.9, "aim_error": 7.0, "sight": 45.0, "lead": 0.0},
{"name": "normal", "reaction": 0.5, "aim_error": 3.5, "sight": 65.0, "lead": 0.5},
{"name": "hard", "reaction": 0.25, "aim_error": 1.5, "sight": 90.0, "lead": 1.0},
]
## Each bot looks around once in this many ticks.
const BOT_SENSE_TICKS: int = 6
## Bots see this far to either side of where they face, and notice anyone this close
## whichever way they face.
const BOT_VIEW_HALF_ANGLE_DEGREES: float = 100.0
const BOT_HEARING_METRES: float = 10.0
## A bot remembers an opponent it has lost sight of for this long.
const BOT_MEMORY_SECONDS: float = 4.0
## A bot's aim drifts to a new error this often, in ticks.
const BOT_AIM_WANDER_TICKS: int = 12
## Bots ease off the trigger while bloom is above this, in degrees.
const BOT_BLOOM_PAUSE_DEGREES: float = 3.0
## Bots notice items lying within this distance.
const BOT_LOOT_SIGHT_METRES: float = 12.0
## The most weapons a bot carries; its other slots are for consumables.
const BOT_MAX_WEAPONS: int = 3
## Ground counts as safe from the next tide level when it stands this far above it.
const BOT_SAFE_MARGIN_METRES: float = 1.5
## A bot off safe ground leaves when the time to the next rise is less than its
## distance to safe ground at this speed, plus the buffer.
const BOT_FLEE_SPEED: float = 1.5
const BOT_FLEE_BUFFER_SECONDS: float = 20.0
## With less than this long before the water rises, bots only loot on safe ground.
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
# Building
const GRID_CELL_METRES: float = 4.0
## The most of each material a player can carry.