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
+11 -1
View File
@@ -25,7 +25,7 @@ func test_defaults() -> void:
func test_all_options() -> void:
var config: ServerConfig = _parse([
"--path", "/ignored", "--server", "--seed=-17", "--port=4000", "--players=3",
"--bots=20", "--ticks=900", "--unthrottled", "--log-every=30",
"--bots=20", "--ticks=900", "--unthrottled", "--log-every=30", "--bot-difficulty=hard",
])
assert_true(config.is_valid(), str(config.errors))
assert_true(config.has_seed)
@@ -36,6 +36,16 @@ func test_all_options() -> void:
assert_eq(config.ticks, 900)
assert_true(config.unthrottled)
assert_eq(config.log_every, 30)
assert_eq(config.bot_difficulty, BotBrain.HARD)
assert_eq(config.to_dictionary()["bot_difficulty"], "hard")
func test_bot_difficulty_defaults_to_mixed_and_rejects_unknown_names() -> void:
assert_eq(_parse(["--server"]).bot_difficulty, -1)
assert_eq(_parse(["--server", "--bot-difficulty=mixed"]).bot_difficulty, -1)
assert_eq(_parse(["--server", "--bot-difficulty=easy"]).bot_difficulty, BotBrain.EASY)
var bad: ServerConfig = _parse(["--server", "--bot-difficulty=brutal"])
assert_false(bad.is_valid())
func test_large_seed_round_trips() -> void:
+1 -1
View File
@@ -77,7 +77,7 @@ func test_server_returns_to_the_lobby_and_starts_the_next_match() -> void:
assert_eq(loop.match_flow.phase, Match.DROP)
assert_eq(loop.bots.size(), 3)
var first_seed: int = loop.match_flow.current_seed()
for bot: NavBot in loop.bots.slice(1):
for bot: BotBrain in loop.bots.slice(1):
loop.sim.entities.find(bot.player_id).health = 0
loop.run_tick()
assert_eq(loop.match_flow.phase, Match.RESULTS)