Commit Graph

6 Commits

Author SHA1 Message Date
Lorenz Junglas
8720116f34 Fix CalculatePath giving up early on complex paths (#3935)
UpdateSlicedFindPath may return InProgress status when pathfinding requires more iterations. Previously the code would only call it once and continue regardless of status, causing incomplete paths in complex scenarios. Now loops until pathfinding completes or fails.
2026-01-29 13:06:55 +01:00
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
Lorenz Junglas
85a23d1a67 Don't dispose logging targets, config takes ownership (#3754) 2026-01-12 22:24:01 +00:00
Lorenz Junglas
236b95e0ed Disposable diagnostic (#3693)
* Enable CA2000 in editorconfig

* Remove unused CaptureStdOut class

* Add missing dispose calls in Sandbox.Tools

* Add missing dispose calls in tests

* Add missing dispose calls in launchers

* Add missing dispose calls in Topten.RichtTextKit

* Add missing dispose calls in Engine

* Add missing dispose calls in SboxBuild

* Add nullchecks to a few dispose calls

* Fix more missing disposal calls and leaks

* Disable CA2000 for Textures

* Fix disposing too early in ImageFileTextureGenerator

* Fix disposing codec, ownership is transferred to animation

* Add missing using in ByteStream benchmark
2026-01-12 21:59:15 +01:00
Lorenz Junglas
fca621fbfb Improve NavMesh initial load (#3440)
- Fix navmesh potentially generating twice
- Make sure it's generated async on load.
- Only generate it in editor scenes if actually used
2025-12-03 13:58:36 +01:00
s&box team
71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00