Architecture

How the project is structured, how components interact, and how data flows.

High-Level Layering

┌─────────────────────────────────────────────────────┐
│                  Urho3D Engine API                   │
│  (Scene graph, ResourceCache, Input, Audio, UI, …)   │
└────────────────────────┬────────────────────────────┘
                         │ extends
           ┌─────────────▼──────────────┐
           │      GalaxyEggbertApp       │  ← entry point / lifecycle
           │  (Urho3D::Application)      │
           └─────────────┬──────────────┘
                         │ owns
           ┌─────────────▼──────────────┐
           │     GalaxyEggbertGame       │  ← main game coordinator
           │  (scene, world, subsystems) │
           └──────┬────────────┬────────┘
         owns     │            │ uses
    ┌─────────────┘            └──────────────────────┐
    │                                                  │
    ▼   Game subsystems                                ▼  Data layer
  Blupi          ← player physics, animation    World/Chunk/Block
  Decor          ← object pool, enemies         (engine-agnostic)
  CameraController ← 3rd-person orbit
  HUD            ← 2D overlay
  PhaseManager   ← game-phase state machine
  SoundManager   ← 93-channel WAV audio
  GameData       ← 640-byte save file

Main Components

Entry Point — Program.cpp

A single line using the Urho3D macro:

URHO3D_DEFINE_APPLICATION_MAIN(GalaxyEggbertApp)

This macro expands to the platform-appropriate main() / SDL_main() entry point and constructs a GalaxyEggbertApp instance.

Application — GalaxyEggbertApp

Subclass of Urho3D::Application. Responsible for:

Source: src/GalaxyEggbert/GalaxyEggbertApp.hpp, .cpp

Game Coordinator — GalaxyEggbertGame

Owns the Urho3D scene and all game subsystems. Responsibilities:

Source: src/GalaxyEggbert/Game/GalaxyEggbertGame.hpp, .cpp

World Data Model — World / Chunk / Block

Engine-agnostic C++ data model. No Urho3D dependency. Tested by 54 unit tests in tests/GalaxyEggbert/Worlds/.

Public headers: include/GalaxyEggbert/Worlds/

Initialization Flow

Program.cpp
  └─ URHO3D_DEFINE_APPLICATION_MAIN(GalaxyEggbertApp)
       └─ GalaxyEggbertApp::Setup()
            ├─ Set window size: 1280×720
            ├─ Set resource paths: Data;CoreData;Content
            └─ Set log: GalaxyEggbert.log
       └─ GalaxyEggbertApp::Start()
            ├─ Create GalaxyEggbertGame
            └─ game_->Start()
                 ├─ Determine save path
                 ├─ Read GameData (or defaults)
                 ├─ CreateScene() — Scene + Octree + Zone + Lights
                 ├─ LoadWorld(currentWorld_)
                 ├─ Create PhaseManager, HUD, CameraController, SoundManager
                 └─ EnterPhase(GamePhase::Init)

Update Flow (per frame)

E_UPDATE event from Urho3D engine
  └─ GalaxyEggbertApp::HandleUpdate(dt)
       └─ GalaxyEggbertGame::Update(dt)
            ├─ Check global keys (ESC → quit, F1 → toggle debug)
            └─ Switch on current GamePhase:
                 Play:      UpdatePlay(dt)
                 │           ├─ blupi_->Update(dt)    ← physics + animation
                 │           ├─ camera_->Update(dt)   ← camera orbit
                 │           ├─ decor_->Update(dt)    ← enemy + collectible update
                 │           ├─ Collision/pickup event checks
                 │           └─ hud_->ShowPlay(...)
                 Init:      UpdateInit(dt)   ← gamer select
                 Pause:     UpdatePause(dt)
                 Win:       UpdateWin(dt)
                 Lost:      UpdateLost(dt)
                 Settings:  UpdateSettings(dt)

Shutdown Flow

GalaxyEggbertApp::Stop()
  └─ game_.reset()
       └─ GalaxyEggbertGame::Stop()
            ├─ Save GameData to disk
            ├─ sound_->StopAll()
            ├─ Reset all subsystems (decor, blupi, phases, hud, camera, sound)
            ├─ terrainRoot_.Reset()
            ├─ scene_.Reset()
            └─ world_.reset()

Dependency Map

ComponentDepends on
GalaxyEggbertAppUrho3D::Application, GalaxyEggbertGame
GalaxyEggbertGameUrho3D (all subsystems), World, Blupi, Decor, Camera, HUD, PhaseManager, SoundManager, GameData
BlupiUrho3D (Scene, Input, BillboardSet), World (read-only), Tables
DecorUrho3D (Scene), ObjectNode
ObjectNodeUrho3D (BillboardSet, Texture2D)
CameraControllerUrho3D (Scene, Camera node)
HUDUrho3D (UI subsystem)
PhaseManagerUrho3D (UI subsystem, ResourceCache)
SoundManagerUrho3D (Audio, Sound, SoundSource)
GameDataC++ stdlib only (no engine dependency)
World / Chunk / BlockC++ stdlib only (no engine dependency)
TablesBlupiAction enum only
BlockTypesC++ stdlib only
Engine Abstraction Galaxy Eggbert uses the Urho3D API exclusively (no #ifdef guards for engine differences). The Nova3D engine is expected to provide the same API and namespace; switching engines requires only a CMake flag change.