Startup Sequence

From the OS loading the binary to the first gameplay frame.

Overview

Galaxy Eggbert uses Urho3D's application lifecycle. The entry point macro URHO3D_DEFINE_APPLICATION_MAIN(GalaxyEggbertApp) in Program.cpp expands to a main() that creates a Context, instantiates GalaxyEggbertApp, and calls app->Run().

Sequence Diagram

OS: exec GalaxyEggbert
  └─ main() [generated by URHO3D_DEFINE_APPLICATION_MAIN]
       ├─ Context* ctx = new Context()
       ├─ GalaxyEggbertApp app(ctx)
       └─ app.Run()
            ├─ GalaxyEggbertApp::Setup()
            │    ├─ engineParameters_["WindowTitle"] = "Galaxy Eggbert"
            │    ├─ engineParameters_["WindowWidth"]  = 1280
            │    ├─ engineParameters_["WindowHeight"] = 720
            │    └─ engineParameters_["ResourcePaths"] = "Data;CoreData;Content"
            ├─ Engine::Initialize()   [Urho3D — creates window, GL context, subsystems]
            └─ GalaxyEggbertApp::Start()
                 ├─ game_ = make_unique<GalaxyEggbertGame>(ctx)
                 ├─ GalaxyEggbertGame::Start()
                 │    ├─ gameData_.load(savePath)
                 │    ├─ CreateScene()
                 │    │    ├─ scene_ = new Scene(ctx)
                 │    │    ├─ scene_->CreateComponent<Octree>()
                 │    │    ├─ Zone (ambient light, fog)
                 │    │    └─ DirectionalLight
                 │    ├─ LoadWorld(currentWorld_)
                 │    │    ├─ try .vwr format → World::loadFromFile()
                 │    │    ├─ or .txt format  → LoadMobileEggbertTerrain()
                 │    │    └─ fallback         → BuildDemoWorld()
                 │    │         └─ SpawnTerrainNodes()
                 │    ├─ blupi_   = make_unique<Blupi>(...)
                 │    ├─ decor_   = make_unique<Decor>(...)
                 │    ├─ camera_  = make_unique<CameraController>(...)
                 │    ├─ hud_     = make_unique<HUD>(...)
                 │    ├─ phases_  = make_unique<PhaseManager>(...)
                 │    ├─ sound_   = make_unique<SoundManager>(...)
                 │    └─ EnterPhase(GamePhase::Init)
                 └─ SubscribeToEvent(E_UPDATE, HandleUpdate)

  ... engine runs event loop ...

  First E_UPDATE fires:
    HandleUpdate → GameUpdate(dt) → game_->Update(dt)
      └─ Dispatch on phase_ == Init → UpdateInit(dt)
           └─ Show gamer-select screen

Key Observations