M4: Bot navigation
NavGrid is the map bots plan on: a point per 2 m terrain sample, solid on cliffs and where solids stand between step and head height, and costlier where the water is deeper than wading. Path search uses Godot's AStarGrid2D. The grid syncs every tick: new solids (walls, pieces) block points at once, removed ones are found by a rolling scan, and points turn wet as the tide and flood reach them. Each change is stamped with its tick. NavBot follows a path with ordinary PlayerCommands: it steers at waypoints, sprints on long dry stretches, jumps when stalled, and marks a point blocked after repeated stalls. Every half second it checks its remaining path against the change stamps and plans again if water or a wall now crosses it. One path is planned per server tick across all bots. The server builds the grid while the lobby waits and its bots now roam between random reachable places, replacing the placeholder wander bot. Tests: 150 of 150 random reachable targets reached on 50 islands in the sweep; the test runs 2 per island and needs 95%. New walls and rising water both cause a new path around them; a broken wall opens the grid again; with no dry way round, the bot swims. 23 roaming bots on an island: p99 tick 1.6 ms against the 12 ms budget. Closes #27 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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: WanderBot in loop.bots.slice(1):
|
||||
for bot: NavBot 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)
|
||||
|
||||
Reference in New Issue
Block a user