← All school projects

finished2025

ECS Template

Entity Component System engine in C++20 with modular architecture

C++ · ECS · Game Engine · SFML · Architecture

GitHub ↗

Universal Entity Component System engine in C++20. Modular architecture, reusable for all types of 2D games.

Context

ECS engine born from the second-year Jeu Libre project (March to May 2025), then extracted and published as a reusable template.

Goal: create a reusable engine as a base for other projects, with a clean and extensible architecture.

What it does

Supported game types:

  • Real-time: FPS, platformers, action
  • Turn-based: strategy, tactical RPG
  • Grid-based: roguelikes, puzzles
  • Hybrid: mode combinations

Architecture:

  • Entities as pure IDs
  • Components as data
  • Systems for behavior
  • Total logic/data decoupling

Demo: Pirate Space Explorer - complete game (30+ Components, 35 Systems) shipped inside the repo as a showcase.

Links

ECS Architecture

Pure Entity-Component-System architecture:

Entity (ID)
    │
    ├── Component A (Data)
    ├── Component B (Data)
    └── Component C (Data)
         │
         └── Systems (Behavior)
             ├── Active (continuous)
             ├── Reactive (event-driven)
             └── TurnBased (discrete)

Tech Stack

TechVersionRole
C++20Core language
SFML2.5+2D rendering
CMake3.20+Build system
PatternsECS, Factory, ObserverArchitecture

Statistics

  • 36 Components modular
  • 35 Systems decoupled
  • 8+ Modules: core, transform, graphics, gameplay, inventory, interaction, AI, audio, network

Collision Optimizations

Spatial hashing O(n) vs O(n²):

EntitiesBrute ForceSpatial HashSpeedup
125125,000 checks1,000 checks25x
1000500,000 checks2,000 checks250x

Memory Safety

  • Smart pointers + RAII
  • Memory pooling for frequent allocations
  • Thread-safe with mutexes and atomics