Skip to content

[HIGH] Decompose World struct - Separate streaming, rendering, and LOD concerns #273

@MichaelFisher1997

Description

@MichaelFisher1997

Problem

The World struct in src/world/world.zig (lines 47-63) combines multiple high-level concerns:

  • Chunk storage management
  • World streaming (loading/unloading)
  • Rendering
  • LOD (Level of Detail) system
  • World generation

This violates SRP and creates tight coupling between these concerns.

Current State

World struct mixes storage, streaming, rendering, LOD, and generation responsibilities.

Proposed Solution

Extract three main subsystems:

  1. WorldStreamer - Already exists, but make it the primary interface for streaming
  2. WorldRenderer - Already exists, extract from World
  3. WorldLOD - New struct to encapsulate LOD manager and renderer

Refactor World to be a facade/coordinator that delegates to these subsystems.

Benefits

  • Each subsystem can be tested independently
  • Clearer boundaries between streaming, rendering, and LOD
  • Easier to modify one concern without affecting others
  • Better separation of data (storage) from behavior (streaming/rendering)

Acceptance Criteria

  • World struct reduced to coordinator role
  • WorldStreamer becomes primary streaming interface
  • WorldRenderer fully independent
  • WorldLOD encapsulates LOD concerns
  • All existing functionality preserved
  • Tests still pass

Related Files

  • src/world/world.zig
  • src/world/world_streamer.zig
  • src/world/world_renderer.zig
  • src/world/lod_manager.zig
  • src/world/lod_renderer.zig

SOLID Principle

Single Responsibility Principle (SRP)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions