Skip to content

Project Architecture

seedhartha edited this page Dec 12, 2023 · 227 revisions

Modules

Source code is organized into modules, each module containing a different engine subsystem. Dependency must be from higher- to lower-level modules. Circular dependencies must be avoided.

Applications

  • reone is the engine executable
  • launcher is a GUI application to configure and launch the engine
  • toolkit is a GUI application to inspect game resources and invoke tools

Libraries

  • tools contains tools implementations and supporting code
  • game contains the game logic
  • gui contains the GUI subsystem
  • scene contains the scene management subsystem
  • resource contains the resource management subsystem
  • movie contains the movie playback subsystem
  • script contains the scripting subsystem
  • graphics contains the graphics subsystem
  • audio contains the audio subsystem
  • system contains common utility classes and functions

Object Hierarchies

File and Class Names

types.h files contain enums, constants and aliases that do not belong to a particular class.

*util.(h|cpp) files contain utility functions.

File format handling is encapsulated in *Reader and *Writer classes. These classes are grouped into format folders.

Plurals denote classes that provide a certain type of objects, e.g. Resources and Models.

Dependency Injection

Services are abstracted pieces of logic. Each module initializes it's own services in a *Module class. *Module class provides *Services structure with service references that can be injected into higher-level modules.

Memory Model

Prefer allocating memory on initialization or on demand to allocating it every frame.

Prefer stack allocation to dynamic allocation, unless the object is large or variable is late-initialized. Use smart pointers for dynamic allocation.

Threads

Engine is predominantly single-threaded at the moment. Desired state however is the following:

  • Rendering and audio playback should happen on the main thread
  • Game updates should happen on a dedicated thread
  • IO and arbitrary computations should be executed by a thread pool