How sandermertens/flecs works
Flecs is a C/C++ Entity Component System framework for games and simulations. The main workflow is to create a world, register entities and components, define queries and systems, then progress the world so a pipeline schedules matching systems to process component data. The graph also shows documented capabilities such as prefabs, reflection and JSON, scripting, monitoring, and REST access. Core paths and selected addon sources support the relationships shown; several addon links reflect README or API documentation rather than sampled implementation, so uncertain wiring is omitted.
Main entry points: world.c ECS world · app.c Application loop · entity.c Entities and IDs · eval.c Query engine
Components 20
World and storage
- ECS world
src/world.c - Entities and IDs
src/entity.c - Archetype storage
src/storage/table.c - Sparse components
src/storage/sparse_storage.c
Queries and execution
- Query API
src/query/api.c - Query compiler
src/query/compiler/compiler.c - Query cache
src/query/cache/cache.c - Query engine
src/query/engine/eval.c - Systems
src/addons/system/system.c - Pipeline scheduler
src/addons/pipeline/pipeline.c
Runtime addons
- Application loop
src/addons/app.c - Prefabs and hierarchy
src/addons/prefab/prefab.c - Reflection and metadata
src/addons/meta/meta.c - JSON serialization
src/addons/json/json.c - Script runtime
src/addons/script/script.c - Statistics monitoring
src/addons/stats/stats.c - REST interface
src/addons/rest.c
Other components
- Application developer
Connections 24
- Application developer → C API: uses
- Application developer → C++ API: uses
- C API → ECS world: creates and configures
- C++ API → ECS world: wraps
- ECS world → Entities and IDs: manages
- Entities and IDs → Archetype storage: stores component sets
- Entities and IDs → Sparse components: stores sparse data
- Query API → Query compiler: compiles terms
- Query API → Query cache: maintains matches
- Query engine → Query cache: iterates matches
- Query engine → Archetype storage: matches tables
- Query engine → Sparse components: evaluates sparse data
- Systems → Query API: uses queries
- Pipeline scheduler → Systems: schedules systems
- Application loop → ECS world: progresses
- Application loop → Pipeline scheduler: runs via progress
- Systems → Archetype storage: processes component data
- Prefabs and hierarchy → Entities and IDs: instantiates entities
- Reflection and metadata → JSON serialization: provides type metadata
- JSON serialization → ECS world: serializes world data
- Script runtime → ECS world: evaluates against
- Application loop → REST interface: can enable
- Application loop → Statistics monitoring: can enable
- Statistics monitoring → Pipeline scheduler: monitors