Skip to content

engine structure

Tim Leonard edited this page Sep 15, 2023 · 1 revision

Engine layout

Classes

The main core of the engine is inside the workshop.engine project, it ties together all the different areas of the codebase into a coherent engine that can do roughly what you expect an engine to do.

There are a handful of useful classes to be aware of:

  • engine : This class is the big one, it sets everything up, tears everything down and runs the main "tick" (commonly called a "step" in the code).
  • world : This class contains everything that represents everything in the world - all the objects, etc. Multiple worlds can exist at the same time, this allows us to do things like serializing worlds when the game continues running, or rendering worlds for multiple purposes - say one for generating thumbnails of a model in the editor, and one for the actual game world. Worlds are owned by the engine and are created/destroyed with the relevant functions - create_world/destroy_world/etc. The "main" world which gets rendered to the backbuffer is called the "default" world, and can be set using set_default_world.
  • presenter : The presenter takes the state of the world and passes it to the rendered to (unsuprisingly) render. Right now this class is fairly empty, but the idea is to potentially have this class do interpolation of game states when the update rate is lower than the render rate.
  • object_manager : This class manages a set of ecs objects/components, each world owns an instance of this. See the ECS wiki page for details on this one as it mores complex.