Skip to content

[HIGH] Refactor App struct - Extract subsystem managers to reduce God Object complexity #271

@MichaelFisher1997

Description

@MichaelFisher1997

Problem

The App struct in src/game/app.zig (lines 38-81) has grown to 40+ fields and violates the Single Responsibility Principle. It currently manages:

  • RHI/Rendering systems
  • Audio system
  • UI system
  • Settings management
  • Screen management
  • Input handling
  • Multiple render passes

This makes the struct difficult to maintain, test, and understand.

Current State

The App struct contains 40+ fields mixing rendering, audio, UI, settings, and game state concerns.

Proposed Solution

Extract cohesive subsystems into separate manager structs:

  1. RenderSystem - Manages RHI, render graph, render passes, shaders
  2. AudioSystemManager - Wraps audio system initialization/lifecycle
  3. UISystemManager - Manages UI system, timing overlay
  4. SettingsManager - Handles settings persistence and application
  5. ScreenSystem - Manages screen manager and transitions

Benefits

  • Improved testability (can test managers in isolation)
  • Reduced cognitive load (smaller, focused structs)
  • Better adherence to SRP
  • Easier to mock for testing

Acceptance Criteria

  • Create RenderSystem struct to manage rendering concerns
  • Create SettingsManager for settings persistence
  • Reduce App struct field count by at least 50%
  • All existing functionality preserved
  • Tests still pass

Related Files

  • src/game/app.zig
  • src/game/screen.zig (may need updates)

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