Saga
Saga Game Engine
|
This is a game engine created in Spring 2023 by Thuleanx for Brown's 3D Game Engine course. It is written from scratch, with the exception of a stencil graphics library, and heavily uses OpenGL and a custom Entity Component System. Here are the main selling points of the engine:
Applications inherits from App and is managed by Core. They manage a collection of active GameWorld, each containing entities, components, and systems. Applications can create and add the current game world to the list of active game world by running:
After this, entities, components, and systems can be added to the world. For instance, to add a Sphere that circles around the origin, you can do:
Under the hood, Saga stores components next to each other in memory, allowing for better cache locality when iterating through all components of the same type. Of course, one can also iterate through a group of components, which contains all entities with the specified components. The following code iterate through all meshes and draw them on screen.
If these groups are registered beforehand with `registerGroup`, then these group can be iterated through in $O(n)$ where n is the number of elements in the group.