Subsystems

Any Object can be registered to the Context as a subsystem, by using the function RegisterSubsystem(). They can then be accessed by any other Object inside the same context by calling GetSubsystem(). Only one instance of each object type can exist as a subsystem.

After Engine initialization, the following subsystems will always exist:

  • Time: manages frame updates, frame number and elapsed time counting, and controls the frequency of the operating system low-resolution timer.
  • WorkQueue: executes background tasks in worker threads.
  • FileSystem: provides directory operations.
  • Log: provides logging services.
  • ResourceCache: loads resources and keeps them cached for later access.
  • Network: provides UDP networking and scene replication.
  • Input: handles keyboard and mouse input. Will be inactive in headless mode.
  • UI: the graphical user interface. Will be inactive in headless mode.
  • Audio: provides sound output. Will be inactive if sound disabled.
  • Engine: creates the other subsystems and controls the main loop iteration and framerate limiting.

The following subsystems are optional, so GetSubsystem() may return null if they have not been created:

  • Profiler: Provides hierarchical function execution time measurement using the operating system performance counter. Exists if profiling has been compiled in (configurable from the root CMakeLists.txt)
  • EventProfiler: Same as Profiler but for events.
  • Graphics: Manages the application window, the rendering context and resources. Exists if not in headless mode.
  • Renderer: Renders scenes in 3D and manages rendering quality settings. Exists if not in headless mode.
  • Script: Provides the AngelScript execution environment. Needs to be created and registered manually.
  • Console: provides an interactive AngelScript console and log display. Created by calling CreateConsole().
  • DebugHud: displays rendering mode information and statistics and profiling data. Created by calling CreateDebugHud().
  • Database: Manages database connections. The build option for the database support needs to be enabled when building the library.

In script, the subsystems are available through the following global properties: time, fileSystem, log, cache, network, input, ui, audio, engine, graphics, renderer, script, console, debugHud, database. Note that WorkQueue and Profiler are not available to script due to their low-level nature.