DungeonLoadingOptimizer
ALPHA. Cuts Lethal Company interior loading time and removes the navmesh lag spike when landing. Multiplayer determinism is not yet verified - do not use on a serious save.
模組介紹 作者原文
DungeonLoadingOptimizer
Makes landing on a moon faster and removes the freeze that cuts your voice while the interior loads.
⚠️ ALPHA — read this before installing
This build is published for compatibility testing on large modpacks. It has been measured and it
works, but multiplayer determinism has not been verified yet: the two-client test that confirms every
player generates the same interior and the same navmesh has not been run.
Do not use it on a save you care about, and do not assume it is safe for a full lobby yet.
Tested on Lethal Company v81 only, as host, on Experimentation, Assurance and Titan.
What it actually fixes
Since v80 the game already generates interiors asynchronously, so this is not another Loadstone. Two real
defects remain, both found by decompiling v81.
- The frame budget is broken. RoundManager.GenerateNewLevelClientRpc sets DunGen's per-frame work
budget to 1 ms, and DunGen measures wall-clock time — its stopwatch keeps running through the frame's
rendering. By the time the generator resumes, ~16 ms have passed, the 1 ms budget is long gone, and it
yields on the very first check. Generation therefore runs exactly one work unit per frame, which is why
landing takes several seconds of mostly doing nothing.
- Every navmesh bake blocks the main thread. Nothing in the stock game uses the incremental navmesh
API. Dissonance captures your microphone on the main thread, so this is precisely what cuts your outgoing
voice while everyone else's keeps playing.
Measured results
Same moon, host, compared against a control run with the mod disabled:
| Titan | Stock | With the mod |
|---|---|---|
| Work units per frame | 1.00 | 9.53 |
| Level finalisation | 2.06 s | 0.37 s |
| Outdoor navmesh bake, blocking the main thread | 1806 ms | 0 ms |
| Worst frame of the whole landing | 1815 ms | 106 ms |
Numbers come from the mod's own load report, which you can read in the BepInEx log. Interiors that are
bigger or more heavily modded than Titan should benefit more, not less.
Configuration
Everything is toggleable, and General.Enabled = false turns every module off while leaving the
measurements running — that is the control case if you want to compare on your own machine. LethalConfig is
supported if installed.
The setting worth knowing is FrameBudget.Preset, which trades framerate against load time:
- FpsPriority (2 ms) — generation stays unobtrusive, framerate barely moves, loading gains less
- Balanced (6 ms) — the default
- Speed (12 ms) — shortest load, heavier frames while loading
If anything misbehaves, NavMesh.Mode = Vanilla reverts to stock navmesh behaviour while keeping the
loading-speed fix.
Compatibility
Built to sit alongside the usual suspects rather than fight them. It patches four methods
(DungeonGenerator.ShouldSkipFrame, RoundManager.FinishGeneratingLevel, NavMeshSurface.BuildNavMesh,
DungeonFlow.HasMatchingTagPair) and logs any foreign patch it finds on them, so conflicts show up in your
log instead of as mystery behaviour.
- PathfindingLib — recommended. Its NavMeshLock keeps background pathfinding jobs from reading a
navmesh mid-rewrite. Without it, the async navmesh path automatically falls back to a safer mode.
- LethalLevelLoader, PathfindingLagFix, LethalPerformance — no overlapping patches. Verified by
scanning their assemblies.
- LethalFixes already handles Dissonance log-spam lag spikes; this mod deliberately does not duplicate
that.
Deliberately not done: forcing async generation (the game does it already since v80), patching
Generator_OnGenerationStatusChanged (fixed in v81), and touching navmesh voxel/tile size — that last one
would change navmesh geometry, which feeds synced scrap placement, which means desync.
Source and issues
github.com/mariusvn/LC-DungeonLoadingOptimizer
Reporting a problem
Please include the BepInEx log. Every load prints a report block starting with === LOAD REPORT, and it
contains everything needed to diagnose: per-phase timings, frame statist
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: