{"id":28996465,"url":"https://github.com/superpuero/kawa_ecs","last_synced_at":"2025-10-06T19:40:30.315Z","repository":{"id":300471062,"uuid":"1006261325","full_name":"superPuero/kawa_ecs","owner":"superPuero","description":"Lightweight, fast, single-heaeder ecs library written in c++","archived":false,"fork":false,"pushed_at":"2025-06-21T21:55:47.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-21T22:26:51.682Z","etag":null,"topics":["blazingly-fast","cpp","cpp17","cpp20","ecs","entity-component-system","game","game-development","game-engine","header-only"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/superPuero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-21T21:19:59.000Z","updated_at":"2025-06-21T21:55:50.000Z","dependencies_parsed_at":"2025-06-21T22:37:07.671Z","dependency_job_id":null,"html_url":"https://github.com/superPuero/kawa_ecs","commit_stats":null,"previous_names":["superpuero/kawa_ecs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/superPuero/kawa_ecs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superPuero%2Fkawa_ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superPuero%2Fkawa_ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superPuero%2Fkawa_ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superPuero%2Fkawa_ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superPuero","download_url":"https://codeload.github.com/superPuero/kawa_ecs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superPuero%2Fkawa_ecs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261808073,"owners_count":23212694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazingly-fast","cpp","cpp17","cpp20","ecs","entity-component-system","game","game-development","game-engine","header-only"],"created_at":"2025-06-25T05:09:53.251Z","updated_at":"2025-10-06T19:40:30.292Z","avatar_url":"https://github.com/superPuero.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kawa::ecs\n\n![Language](https://img.shields.io/badge/C%2B%2B-20-blue.svg)  \n**kawa::ecs** is a *lightweight, modern and parallel ready* Entity-Component System for modern C++.  \nIt offers a minimal yet powerful API for building games, simulations, and real-time applications with both single-threaded and multi-threaded execution.\n\n---\n\n## Why kawa::ecs?\n\n- **Fast** — cache-friendly storage and minimal indirection  \n- **Expressive** — functional, intuitive query interface  \n- **Parallel** — simple thread-pool integration for parallel processing  \n- **No dependencies** — zero third-party requirements  \n- **Debug-friendly** — rich runtime assertions\n\n---\n\n## Integration\n```bash\ncp -r kawa/ ./include/\n```\n```cpp\n#include \"kawa/ecs/kwecs.h\"\n```\n- Compile with **C++20**  \n- Profit!\n\n---\n\n## Quick Start\n\n```cpp\n#include \"kwecs.h\"\n#include \u003ciostream\u003e\n#include \u003cstring\u003e\n\nstruct Position { float x, y; };\nstruct Velocity { float x, y; };\nstruct Label    { std::string name; };\n\nvoid update_position(float dt, Position\u0026 pos, const Velocity\u0026 vel) {\n    pos.x += vel.x * dt;\n    pos.y += vel.y * dt;\n}\n\nint main() {\n    using namespace kawa::ecs;\n\n    // Create registry\n    registry reg({\n        .name = \"demo\",\n        .max_entity_count = 255,\n    });\n\n    // Create entities\n    entity_id e1 = reg.entity(Position{12.4f, 34.6f}, Velocity{2.0f, 3.0f});\n    entity_id e2 = reg.entity(Position{10, 20}, Velocity{1, 1}, Label{\"Ichigo\"});\n\n    // Query with optional component\n    reg.query([](Position\u0026 pos, Label* label) {\n        std::cout \u003c\u003c (label ? label-\u003ename : \"unnamed\")\n                  \u003c\u003c \" is at (\" \u003c\u003c pos.x \u003c\u003c \", \" \u003c\u003c pos.y \u003c\u003c \")\\n\";\n    });\n\n    // Fall-through parameter\n    float dt = 0.16f;\n    reg.query(update_position, dt);\n\n    // Parallel query\n    kawa::thread_pool tp(8);\n    reg.query_par(tp, [](Position\u0026 pos, const Velocity\u0026 vel) {\n        pos.x += vel.x;\n        pos.y += vel.y;\n    });\n}\n```\n\n---\n\n## API Overview\n\n### Entity Management\n| Call                                   | Purpose                                               |\n|----------------------------------------|-------------------------------------------------------|\n| `entity()`                             | Create a new empty entity                             |\n| `entity(Ts... components)`             | Create entity with given components                   |\n| `destroy(id)`                          | Destroy entity and remove all components              |\n| `clone(from)`                          | Clone entity into a new one                           |\n| `clone(from, to)`                      | Overwrite `to` with `from`’s components               |\n\n### Component Management\n| Call                                   | Purpose                                               |\n|----------------------------------------|-------------------------------------------------------|\n| `emplace\u003cT\u003e(id, args…)`                | Add component `T` to entity                           |\n| `erase\u003cTs...\u003e(id)`                     | Remove one or more components                         |\n| `has\u003cTs...\u003e(id)`                       | Check if entity has all listed components             |\n| `get\u003cT\u003e(id)` / `get_if_has\u003cT\u003e(id)`     | Access component (ref / ptr)                          |\n| `copy\u003cTs...\u003e(from, to)`                 | Copy specific components                              |\n| `move\u003cTs...\u003e(from, to)`                 | Move specific components                              |\n\n### Querying\n| Call                                   | Purpose                                               |\n|----------------------------------------|-------------------------------------------------------|\n| `query(fn, args…)`                     | Iterate over matching entities                        |\n| `query_par(tp, fn, args…)`              | Same as `query` but parallelized with thread pool     |\n| `query_with(id, fn, args…)`             | Run query on a single entity                          |\n| `query_info(fn)`                        | Iterate components with metadata for all entities     |\n| `query_info_with(id, fn)`               | Iterate components with metadata for one entity       |\n\n### Hooks\n| Call                                   | Purpose                                               |\n|----------------------------------------|-------------------------------------------------------|\n| `on_construct(fn)`                     | Called when component is added to an entity                 |\n| `on_destroy(fn)`                       | Called when component is removed from an entity             |\n\n---\n\n## Query Semantics\n\n`registry::query` inspects your function parameters and matches entities accordingly.\n\n### Parameter Groups\n| Group         | Example                 | Meaning                                              |\n|---------------|-------------------------|------------------------------------------------------|\n| **Fall-through** | `T`, `T\u0026`, `T*`         | Passed in from outside (not from components)         |\n| **Required**     | `Component\u0026` or `const Component\u0026` | Entity must have this to match                       |\n| **Optional**     | `Component*`           | `nullptr` if the entity lacks this component         |\n\n**Order matters:** Fall-through → Components.  \nExample:\n```cpp\nreg.query([](float dt, Position\u0026 pos, Label* name), 0.16f);\n```\n\n---\n\n## Parallel Queries\n\n`query_par` runs queries in parallel using a kawa::thread_pool.\n\n---\n\n\u003e Made with care ❤️ — If you build something cool with **kawa::ecs**, share it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperpuero%2Fkawa_ecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperpuero%2Fkawa_ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperpuero%2Fkawa_ecs/lists"}