Builtin Library
README.md
StreamingSource
The entity world content streams around.
Put it on whatever should keep the world resident near it — the player, a chase
camera, a vehicle. Content the spatialStreaming store holds becomes resident
inside loadRadius of the nearest source and is released past unloadRadius.
Past that, out to proxyRadius, a released cell is drawn as whatever stand-in
it was given — so the far field is a silhouette rather than a hole.
entity.find("Player").component.add("StreamingSource", {
cellSize = 64, loadRadius = 120, unloadRadius = 180, budget = 32,
})
| Field | Meaning |
|---|---|
cellSize | Edge length of a streaming cell in world units. Cells are square columns on the ground plane, so a tower and its foundation stream together. |
loadRadius | Distance within which a cell is made resident, measured to the cell's nearest edge. |
unloadRadius | Distance past which a resident cell is released. Must exceed loadRadius; the band between them is what keeps a source standing on a boundary from thrashing. |
proxyRadius | Distance within which this source sees a released cell's proxy. 0 follows unloadRadius, so the far field starts where the content stops however wide this source streams; a number of its own must exceed unloadRadius, since inside that the content itself is standing. |
proxyUnloadRadius | Distance past which the proxy is dropped too. 0 follows proxyRadius; a number of its own must exceed it, for the same reason unloadRadius must exceed loadRadius. |
budget | Entity records one frame may spend loading and releasing. A group is atomic, so a group larger than this still moves in one piece. |
Several sources are fine — each contributes its position and cells stream around the closest one. They share a single step per frame, so the budget is spent once however many sources there are.
The component contributes a position and the per-frame step. The content itself
reaches the store through
@builtin::systems.spatialStreaming.spatialStreaming: capture hands it live
entities, add registers records for content that was never spawned.
Streaming runs in edit mode as well as in play, so an author sees the same residency a player will.
A TerrainStream (terrainSystem.package) streams its ground tiles around the
same sources and stands collision under each one, so a player or a vehicle
carrying this component has ground under it wherever it goes.