MCPcopy Index your code
hub / github.com/SanderMertens/flecs

github.com/SanderMertens/flecs @v4.1.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.1.6 ↗ · + Follow
17,911 symbols 84,802 edges 1,276 files 1,342 documented · 7% updated 1d agov4.1.6 · 2026-06-29★ 8,49126 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

flecs

Version MIT Documentation actions Discord Chat

Flecs is a fast and lightweight Entity Component System that lets you build games and simulations with millions of entities (join the Discord!). Here are some of the framework's highlights:

Flecs Explorer

To support the project, give it a star 🌟 !

What is an Entity Component System?

ECS is a way of organizing code and data that lets you build games that are larger, more complex and are easier to extend. Something is called an ECS when it: - Has entities that uniquely identify objects in a game - Has components which are datatypes that can be added to entities - Has systems which are functions that run for all entities matching a component query

For more information, check the ECS FAQ!

Show me the code!

C99 example:

typedef struct {
  float x, y;
} Position, Velocity;

void Move(ecs_iter_t *it) {
  Position *p = ecs_field(it, Position, 0);
  Velocity *v = ecs_field(it, Velocity, 1);

  for (int i = 0; i < it->count; i++) {
    p[i].x += v[i].x;
    p[i].y += v[i].y;
  }
}

int main(int argc, char *argv[]) {
  ecs_world_t *ecs = ecs_init();

  ECS_COMPONENT(ecs, Position);
  ECS_COMPONENT(ecs, Velocity);

  ECS_SYSTEM(ecs, Move, EcsOnUpdate, Position, Velocity);

  ecs_entity_t e = ecs_insert(ecs,
    ecs_value(Position, {10, 20}),
    ecs_value(Velocity, {1, 2}));

  while (ecs_progress(ecs, 0)) { }
}

Same example in C++:

struct Position {
  float x, y;
};

struct Velocity {
  float x, y;
};

int main(int argc, char *argv[]) {
  flecs::world ecs;

  ecs.system<Position, const Velocity>()
    .each([](Position& p, const Velocity& v) {
      p.x += v.x;
      p.y += v.y;
    });

  auto e = ecs.entity()
    .insert([](Position& p, Velocity& v) {
      p = {10, 20};
      v = {1, 2};
    });

  while (ecs.progress()) { }
}

Projects using Flecs

If you have a project you'd like to share, let me know on Discord!

Tempest Rising

Tempest Rising

Territory Control 2

image

Resistance is Brutal

image

Appulse

image

Rescue Ops: Wildfire

image

Age of Respair

image

FEAST

image

Gloam Vault

image

Antimatcher

image

Writ of Battle

image

Extermination Shock

image

The Forge

image

ECS survivors

image

Tome Tumble Tournament

image

Sol Survivor

image

After Sun

image

Flecs Hub

Flecs Hub is a collection of repositories that show how Flecs can be used to build game systems like input handling, hierarchical transforms and rendering.

Module Description
flecs.components.cglm Component registration for cglm (math) types
flecs.components.input Components that describe keyboard and mouse input
flecs.components.transform Components that describe position, rotation and scale
flecs.components.physics Components that describe physics and movement
flecs.components.geometry Components that describe geometry
flecs.components.graphics Components used for computer graphics
flecs.components.gui Components used to describe GUI components
flecs.systems.transform Hierarchical transforms for scene graphs
flecs.systems.physics Systems for moving objects and collision detection
flecs.systems.sokol Sokol-based renderer
flecs.game Generic game systems, like a camera controller

Language bindings

The following language bindings have been developed with Flecs! Note that these are projects built and maintained by helpful community members, and may not always be up to date with the latest commit from master! - C#: - BeanCheeseBurrito/Flecs.NET - Rust: - Flecs-Rust - flecs-polyglot - Zig: - zig-gamedev/zflecs - Lua: - sro5h/flecs-luajit - flecs-hub/flecs-lua - Clojure - vybe-flecs

Core symbols most depended-on inside this repo

ecs_id
called by 10272
test/query/src/Cached.c
ecs_fini
called by 8851
src/world.c
ecs_query_next
called by 8701
src/query/engine/eval_iter.c
ecs_field_id
called by 7169
src/iter.c
ecs_mini
called by 5652
src/world.c
ecs_field_src
called by 5169
src/iter.c
ecs_new
called by 4360
src/entity.c
ecs_query_iter
called by 3934
src/query/engine/eval_iter.c

Shape

Function 14,613
Class 1,948
Method 1,267
Enum 83

Languages

C70%
C++29%
TypeScript1%

Modules by API surface

distr/flecs.h1,174 symbols
test/script/src/Eval.c513 symbols
test/cpp/src/Entity.cpp435 symbols
test/script/src/Expr.c335 symbols
test/query/src/NonFragmentingChildOf.c324 symbols
test/query/src/Parser.c316 symbols
test/core/src/NonFragmentingChildOf.c257 symbols
test/query/src/Basic.c252 symbols
test/core/src/Prefab.c227 symbols
test/cpp/src/QueryBuilder.cpp225 symbols
test/core/src/Sparse.c221 symbols
test/query/src/Variables.c217 symbols

For agents

$ claude mcp add flecs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page