Files
sbox-public/engine/Sandbox.Engine/Game/Navigation/Generation
Lorenz Junglas f69cd482fc Navmesh memory optimizations (#3916)
Cuts navmesh memory usage by at least 5 times  (about 3GB less in our benchmark scene), enabling much larger scenes to generate successfully.
Small Fish’s MSC scene (~3km x 3km) now generates fine, previously ran out of memory and crashed.
The new theoretical maximum for a navmeshed scene is now ~50km x 50km.

- Packed `CompactCell` data into a single 32-bit field (8 bytes -> 4 bytes).
- Added heightfield serialization + compression so `CompactHeightfield` can be stored/transferred as bytes, and tiles store compressed heightfield data instead of large voxel arrays.
  - **Heightfield serialization + compression is a prerequisite for navmesh baking.**
  - Tiles are decompressed when generating polymeshes (e.g., to adapt to area changes).
  - Compression adds a small overhead during navmesh generation.
- Fixed load sequence, now properly shows "Generating Navmesh..." in scene loading screen
- Reduced allocations during `PolyMesh` generation.
- Reduced the permanent memory usage of `PolyMesh`.
- Improved parallel tile generation; now properly limits the number of in-flight tasks to prevent OOM crashes.

Overall generation will be slower due to the extra compression step, I expect roughly ~30% in our benchmarks.
Basically, we're trading generation speed for drastically lower memory usage.

Some of the slowdown we will see in the benchmark is also due to the increased tile size. The larger tiles don’t actually make generation slower in real use, but they show up as "slower" because of how our benchmarks are designed/measured.
2026-01-28 19:23:08 +01:00
..
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00
2025-11-24 09:05:18 +00:00