Lightweight entity component system for games and simulations with C99 and C++17 APIs. Supports hierarchies, prefabs, relationships, queries, and multithreaded scheduling.
Overview
Flecs is a fast, lightweight entity component system for building games and simulations that may involve very large numbers of entities. It exposes a portable zero-dependency C99 API and a type-safe C++17 API that avoids STL containers in its core design.
An ECS organizes work around entities as unique object identifiers, components as data types attached to entities, and systems as functions that run over entities matching queries. Flecs emphasizes entity relationships, native hierarchies, and prefabs, plus a query language with joins and inheritance. Storage uses cache-friendly archetype and structure-of-arrays layouts aimed at high per-frame throughput.
Developers can write free functions with queries or register systems that run automatically on schedules. A lockless scheduler can spread game logic across CPU cores. Addons cover systems, prefabs, scripting, a query language, remote API access, reflection with JSON serialization, runtime components, and statistics for profiling.
Flecs builds quickly, runs in the browser with emscripten without code changes, and documents Flecs Hub modules for input, transforms, physics, graphics, and rendering integrations. Community language bindings exist for C#, Rust, Zig, Lua, Clojure, and Java.
Key features
- C99 and C++17 APIs
- Entity relationships support
- Hierarchies and prefabs
- Query language with joins
- Multithreaded lockless scheduler
- JSON reflection serializer
- Flecs Explorer web UI
- Archetype SoA storage
Use cases
- Game engines and simulations
- Large-scale entity gameplay logic
- Browser games via emscripten
- Scene graphs with hierarchies
- ECS prototypes in C or C++