Skip to content

Engine Overview

The Engine module is the initialization and lifecycle coordinator for Astra. It initializes ECS managers (EntityManager, ComponentManager, SceneManager) and registers game systems based on the active project configuration.

Architecture

The Engine is a singleton that orchestrates startup and system registration:

Lifecycle

The Engine follows a simple lifecycle:

  1. init() - Creates the singleton instance; constructor initializes EntityManager, ComponentManager, SceneManager
  2. start() - Reads the active project config and registers systems via SystemManager:
    • Always registers SceneSystem
    • Conditionally registers RenderSystem (if configured in project)
    • Conditionally registers PhysicsSystem (if configured in project)
  3. update() - Main loop placeholder (currently a no-op)
  4. end() - Destroys the singleton instance

API Reference

cpp
namespace astralix {

class Engine {
public:
  static void init();     // Creates singleton instance
  void end();             // Destroys singleton instance
  static Engine *get();   // Returns singleton pointer

  void start();           // Initializes systems from project config
  void update();          // Main update loop (currently empty)
};

}

System Registration

The start() method reads the active project's systems configuration and registers them with the SystemManager. System registration is data-driven based on the project descriptor:

  • SceneSystem - Always registered
  • RenderSystem - Registered if present in project config
  • PhysicsSystem - Registered if present in project config

Integration Points

The Engine module has the following dependencies:

  • ECS - Initializes EntityManager, ComponentManager, SceneManager in constructor
  • Project - Reads active project config via active_project() to determine which systems to register
  • Systems - Registers SceneSystem, RenderSystem, PhysicsSystem via SystemManager based on config

Notes

  • The update() method currently has no implementation (placeholder for future main loop logic)
  • The Engine does not directly implement ECS logic; it initializes ECS managers provided by the ECS module
  • System registration is entirely driven by the active project's configuration