Overview

Modularity is a lightweight, extensible game engine designed around runtime-compiled C++ scripting, clear engine boundaries, and predictable behavior. It prioritizes developer control, low overhead, and explicit systems over heavy abstraction or hidden magic.

The engine is built to feel familiar to developers who prefer traditional engine architecture, while still offering modern tooling such as hot-compiled scripts, an integrated editor, and structured runtime APIs.


Core Design Philosophy

Modularity follows a few core principles:

  1. Explicit over implicit Systems do what they say. There are no hidden update loops or invisible object lifetimes.

  2. Runtime compilation as a first-class feature C++ scripts are compiled, loaded, and reloaded at runtime without restarting the engine.

  3. Editor and runtime share the same code paths What runs in the editor is what runs in-game.

  4. Low-friction iteration Most tasks (scripting, transforms, logging, debugging) are designed to require minimal boilerplate.


Engine Architecture

At a high level, Modularity is composed of:

  1. Core Engine

    • Rendering, scene management, object hierarchy

    • Transform system (position, rotation, scale)

    • Asset loading (OBJ, Assimp, shaders, textures)

  2. Editor

    • Dockable viewport and inspectors

    • ImGui-based UI

    • Scene hierarchy and project management

    • Integrated console and logging

  3. C++ Scripting System

    • Runtime compilation and hot-reloading

    • Script lifecycle hooks (Begin, TickUpdate, Spec, TestEditor)

    • Persistent per-script settings via AutoSetting

    • Optional time-based execution via IEnum


C++ Scripting

Scripts in Modularity are written in native C++, compiled into shared libraries, and loaded at runtime.

Each script interacts with the engine through a ScriptContext, which provides access to:

  • The current scene object

  • Transform operations

  • Object lookup

  • Logging and debugging

  • Inspector UI integration

Scripts are not sandboxed or virtualized, they run as real C++ code with direct access to engine APIs.


Script Lifecycle

Scripts can implement one or more lifecycle functions:

  • Begin - called once when the script starts

  • TickUpdate - called every frame

  • Spec - special or speculative execution mode

  • TestEditor - editor-time execution

  • Script_OnInspector - ImGui inspector UI

This allows scripts to cleanly separate runtime logic, editor behavior, and UI code.


Persistent Script Settings

Modularity supports automatic script setting persistence via AutoSetting.

Settings are:

  • Loaded automatically

  • Saved only when changed

  • Stored per object / per script instance

This removes the need for manual serialization or boilerplate configuration code.


IEnum (Time-Based Execution)

For logic that runs over time without relying on per-frame updates, Modularity provides IEnum.

IEnum allows scripts to:

  • Start long-running tasks

  • Run logic over multiple frames

  • Avoid cluttering TickUpdate

This is useful for:

  • Animations

  • Delayed actions

  • State-driven behaviors


Logging & Debugging

Scripts can log messages directly to the engine console:

Supported log types:

  • Success

  • Info

  • Warning

  • Error

Logging is designed to be non-fatal by default, allowing scripts to fail gracefully without interrupting execution.

Last updated

Was this helpful?