This document describes the current runtime structure of Chained Engine, from executable entry points to the main loop.
The engine uses a small main wrapper in entry_point.h and delegates application construction to a per-executable CreateApplication function.
graph TD
A[main entry_point.h] --> B[CreateApplication]
B --> C[ApplicationSpec]
C --> D[Initialize Core Services]
D --> E[LayerStack Update Loop]
E --> F[Shutdown]
// game/src/main.cpp
#include "engine/core/application.h"
#include "engine/core/entry_point.h"
namespace Chained {
Application* CreateApplication(ApplicationCommandLineArgs args) {
ApplicationSpecification spec;
spec.Name = "Chained Game";
spec.WindowWidth = 1600;
spec.WindowHeight = 900;
return new Application(spec);
}
}Startup usually follows this path:
CreateApplicationfillsApplicationSpecificationfrom CLI args and default window settings.Applicationis constructed and initializes core services.- Runtime-specific startup may discover or load a project through
Project::DiscoverandProject::Load. - The executable attaches either
EditorLayerorRuntimeLayer.
Initialization is centralized in Application. That keeps startup predictable, but it also makes Application a coupling point for unrelated systems.
Application currently creates and coordinates the window, ThreadPool, ComponentSerializer, AssetManager, Renderer, TextureSystem, Audio, PhysicsSystem, UIRenderer, and ScriptEngine.
This is not a pure SRP split. The benefit is that bootstrap order is explicit. The cost is that changes to service lifecycle, headless mode, or renderer setup tend to ripple through Application.
The engine uses a LayerStack for gameplay and editor/runtime behavior.
EditorLayerorRuntimeLayerowns the primary experience.ImGuiLayeris pushed as an overlay in non-headless runs.- Layers rely on shared process-wide services through
ServiceLocatorandApplication::Get().
Application::Run() drives the frame loop:
- Update timing and frame delta.
- Poll input and platform events.
- Tick engine services.
- Run fixed-step updates on the layer stack.
- Run per-frame layer updates.
- Render scene layers, then render ImGui, then present the frame.
The current shape works, but it has a few clear friction points:
- Service lifecycle order is encoded in registration order, which is easy to break.
- Runtime and editor logic both reach back into global state instead of depending on explicit interfaces.
- Entry-point setup and runtime project loading both interpret CLI and project configuration, which duplicates startup policy.
Applicationowns too many unrelated concerns, so it is the main place where startup regressions accumulate.
Note
Recent architectural improvements include the move of core gameplay logic (like Scene Transitions) into native C++ systems to reduce managed overhead and improve predictability.