StreamingManager
- Module
- Game
- Header
#include "Streaming/StreamingManager.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using SectorCallback = std::function<void(StreamingSector&)> | Game hooks — fire on the main thread during Tick. |
Public functions
| Returns | Name | Description |
|---|---|---|
StreamingManager& | Get | |
StreamingSettings | SettingsForProject | The project's streaming block (Config/Engine.mdf, keys streaming.load_radius, .keep_alive_radius, .unload_radius, .max_concurrent_loads, .memory_budget_mb), falling back to the defaults above for anything the project does not set. |
void | Initialize | assets may be null for grid-only tests; loads then complete instantly (state machine still runs). |
void | Shutdown | |
bool | IsInitialized | |
StreamingSector* | RegisterSector | Declare a sector and its resident asset set (typically from the cooked world manifest). |
StreamingSector* | FindSector | |
size_t | LoadManifest | Self-contained cooked manifest: sectors plus the asset metadata (id/path/type) each needs — the loader registers everything into the asset manager's registry so a shipping build needs no .mdfmeta scan. |
size_t | LoadManifestFromString | Same manifest, read through the VFS instead of the filesystem — a packaged game keeps its manifest inside Content.meaf, where ParseFromFile cannot see it. |
void | Tick | The per-frame heart. |
void | Tick | |
void | SetOnSectorLoaded | |
void | SetOnSectorUnloaded | |
void | SetLayerActive | Data layers (UE Data Layers analog) Every layer is active by default; deactivating one despawns its fragments in resident sectors (via the changed hook — the entity streamer installs it) and skips them on future loads. |
bool | IsLayerActive | |
void | SetOnLayersChanged | |
uint32_t | CountInState | Stats (debug overlay) |
size_t | SectorCount | |
const StreamingSettings& | GetSettings | |
float | SectorSize | The default grid's cell size (the manifest's sector_size). |
const std::vector<FStreamingGrid>& | GetGrids | Every runtime grid, the default one first. |
uint8_t | AddGrid | |
int32_t | FindGrid | |
SectorCoord | CoordForPosition | |
Vec3 | SectorCenter | |
const std::vector<FStreamingDataLayer>& | GetDataLayers | |
const std::vector<FStreamingRegion>& | GetRegions | |
const FStreamingRegion* | FindRegion | |
void | AddRegion | |
bool | RemoveRegion | |
void | SetSectorAlwaysLoaded | |
void | SetSectorPinned | |
void | RequestUnload | |
bool | SaveManifest | |
void | ForEachSector | |
const StreamingSector* | FindResidentSector | Resident sector by coordinate, or nullptr when unknown/not loaded (F12 — the entity streamer resolves queued fragments against this). |
Function details
Get
static StreamingManager& Get()SettingsForProject
static StreamingSettings SettingsForProject(const std::filesystem::path& configDir)The project's streaming block (Config/Engine.mdf, keys streaming.load_radius, .keep_alive_radius, .unload_radius, .max_concurrent_loads, .memory_budget_mb), falling back to the defaults above for anything the project does not set. Every host built its settings from the struct default and nothing else, so a project had no way to tune its own streaming at all.
Initialize
void Initialize(const StreamingSettings& settings, RuntimeAssetManager* assets)assets may be null for grid-only tests; loads then complete instantly (state machine still runs).
Shutdown
void Shutdown()IsInitialized
bool IsInitialized() constRegisterSector
StreamingSector* RegisterSector(SectorCoord coord, std::vector<UUID> assets)Declare a sector and its resident asset set (typically from the cooked world manifest). Re-registering replaces the asset list.
FindSector
StreamingSector* FindSector(SectorCoord coord)LoadManifest
size_t LoadManifest(const std::string& mdfPath)Self-contained cooked manifest: sectors plus the asset metadata (id/path/type) each needs — the loader registers everything into the asset manager's registry so a shipping build needs no .mdfmeta scan. Returns the number of sectors loaded.
LoadManifestFromString
size_t LoadManifestFromString(const std::string& mdfText, const std::string& sourceName)Same manifest, read through the VFS instead of the filesystem — a packaged game keeps its manifest inside Content.meaf, where ParseFromFile cannot see it. sourceName is for diagnostics only.
Tick
void Tick(const std::vector<FSource>& sources)The per-frame heart. Call from the runtime scene update with every streaming source — the camera plus each StreamingSourceComponent. A sector's distance is its distance to the NEAREST source; with one source this is exactly the old camera-only behaviour. No sources at all leaves every sector where it is: a frame with no viewer is not a reason to unload the world.
Tick
void Tick(const Vec3& cameraPos)SetOnSectorLoaded
void SetOnSectorLoaded(SectorCallback cb)SetOnSectorUnloaded
void SetOnSectorUnloaded(SectorCallback cb)SetLayerActive
void SetLayerActive(const std::string& name, bool active)Data layers (UE Data Layers analog) Every layer is active by default; deactivating one despawns its fragments in resident sectors (via the changed hook — the entity streamer installs it) and skips them on future loads. The empty name is the base layer and cannot be deactivated.
IsLayerActive
bool IsLayerActive(const std::string& name) constSetOnLayersChanged
void SetOnLayersChanged(std::function<void()> cb)CountInState
uint32_t CountInState(SectorState s) constStats (debug overlay)
SectorCount
size_t SectorCount() constGetSettings
const StreamingSettings& GetSettings() constSectorSize
float SectorSize() constThe default grid's cell size (the manifest's sector_size).
GetGrids
const std::vector<FStreamingGrid>& GetGrids() constEvery runtime grid, the default one first. A manifest declares the rest as Grid nodes in index order; a sector names its grid by index.
AddGrid
uint8_t AddGrid(const FStreamingGrid& grid)FindGrid
int32_t FindGrid(const std::string& name) constCoordForPosition
SectorCoord CoordForPosition(const Vec3& worldPos, uint8_t grid = 0) constSectorCenter
Vec3 SectorCenter(SectorCoord coord) constGetDataLayers
const std::vector<FStreamingDataLayer>& GetDataLayers() constGetRegions
const std::vector<FStreamingRegion>& GetRegions() constFindRegion
const FStreamingRegion* FindRegion(const std::string& name) constAddRegion
void AddRegion(const std::string& name, std::vector<SectorCoord> cells)RemoveRegion
bool RemoveRegion(const std::string& name)SetSectorAlwaysLoaded
void SetSectorAlwaysLoaded(SectorCoord coord, bool value)SetSectorPinned
void SetSectorPinned(SectorCoord coord, bool value)RequestUnload
void RequestUnload(SectorCoord coord)SaveManifest
bool SaveManifest(const std::string& path, std::string* outError = nullptr) constForEachSector
void ForEachSector(const std::function<void(const StreamingSector&)>& fn) constFindResidentSector
const StreamingSector* FindResidentSector(const SectorCoord& coord) constResident sector by coordinate, or nullptr when unknown/not loaded (F12 — the entity streamer resolves queued fragments against this).