Skip to content

Terrain: 3D ring-buffer chunk window for volumetric streaming #729

Description

@drsnuggles8

Is your feature request related to a problem? Please describe.

Terrain streaming is 2D. Terrain/TerrainStreamer streams tiles against the quadtree, which is the right model for heightmap terrain and the wrong one for a volumetric/voxel world, where the camera also moves vertically and the loaded set is a 3D neighbourhood. There is no constant-time chunk-coordinate lookup for a 3D window either — a hash map per lookup is the default alternative.

Describe the solution you'd like

A 3D ring buffer holding a fixed cubic window of chunks around the camera:

  • Indexing is modular arithmetic on the chunk coordinate — constant time, no hashing, and cache-friendly.
  • Crossing a chunk boundary loads only the incoming plane and drops the outgoing one, instead of re-evaluating the whole volume.
  • Loaded and rendered radii configurable independently.

Describe alternatives you've considered

A hash map from chunk coord to chunk — what a straightforward implementation does; correct but loses locality and pays a hash per lookup in the hot meshing/culling path.

Additional context

Reference: D:\repos\VoxelEngine\VoxelEngine\3d_ring_buffer.h and view_ring_buffer.h, driven from chunk_manager.h / chunk_grid.h. MIT.

Related: #434 (streaming), #613 (floating-origin — a ring buffer interacts with origin rebasing and should be designed with that in mind).

Acceptance criteria

  • Crossing a chunk boundary in any of the three axes loads only the incoming plane.
  • Chunk lookup is O(1) with no hashing on the hot path.
  • Behaves correctly across an origin rebase.

Score

capability: 3
craft: 1
stability: 3
decay: 1
effort: 3
confidence: 0.8
learning: 5
fun: 5
kano: performance
blocked_by: []
blocks: []

Rated per issue-scoring · score = confidence × (capability + craft + stability + decay) / effort, derived by the picker.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestperformancePerformance / data-oriented optimization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions