Engine Concepts

Engine Concepts

The core abstractions in Nova-3D: Context, Engine, Application, and how they work together.

Context

Nova3D::Context is the top-level object. It owns all engine subsystems — Engine, Renderer, Input, Log, and any subsystem you register. Create exactly one context per application.

Nova3D::Context context;  // owns all subsystems

Access subsystems via the context:

auto* engine   = context.GetEngine();
auto* renderer = context.GetRenderer();
auto* input    = context.GetInput();
auto* log      = context.GetLog();

Engine

Nova3D::Engine manages the application lifecycle: initialization, the update loop, fixed-update, rendering, and shutdown. You do not use Engine directly in most cases — Application::Run() handles it for you.

To exit the engine cleanly from within Application::Start() or Update():

GetContext()->GetEngine()->Exit();

Application

Nova3D::Application is the base class for your game or application. Subclass it and override the lifecycle methods:

class MyApp : public Nova3D::Application {
public:
    explicit MyApp(Nova3D::Context* context)
        : Nova3D::Application(context) {}

    void Start() override {
        // Called once after engine initialization.
        // Create scenes, load resources, set up UI here.
    }

    void Update(float deltaTime) override {
        // Called every frame. deltaTime is seconds since last frame.
        // Update game logic, handle input, animate objects.
    }

    void Stop() override {
        // Called before shutdown. Clean up resources.
    }
};

Main Loop

Calling app.Run() executes the full lifecycle:

  1. Creates and initializes all subsystems on the Context
  2. Calls Application::Start()
  3. Runs the main loop: processes events, calls Update(deltaTime), renders the scene
  4. When Engine::Exit() is called or the window is closed, calls Application::Stop()
  5. Shuts down all subsystems
  6. Returns an exit code
int main() {
    Nova3D::Context context;
    MyApp app(&context);
    return app.Run();  // blocks until exit
}

Object Base Class

Nova3D::Object is the root base class for all Nova-3D objects (Engine, Renderer, Scene, Node, Component, etc.). It holds a pointer back to the Context, which lets any object access any subsystem:

class MyComponent : public Nova3D::Component {
    void Update(float dt) override {
        auto* input = GetContext()->GetInput();
        if (input->IsKeyDown(Nova3D::Key::W)) {
            // move forward
        }
    }
};

Subsystems

AccessorTypeDescription
GetEngine()Nova3D::Engine*Lifecycle management, exit
GetRenderer()Nova3D::Renderer*Rendering subsystem
GetInput()Nova3D::Input*Keyboard and mouse input
GetLog()Nova3D::Log*Logging subsystem

Next: Scene System

With the engine lifecycle understood, the next step is learning how to build scenes using the scene graph.

Scene System →