Skip to content

feat(navbake3d): name geometry sources and rebake dirty tiles - #2748

Open
houko wants to merge 1 commit into
mainfrom
feat/issue-1719-tile-rebaker
Open

houko wants to merge 1 commit into
mainfrom
feat/issue-1719-tile-rebaker

Conversation

@houko

@houko houko commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

navbake3d.Geometry now names the geometry each Add call added: every Add method returns a SourceID, Remove takes a source's triangles and off-mesh links back out and rebuilds the XZ index around them so the rest of the level bakes exactly as before, Replace swaps one source for the geometry a build callback adds, and TilesAffected reports the sorted tiles whose padded BakeTile bounds a source overlaps using the same erosion border the bake uses, so a triangle just outside a tile still marks both tiles. NavTileRebaker queues those tiles, bakes them from the geometry's triangle stores on worker goroutines (or inside Update when Workers is 0), installs each result into a pathfind3d.TiledNavMesh with ReplaceTile on the update goroutine in MarkDirty order whatever order the workers finish in, and stops at a per-call time Budget. BakeTile also stopped sizing its candidate tables by the level's triangle count, and the new BenchmarkBakeTileIndexed measures the same 32 m tile alone and in a million-triangle level: on the build machine the million case now runs within the noise of the tile alone (0.83 ms against 0.94 ms) instead of the whole-level walk's tens of milliseconds, and both entries are in the benchmark gate.

Fixes #1719

Verification

  • gofmt -l . produces no output
  • go tool nsgo check ./pkg/pathfind3d/navbake3d/..., go tool nsgo check ./internal/gamecli/... and go tool nsgo check ./pkg/editor/... pass on the build machine
  • go tool nsgo test ./pkg/pathfind3d/navbake3d ./internal/gamecli ./pkg/editor passes: 1562 passed, 0 failed, 2 skipped
  • go tool game bench -baseline benchmarks/baseline.yaml ./pkg/sprite ./pkg/tilemap ./pkg/bullets ./pkg/rts ./pkg/pathfind3d/navbake3d ./pkg/physics passes, including the new BenchmarkBakeTileIndexed/alone and /million entries
  • go run ./tools/changelog check passes
  • bun run verify-notes passes
  • Both docs/en/navbake3d.md and docs/zh/navbake3d.md updated
  • go tool nsgo test ./... from the repository root and the cross-target check matrix were not run; verification was scoped to the affected packages per the repository's agent workflow.

Screenshots

None: this PR changes no visible UI. pkg/editor/navmesh3d.go only updates the AddSceneFile call to the new two-value signature.

Acceptance for every editor PR

Not applicable: the editor change is a one-line call-site update in Editor.BakeNavMesh3D with no UI, theme, focus, shortcut or overlay changes.

Geometry's Add methods now return a SourceID, Remove and Replace take a source's triangles and off-mesh links back out and rebuild the spatial index around the remaining geometry, TilesAffected lists the tiles whose padded BakeTile bounds a source overlaps, and NavTileRebaker bakes the marked tiles on workers within a per-call budget and installs them in MarkDirty order.

BakeTile no longer sizes its candidate tables by the level's triangle count, and BenchmarkBakeTileIndexed holds one 32 m tile in a million-triangle level to the same budget as the tile alone.

Fixes #1719
@github-actions github-actions Bot added enhancement New feature or request size/XL documentation Improvements or additions to documentation pkg/editor pkg/internal area/tools area/agents pkg/pathfind3d and removed enhancement New feature or request labels Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI: navbake3d.BakeTile walks every triangle of the level and Geometry cannot remove an object, so a run-time tile rebake costs the whole level

1 participant