-
-
Notifications
You must be signed in to change notification settings - Fork 60
Architecture overview
RigelEngine consists of a collection of packages (directories below the src
directory), and a top-level package which implements the actual executable based on the other packages (all the files which are directly inside the src
directory). See src/README.md for an overview of what each package is about.
Ihe architecture can be further divided into a few layers:
- platform layer and rendering backend
- top-level infrastructure, which runs the main loop and manages different game modes
- the in-game engine, based on the Entity-Component-System architecture
- gameplay code.
The project is based on SDL2 for platform abstraction and window creation, and OpenGL for rendering. Audio is implemented using SDL2 Mixer.
A 2D rendering API is implemented on top of OpenGL. See Rendering Backend for more information.
After startup is finished, everything is driven by the main loop. The main loop keeps running until the user quits the game. Each iteration of the loop represents one frame rendered to the screen.
Each frame, the main loop retrieves events like keyboard input from SDL, calls into the current game mode for rendering, and then presents the results on screen by swapping OpenGL's buffers. A game mode can request switching to a new game mode.
At this level, timing is done in a variable timestep fashion, by giving the current game mode a delta time (time elapsed since the last frame). The in-game code implements a fixed timestep scheme on top of that, though.