Phase 3: WorldStreamer SRP Extraction
Goal
Split src/world/world_streamer.zig into smaller responsibilities so chunk lifecycle, LOD, and GPU acceleration can evolve independently.
Why this matters
WorldStreamer currently manages queues, predictive loading, uploads, LOD coordination, save integration, and GPU block-buffer orchestration. It is the largest SRP risk in the world pipeline.
Parallel Tasks
Issue 3.1: Extract the chunk queue and upload coordinator
- Type: refactor / solid
- Scope:
src/world/world_streamer.zig
- Problem: generation, meshing, upload queues, and job handlers are all owned by one module.
- Work:
- Create a focused coordinator for generation/meshing/upload progression
- Move
processGenJob, processMeshJob, and processUploads into that coordinator
- Keep the same chunk state machine and worker pool behavior
- Acceptance criteria:
- Queue management is separated from LOD and GPU concerns
- Chunk generation still reaches
renderable through the same states
- Parallel-safe: yes
Issue 3.2: Extract the LOD and predictive-loading coordinator
- Type: refactor / solid
- Scope:
src/world/world_streamer.zig, src/world/lod_manager.zig
- Problem: predictive loading and render-distance logic are mixed into queue orchestration.
- Work:
- Move
PlayerMovement and related priority weighting into a dedicated coordinator
- Isolate all
lod_manager interactions behind a small API
- Keep render-distance clamping behavior unchanged
- Acceptance criteria:
- LOD decisions are no longer embedded in the chunk queue code
- Changing render distance still triggers the expected rescan behavior
- Parallel-safe: yes
Issue 3.3: Extract the GPU acceleration coordinator
- Type: refactor / solid
- Scope:
src/world/world_streamer.zig, src/world/gpu_block_buffer.zig, src/world/gpu_mesher.zig
- Problem: GPU upload and compute-meshing concerns are intermixed with chunk lifecycle logic.
- Work:
- Move
gpu_block_buffer and gpu_mesher ownership into a dedicated helper/coordinator
- Keep upload fallback behavior for CPU meshing intact
- Preserve safe-mode and GPU fallback logic
- Acceptance criteria:
- GPU acceleration code is separated from the core queue coordinator
- CPU fallback still functions when GPU meshing is disabled or unavailable
- Parallel-safe: yes
Dependencies
- Phase 2 should be stable before major world-system reshaping, but the tasks do not directly depend on it
Verification
nix develop --command zig build test
nix develop --command zig build test-integration
Phase 3: WorldStreamer SRP Extraction
Goal
Split
src/world/world_streamer.ziginto smaller responsibilities so chunk lifecycle, LOD, and GPU acceleration can evolve independently.Why this matters
WorldStreamercurrently manages queues, predictive loading, uploads, LOD coordination, save integration, and GPU block-buffer orchestration. It is the largest SRP risk in the world pipeline.Parallel Tasks
Issue 3.1: Extract the chunk queue and upload coordinator
src/world/world_streamer.zigprocessGenJob,processMeshJob, andprocessUploadsinto that coordinatorrenderablethrough the same statesIssue 3.2: Extract the LOD and predictive-loading coordinator
src/world/world_streamer.zig,src/world/lod_manager.zigPlayerMovementand related priority weighting into a dedicated coordinatorlod_managerinteractions behind a small APIIssue 3.3: Extract the GPU acceleration coordinator
src/world/world_streamer.zig,src/world/gpu_block_buffer.zig,src/world/gpu_mesher.ziggpu_block_bufferandgpu_mesherownership into a dedicated helper/coordinatorDependencies
Verification
nix develop --command zig build testnix develop --command zig build test-integration