Expand description
Terrain streaming — async chunk loading/unloading, LRU cache, priority queue.
Uses thread pools (std threads + channels) rather than async/await. Manages chunk lifecycle: generation → cache → serialization → eviction.
Structs§
- Chunk
Cache - LRU cache for terrain chunks.
- Chunk
Diff - Records the difference between two chunk heightmaps (for terrain editing).
- Chunk
Event Queue - Simple event queue for chunk events.
- Chunk
Generator - Generates terrain chunks from scratch for a given coord.
- Chunk
Hitlist - A list of chunks that must be loaded before play can begin.
- Chunk
Repair - Repairs corrupted or invalid chunk data.
- Chunk
Serializer - Serializes/deserializes chunks to/from a binary format.
- Chunk
Stitcher - Stitches chunk borders to eliminate seams between adjacent chunks.
- Extended
Chunk Serializer - Extended chunk serializer with format support.
- Generator
Pool - A fixed-size thread pool for chunk generation.
- Heightmap
Quantizer - Quantizes a heightmap for compact storage.
- Load
Queue - Priority queue for chunks to be loaded.
- LodBias
- Adjusts LOD thresholds based on terrain importance (e.g., near a city).
- LodScheduler
- Decides when to upgrade/downgrade chunk LOD.
- Memory
Budget - Tracks and enforces memory budget for the streaming system.
- Prefetcher
- Predicts movement direction and prefetches chunks ahead of the camera.
- Priority
Zone - Defines priority zones that affect chunk loading order. E.g., player start location, POIs, scripted events.
- Priority
Zone Manager - Manages multiple priority zones and computes combined priority bonuses.
- Streaming
Manager - Top-level coordinator for terrain chunk streaming.
- Streaming
Profiler - Profiling data for the streaming system.
- Streaming
Stats - Statistics for the streaming system.
- Streaming
Telemetry - Detailed telemetry for streaming system performance analysis.
- Terrain
Patch - A small editable terrain patch (sub-chunk resolution editing).
- Visibility
Set - Tracks which chunk coords are currently in the view frustum.
- World
Map - Low-resolution overview map of the entire world, used for minimap and LOD hints.
Enums§
- Chunk
Event - Events emitted by the streaming system.
- Serialization
Format - Serialization format options.
- Stitch
Edge - Which edge of a chunk to stitch.