M4 Bot navigation #27

Closed
opened 2026-11-09 05:27:06 +00:00 by claude · 1 comment
Owner

Depends on: W4, W6

Pathfinding on procedural terrain that updates for flooding and player structures. Bots issue the same commands as human players.

Acceptance

  • Bots reach random reachable targets on 50 seeds with a success rate of at least 95%.
  • Flooded areas and new walls trigger a re-path.
  • 23 bots stay within the server tick budget.
**Depends on:** W4, W6 Pathfinding on procedural terrain that updates for flooding and player structures. Bots issue the same commands as human players. **Acceptance** - Bots reach random reachable targets on 50 seeds with a success rate of at least 95%. - Flooded areas and new walls trigger a re-path. - 23 bots stay within the server tick budget.
claude added this to the v0.4 Match Loop and Bots milestone 2026-11-09 05:27:06 +00:00
claude added the priority/hightype/feature labels 2026-11-09 05:27:06 +00:00
claude added this to the Tidewall v1.0 project 2026-11-09 15:00:07 +00:00
eric referenced this issue from a commit 2026-11-12 04:38:40 +00:00
eric closed this issue 2026-11-12 04:38:40 +00:00
Author
Owner

Done in cc652de.

What changed

  • src/bots/nav_grid.gd (NavGrid): a point per 2 m terrain sample. A point is solid on cliffs and too-steep ground, or where a solid stands between step height and head height. Points where the water is deeper than wading cost 8×. Path search uses Godot's built-in AStarGrid2D, with octile distance and no corner cutting. sync() runs every tick: new solids block points at once, removed solids are found by a rolling scan within a few ticks, and points turn wet as the tide and flood reach them, including breached basins. Every change is stamped with its tick. The build takes about 0.4 s and runs while the lobby waits.
  • src/bots/nav_bot.gd (NavBot): follows a path using only PlayerCommands. It steers at waypoints, sprints on long dry stretches, and jumps when it stalls. After 3 stalls it marks the point blocked and plans again. Every 15 ticks it checks its remaining path against the change stamps, so a new wall or rising water across the path makes it plan again. Only one path is planned per server tick across all bots. Planning numbers are in Tuning (BOT_*).
  • ServerLoop's bots now roam between random reachable places. They replace WanderBot, which is deleted. The smoke hash changes for that reason.
  • docs/ARCHITECTURE.md gained a Bots section.

Acceptance

  • 50 seeds: the exploratory sweep (seeds 100–149, 3 random reachable targets each, 40–160 m away on dry land) reached 150 of 150. The test in make check runs 2 per seed and requires 95%; it passed with no misses.
  • Re-path: test_nav.gd builds a row of real wooden walls across a bot's path mid-walk, and raises the sea over a strip the path crosses. Both cause a new path around the obstacle, and in the water case the bot never swims. Also tested: a broken wall reopens the grid, the bot swims when there's no dry way round, an enclosed goal is unreachable, and the per-tick planning limit holds.
  • Budget: 23 roaming bots plus one idle human on a real island for 75 s: p50 0.87 ms, p99 1.6 ms, max 2.3 ms, 0 ticks over the 12 ms budget. Smoke with 24 bots: p99 1.5 ms. This was measured on a shared host, headless.

make check: 307 tests, self-check and smoke all pass.

Limits, for M5 and M6: the grid is 2D, so bots path on terrain and don't use built floors or ramps as routes; they're treated as open if under step height and solid otherwise. POI interiors with low ceilings rely on stall-and-jump. Roaming is a stand-in until M5 chooses goals.

— tidewall-build

Done in cc652de. **What changed** - `src/bots/nav_grid.gd` (`NavGrid`): a point per 2 m terrain sample. A point is solid on cliffs and too-steep ground, or where a solid stands between step height and head height. Points where the water is deeper than wading cost 8×. Path search uses Godot's built-in `AStarGrid2D`, with octile distance and no corner cutting. `sync()` runs every tick: new solids block points at once, removed solids are found by a rolling scan within a few ticks, and points turn wet as the tide and flood reach them, including breached basins. Every change is stamped with its tick. The build takes about 0.4 s and runs while the lobby waits. - `src/bots/nav_bot.gd` (`NavBot`): follows a path using only `PlayerCommand`s. It steers at waypoints, sprints on long dry stretches, and jumps when it stalls. After 3 stalls it marks the point blocked and plans again. Every 15 ticks it checks its remaining path against the change stamps, so a new wall or rising water across the path makes it plan again. Only one path is planned per server tick across all bots. Planning numbers are in `Tuning` (`BOT_*`). - `ServerLoop`'s bots now roam between random reachable places. They replace `WanderBot`, which is deleted. The smoke hash changes for that reason. - `docs/ARCHITECTURE.md` gained a Bots section. **Acceptance** - 50 seeds: the exploratory sweep (seeds 100–149, 3 random reachable targets each, 40–160 m away on dry land) reached 150 of 150. The test in `make check` runs 2 per seed and requires 95%; it passed with no misses. - Re-path: `test_nav.gd` builds a row of real wooden walls across a bot's path mid-walk, and raises the sea over a strip the path crosses. Both cause a new path around the obstacle, and in the water case the bot never swims. Also tested: a broken wall reopens the grid, the bot swims when there's no dry way round, an enclosed goal is unreachable, and the per-tick planning limit holds. - Budget: 23 roaming bots plus one idle human on a real island for 75 s: p50 0.87 ms, p99 1.6 ms, max 2.3 ms, 0 ticks over the 12 ms budget. Smoke with 24 bots: p99 1.5 ms. This was measured on a shared host, headless. `make check`: 307 tests, self-check and smoke all pass. **Limits, for M5 and M6:** the grid is 2D, so bots path on terrain and don't use built floors or ramps as routes; they're treated as open if under step height and solid otherwise. POI interiors with low ceilings rely on stall-and-jump. Roaming is a stand-in until M5 chooses goals. — tidewall-build
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#27