{"id":25353415,"url":"https://github.com/samufi/larecs","last_synced_at":"2026-01-14T18:39:46.104Z","repository":{"id":262991898,"uuid":"736699301","full_name":"samufi/larecs","owner":"samufi","description":"Larecs🌲 – a performance-oriented archetype-based ECS","archived":false,"fork":false,"pushed_at":"2025-10-24T22:24:22.000Z","size":1127,"stargazers_count":12,"open_issues_count":16,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T00:23:40.416Z","etag":null,"topics":["archetype","ecs","mojo"],"latest_commit_sha":null,"homepage":"https://samufi.github.io/larecs/","language":"Mojo","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samufi.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-28T16:08:55.000Z","updated_at":"2025-10-19T22:00:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"39df68c6-3f02-49a4-b55e-6f6d96fc0f7c","html_url":"https://github.com/samufi/larecs","commit_stats":null,"previous_names":["samufi/larecs"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/samufi/larecs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samufi%2Flarecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samufi%2Flarecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samufi%2Flarecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samufi%2Flarecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samufi","download_url":"https://codeload.github.com/samufi/larecs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samufi%2Flarecs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["archetype","ecs","mojo"],"created_at":"2025-02-14T19:01:51.636Z","updated_at":"2026-01-14T18:39:46.091Z","avatar_url":"https://github.com/samufi.png","language":"Mojo","funding_links":[],"categories":["🖥️ Applications\u003ca id='applications'\u003e\u003c/a\u003e"],"sub_categories":["Games"],"readme":"![CodeQL](https://github.com/samufi/larecs/workflows/CodeQL/badge.svg)\n\n# Larecs🌲 – Lightweight archetype-based ECS\n\nLarecs🌲 is a performance-oriented archetype-based ECS for [Mojo](https://www.modular.com/mojo)🔥. \nIts architecture is based on the Go ECS [Arche](https://github.com/mlange-42/arche). The package is still under construction, so be aware that parts of the API might change in future versions.\n\n\n## Features\n\n- Clean and simple API\n- High performance due to archetypes and Mojo's compile-time programming\n- Support for SIMD via a [`vectorize`](https://docs.modular.com/mojo/stdlib/algorithm/functional/vectorize/)-like syntax\n- Compile-time checks thanks to usage of parameters\n- Native support for [resources](https://mlange-42.github.io/arche/guide/resources/) and scheduling.\n- Tested and benchmarked\n- No external dependencies\n- More features coming soon... \n\n\n## Installation\n\nThis package is written in and for [Mojo](https://docs.modular.com/mojo/manual/get-started)🔥, which needs to be installed in order to compile, test, or use the software. You can build Larecs🌲 as a package as follows:\n\n1. Clone the repository / download the files.\n2. Navigate to the `src/` subfolder.\n3. Execute `mojo package larecs`.\n4. Move the newly created file `larecs.mojopkg` to your project's source directory.\n\n### Include source directly for compiler and language server\n\nTo access the source while debugging and to adjust the Larecs🌲 \nsource code, you can include it into run commands of your own\nprojects as follows:\n\n```\nmojo run -I \"path/to/larecs/src\" example.mojo\n```\n\nTo let VSCode and the language server know of Larecs🌲, include it as follows:\n\n1. Go to VSCode's `File -\u003e Preferences -\u003e Settings` page.\n2. Go to the `Extensions -\u003e Mojo` section.\n3. Look for the setting `Lsp: Include Dirs`.\n4. Click on `add item` and insert the path to the `src/` subdirectory.\n\n## Usage\n\nRefer to the [API docs](https://samufi.github.io/larecs/) for details\non how to use Larecs🌲. \n\nBelow there is a simple example covering the most important functionality.\nHave a look at the `examples` subdirectory for more elaborate examples. \n\n```python\n# Import the package\nfrom larecs import World, Resources\n\n\n# Define components\n@fieldwise_init\nstruct Position(Copyable, Movable):\n    var x: Float64\n    var y: Float64\n\n\n@fieldwise_init\nstruct IsStatic(Copyable, Movable):\n    pass\n\n\n@fieldwise_init\nstruct Velocity(Copyable, Movable):\n    var x: Float64\n    var y: Float64\n\n\n# Run the ECS\nfn main() raises:\n    # Create a world, list all components that will / may be used\n    world = World[Position, Velocity, IsStatic]()\n\n    for _ in range(100):\n        # Add an entity. The returned value is the\n        # entity's ID, which can be used to access the entity later\n        entity = world.add_entity(Position(0, 0), IsStatic())\n\n        # For example, we may want to change the entity's position\n        world.get[Position](entity).x = 2\n\n        # Or we may want to replace the IsStatic component\n        # of the entity by a Velocity component\n        world.replace[IsStatic]().by(Velocity(2, 2), entity=entity)\n\n    # We can query entities with specific components\n    for entity in world.query[Position, Velocity]():\n        # Get references to specific components\n        ref position = entity.get[Position]()\n        ref velocity = entity.get[Velocity]()\n\n        position.x += velocity.x\n        position.y += velocity.y\n```\n\n\n## Limitations\n\n### Only trivial types can be components\n\nLarecs🌲 currently only supports trivial types as components, i.e., structs \nthat have a fixed size in memory and can be copied and moved via a\nsimple memory copy operation. Using types with heap-allocated memory will\nresult in memory leaks and / or undefined behaviour, and as of now there is no\ngood way to enforce that only compatible types are used. \nHence, it is up to the users to take care of this.\n\nNote that using types with heap-allocated memory is typically a bad idea for\nECS and should be avoided anyway.\n\n## Next steps\n\nThe goal of Larecs🌲 is to provide a user-friendly ECS with maximal efficiency. \nIn the near future, Larecs🌲 will take the following steps:\n- [x] Add functionality for adding and removing multiple entities at once.\n- [ ] Add functionality for setting, adding and removing components of multiple entities at once.\n- [x] Improve the documentation\n- [x] Add a scheduler for easy setup of ECS. \n- [ ] Add built-in support for [event systems](https://mlange-42.github.io/arche/guide/events/index.html).\n- [x] Add further options to filter entities (e.g. \"does not have component\").\n- [ ] Add possibilities for parallel execution\n- [ ] Improve the API for systems (e.g. allow systems to stop the execution)\n- [ ] Add GPU support \n- [ ] Improve the usability by switching to value unpacking in queries as soon as this is available in Mojo🔥.\n- [x] Fix using an inefficient dictionary for first-time archetype lookup.\n- [ ] Allow the usage of complex types as components, i.e., types that have heap-allocated memory.\n\n## License\n\nThis project is distributed under the [LGPL3](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamufi%2Flarecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamufi%2Flarecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamufi%2Flarecs/lists"}