计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
level-streaming【效率与协作】Expert level streaming — stream strategies, spatial cell management, async loading, dependency closure, hitch prevention and progressive transitions for open worlds.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Open worlds don't fit in RAM or load in one frame. Level streaming keeps gigabytes on disk and only the needed few hundred MB resident, without the player ever seeing a pop-in or a hitch. This skill covers stream strategies, cell management, async load, dependency closure, transition LOD and the anti-hitch toolkit.
world = partitioned into cells/chunks (geometry+textures+meshes+audio+nav)
player's camera + prediction → determine "in-scope" set
stream: load only in-scope, drop out-of-scope
budget: bytes aligned to disk speed; never stall the frame
Scope is defined by player relevance (distance bands + occlusion), not "whole level".
| Strategy | Cells | Load model | Use |
|---|---|---|---|
| Spatial cell (grid) | fixed-size cell | in-view + predict-ahead | open fields, driving |
| Zone/region | authored chunks | entrance-based | dungeons, hubs |
| Enabling trigger | scripted beams | event-driven | linear-ish |
| Persistent + streaming | base + rare | base always | hub + quest areas |
Hybrid is the norm: base persistent + spatial cells around it + scripted chunks for set-pieces.
asset-pipeline/packing): one load = one bounded read + one manifest entry.struct Cell { AABB bounds; vector<AssetId> deps; Residency state; int refs; };
Load not just the current cell but the predictive set:
inScope = cells that (camera speed projection enters within ~2 s)
∪ (radius: camera predicts ahead)
∪ (trigger event claims)
Never "load on the frame you're inside" — that's a minimap-swallowed pop. The streaming budget from asset-pipeline throttles you if you request too much («streaming-throttle»).
platform-abstraction filesystem refs), decompress on workers.fread on the main thread — the streaming profiler flags any > 8 ms main-thread load.A cell "needs" materials, meshes, audio, nav (and those need their deps). The streaming system resolves the full transitive closure:
cell → [mesh_a, mat_a, tex_b] → tex_b → [sampler,cdf]
Failure mode: two cells share a dependency, both load it twice (waste + refcount chaos). Solution: a global asset cache with refcounts; cells request assets, the cache dedupes. The closure must be author-authored+safe (the cook generated it, see asset-pipeline).
| Tool | What it does |
|---|---|
| Deferred activation | entity activates only when fully resident |
| Proxy / low-poly shell | visible stand-in while loading |
| Progressive LOD | coarse-loaded → refine when idle (re-lod) |
| Pop-mask | a fog/cull fade near active boundaries |
| Never-load-more-than-budget | throttling (see streaming-throttle) |
| Watchdog | a cell "resident" false-flag → retry/repair |
asset-pipeline/hot-reload).| Budget | Danger level |
|---|---|
| resident bytes | ~half the level RAM budget |
| load-in-flight bytes | throttled (§ streaming-throttle) |
| per-frame activation cost | < 1 ms |
| unload debt (refcount 0 linger) | collected opportunistically |
Watch: a resident set that grows under slow movement = an unload bug (the player leaves a region, cell stays).
references/stream-strategies.md — strategies table, hybrid, authoring, planreferences/cells-and-residency.md — cell anatomy, residency states, refcounts, radius rulesreferences/async-loading.md — IO threads, deferred activation, shell proxies, profiler gatesreferences/asset-dependencies.md — closure resolution, global cache, dedupe, cook-generated graphsreferences/hitch-prevention.md — the full toolkit, thresholds, tests, watchdogsreferences/progressive-transitions.md — LOD-stepping, fades, shell→resident swap, editor hot-reload