A 2D/3D game engine built with OpenGL and C++.
Rendering
- OpenGL-based 3D rendering with mesh support
- 2D batch rendering for sprites and quads
- Shadow mapping for directional and point lights
- Material system with custom shaders
- Skybox rendering
- Frame buffer support for render targets
Scene System
- Entity-component architecture
- Transform hierarchy with parent-child relationships
- Scene serialization to YAML files
- Component system supports meshes, sprites, lights, physics, scripts, and more
Physics
- Box2D integration for 2D physics
- Rigid body components with static, dynamic, and kinematic types
Scripting
- Lua scripting support
- Script components that can be attached to entities
- Update callbacks for game logic
Animation
- Animation system with animator component
- Support for multiple named animations per entity
Editor
- Visual editor built with ImGui
- Scene tree view for managing entities
- Inspector for editing component properties
- Viewport with editor and game modes
- Undo/redo system
- Profiling integration with Tracy
Resources
- Resource manager for shaders, textures, and meshes
- Mesh loading via Assimp
- Texture loading with gamma correction support
- Cubemap support for skyboxes
Input
- Keyboard and mouse input handling
- Event system for window, key, and mouse events
Player
- Player component for character control
- Camera follow component for smooth camera tracking
Lighting
- Directional lights with shadow maps
- Point lights with omnidirectional shadows
The engine uses an application layer system for modular functionality. The Application class manages the main window, event loop, and ImGui setup. Functionality is added through ApplicationLayer subclasses that can be registered with the application.
Layers receive callbacks for:
onFrame(dt)- called every frame in order for game logic and updatesonImGui()- called for ImGui rendering in order- Input events (keyboard, mouse, window) - passed to layers in reverse order (top layer first). A layer can return
trueto stop event propagation to lower layers.
This architecture allows different modes like editor, runtime, and profiling to coexist as separate layers. Examples include EditorAppLayer for the visual editor, TracyAppLayer for profiling, and DemoAppLayer for game demos.
Requires CMake 3.20 or higher and a C++20 compatible compiler. The project includes most dependencies as git submodules in the 3rdparty directory. Main dependencies include GLFW for window management, GLM for math, ImGui for the editor UI, Assimp for mesh loading, Box2D for physics, Lua for scripting, and Tracy for profiling.
The build system generates three targets: SpiritEngine (core engine library), SpiritEditor (visual editor), and SpiritDemo (demo application).
This project uses the following open-source libraries:
- GLFW - Window and input management
- GLM - Mathematics library
- ImGui - Immediate mode GUI
- ImGuizmo - 3D gizmos for ImGui
- GLAD - OpenGL loader
- stb_image - Image loading
- Assimp - 3D model loading
- Box2D - 2D physics engine
- Lua - Scripting language
- LuaBridge - Lua bindings for C++
- yaml-cpp - YAML parser
- tmxlite - Tiled map loader
- Native File Dialog Extended - Native file dialogs
- Tracy - Performance profiler
- Catch2 - Unit testing framework
- loguru - Logging library
