Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Engine²

EngineSquared banner

Engine² (or Engine Squared)

CI [License](LICENSE) Release Issues Stars

Engine² is a game engine that aims to provide a developer-friendly and open-source alternative for 3D game development. It is designed to provide truly open-source project and be accessible to everyone.


Examples

ES-RS Menu ES-RS In-Game
Lights Material

Prerequisites

Make sure the following tools are installed before proceeding:
Tool Minimum version Install
xmake v3.0.x See xmake installation guide
Warning
No other tools should be needed. If you get stuck at some step, please report it by opening a bug issue 🙏 (before doing that, check the documentation about how to create an issue)

Clone the repository

git clone https://github.com/EngineSquared/EngineSquared.git
cd EngineSquared

Configure and build

# Configure (downloads dependencies automatically)
xmake f -y
# Build the engine
xmake build -y
Note
Windows only xmake will automatically pull the MSVC toolchain, so you don't need to have it already installed on your machine.

Run a minimal example

Build and run the basic_core_usage example to confirm everything works:
xmake f --basic_core_usage=y -y
xmake run BasicCoreUsage
If the basic core usage run without errors, you're all set. ✅

Project Overview

Here is a graphical overview of the project:
graph TD
ROOT["EngineSquared"]
ROOT --> SRC["src/"<br/><small>All source files of the project</small>]
ROOT --> EX["examples/<br/><small>Runnable demos</small>"]
ROOT --> TOOLS["tools/<br/><small>Some useful general tools</small>"]
ROOT --> DOCS["docs/<br/><small>Images, doxygen</small>"]
SRC --> ENGINE["engine/<br/><small>ECS Core of the engine</small>"]
SRC --> PLUGIN["plugin/<br/><small>Groups of context</small>"]
SRC --> UTILS["utils/<br/><small>Shared utility stuff</small>"]
PLUGIN --> PLUGIN_SRC["src/<br/><small>Source files</small>"]
PLUGIN --> PLUGIN_XMAKE["tests/<br/><small>Tests files</small>"]
Engine² is STRONGLY built around an ECS architectural design pattern. The engine core (src/engine/) provides all necessary stuff to agglomerate logic and data to create any kind project. The Core class is the entry point of the framework, it allows to manipulate entities and systems through schedulers. All features (graphics, physics, sound, etc.) are implemented as plugins that you register into the engine core.

Available plugins

Here is a list of available plugins:
Plugin Description
graphic 3D rendering via WebGPU
physics Rigid body physics via JoltPhysics
input Keyboard/mouse input via GLFW
sound Audio playback via miniaudio
window Window management via GLFW
scene Scene graph management
event Publish/subscribe event system
relationship Parent/child entity relationships
native-scripting Attach C++ scripts to entities
rmlui UI rendering via RmlUi
camera-movement Built-in camera controller
rendering-pipeline Rendering pipeline abstraction
default-pipeline Pre-assembled default render pipeline
Warning
Those schedulers may not be up to date as they are not updated automatically.

How a minimal program looks

Here is a very basic example that can be useful to understand the pattern before contributing:
#include "Engine.hpp"
// A Component should only holds data related to an entity
struct NameComponent { std::string value; };
// A System is a callable element (function, class or lambda) that only run logic
core.GetRegistry().view<NameComponent>().each(
[](auto &name) { Log::Info(name.value + " arrived."); });
}
int main() {
// Register systems on lifecycle schedulers: Startup, Update or Shutdown
// Create entities and attach components
auto entity = core.CreateEntity();
entity.AddComponent<NameComponent>("Alice");
core.RunSystems(); // starts the game loop, RunSystems() run them only one time and RunCore() run all scheduler indefinitely until Stop() is called
}
The core is the place where all the data of the engine is stored. It contains the registry (entities)...
Definition Core.hpp:33
void RunSystems()
Run all the systems once by calling each scheduler.
Definition Core.cpp:83
decltype(auto) RegisterSystem(Systems... systems)
Add one or multiple systems associated with a specific scheduler.
Definition Core.inl:61
Entity CreateEntity()
Create an entity in the context of the registry.
Definition Core.cpp:44
Registry & GetRegistry()
Get the entt::registry that contains all components. It should be used to update component through sy...
Definition Core.hpp:50
Startup scheduler that runs systems only once.
Definition Startup.hpp:8
void HelloSystem(Engine::Core &core)
Definition main.cpp:35
int main(void)
Definition main.cpp:80
void Info(const T &msg) noexcept
Definition Logger.hpp:47
Definition main.cpp:16
std::string value
Definition main.cpp:17
Warning
This example may not be up to date as it's not updated automatically. For concrete working examples, you can check examples folder.

Where to go next


Interested ?

You can start to discover the engine through contribute to it through looking at good first issues and checking how to contribute

Troubleshooting

For now there is no troubleshooting found. If you encounter a problem, please report it by opening a question issue 🙏 (before doing that, check the documentation about how to create an issue)