{"id":"ketasaja/jecs","name":"jecs","scope":"ketasaja","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.5.5-new-solver","latest":"0.5.5-new-solver","versions":["0.5.3-new-solver","0.5.3-new-solver-2","0.5.5-new-solver"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"7d901b50b0035caacdb55394b79694acd196c7c63a12113e40fcac894d29203b","likes":0,"downloads":1,"install":"forest install ketasaja/jecs","url":"https://forest.dev/p/roblox/ketasaja/jecs","files":"https://api.forest.dev/ai/package/roblox/ketasaja/jecs/files","readme":"<p align=\"center\">\r\n  <img src=\"assets/image-5.png\" width=35%/>\r\n</p>\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](LICENSE) [![Wally](https://img.shields.io/github/v/tag/ukendio/jecs?&style=for-the-badge)](https://wally.run/package/ukendio/jecs)\r\n\r\nJust a stupidly fast Entity Component System\r\n\r\n-   [Entity Relationships](https://ajmmertens.medium.com/building-games-in-ecs-with-entity-relationships-657275ba2c6c) as first class citizens\r\n-   Iterate 800,000 entities at 60 frames per second\r\n-   Type-safe [Luau](https://luau-lang.org/) API\r\n-   Zero-dependency package\r\n-   Optimized for column-major operations\r\n-   Cache friendly [archetype/SoA](https://ajmmertens.medium.com/building-an-ecs-2-archetypes-and-vectorization-fe21690805f9) storage\r\n-   Rigorously [unit tested](https://github.com/Ukendio/jecs/actions/workflows/ci.yaml) for stability\r\n\r\n### Example\r\n\r\n```lua\r\nlocal world = jecs.World.new()\r\nlocal pair = jecs.pair\r\n\r\n-- These components and functions are actually already builtin\r\n-- but have been illustrated for demonstration purposes\r\nlocal ChildOf = world:component()\r\nlocal Name = world:component()\r\n\r\nlocal function parent(entity)\r\n    return world:target(entity, ChildOf)\r\nend\r\nlocal function getName(entity)\r\n    return world:get(entity, Name)\r\nend\r\n\r\nlocal alice = world:entity()\r\nworld:set(alice, Name, \"alice\")\r\n\r\nlocal bob = world:entity()\r\nworld:add(bob, pair(ChildOf, alice))\r\nworld:set(bob, Name, \"bob\")\r\n\r\nlocal sara = world:entity()\r\nworld:add(sara, pair(ChildOf, alice))\r\nworld:set(sara, Name, \"sara\")\r\n\r\nprint(getName(parent(sara)))\r\n\r\nfor e in world:query(pair(ChildOf, alice)) do\r\n    print(getName(e), \"is the child of alice\")\r\nend\r\n\r\n-- Output\r\n-- \"alice\"\r\n-- bob is the child of alice\r\n-- sara is the child of alice\r\n```\r\n\r\n21,000 entities 125 archetypes 4 random components queried.\r\n![Queries](assets/image-3.png)\r\nCan be found under /benches/visual/query.luau\r\n\r\nInserting 8 components to an entity and updating them over 50 times.\r\n![Insertions](assets/image-4.png)\r\nCan be found under /benches/visual/insertions.luau\r\n","readmeTruncated":false}