Worldshaper/docs/kb/systems/chunk-storage-streaming.md

48 lines
1.8 KiB
Markdown
Raw Normal View History

# Chunk Storage And Streaming
2026-06-27 01:12:35 -04:00
## What It Owns
2026-06-27 01:12:35 -04:00
This system owns the world-mode chunk model: loading chunk neighborhoods, composing chunk data into the current editor session, and persisting chunk updates back to disk.
2026-06-27 01:12:35 -04:00
## Core Behaviors
2026-06-27 01:12:35 -04:00
- Load a neighborhood of chunks around a world position.
- Compose room layers from chunk-local rows into a temporary larger editing surface.
- Compose sparse height layers from chunk data.
- Compose placed instances and overlays from chunk payloads.
- Batch-save chunk changes back to the API.
## Important Data
2026-06-27 01:12:35 -04:00
Chunk payloads can contribute:
2026-06-27 01:12:35 -04:00
- `roomLayers`
- `heightLayers`
- `instances`
- `backgroundTileId`
- chunk coordinates and dimensions
2026-06-27 01:12:35 -04:00
## Important Files
2026-06-27 01:12:35 -04:00
- `server.js`
- `src/worldChunking.ts`
- `src/worldshaperStudio/bootstrap.ts`
- `src/worldshaperStudio/runtime.ts`
2026-06-27 01:12:35 -04:00
## Known Behavior Notes
2026-06-27 01:12:35 -04:00
- The bootstrap path currently loads a neighborhood around an initial bookmark or world center instead of streaming every chunk in the world.
- Exact chunk access is grid-based, so many performance requests should start with profiling the current neighborhood/cache path before proposing spatial trees.
- World mode is not editing one isolated chunk in a vacuum; it edits a composed surface backed by many chunk records.
2026-06-27 01:12:35 -04:00
## Relationships
2026-06-27 01:12:35 -04:00
- Feeds `Layers And Tile Editing`, which paints onto the composed chunk neighborhood.
- Feeds `World Overview`, which visualizes and transforms chunk-level records.
- Depends on `Persistence And Save Pipeline` to write chunk mutations.
- Feeds `Rendering And Viewport`, which only draws what the currently loaded chunk neighborhood exposes.
2026-06-27 01:12:35 -04:00
## Triage Hints
2026-06-27 01:12:35 -04:00
Requests about chunk loading, chunk transforms, chunk duplication, world streaming, chunk persistence, spatial indexing, and neighborhood performance should start here.