Arche -- Archetype-based Entity Component System (ECS) for Go.
Arche -- Archetype-based Entity Component System (ECS) for Go.
Arche is an archetype-based Entity Component System for Go.
[!IMPORTANT] Arche has a successor: Ark.
- If you are new here, use Ark.
- If you use Arche's generic API, consider migrating to Ark. It will be easy.
- If you use Arche's ID-based API, stay with Arche.
Arche will still be maintained further.
To use Arche in a Go project, run:
go get github.com/mlange-42/archeHere is the classical Position/Velocity example that every ECS shows in the docs. It uses the type-safe generic API.
See the User Guide, API docs and examples for details. For more complex examples, see arche-demo.
…Several tools for Arche are provided in separate modules:
Unlike most other ECS implementations, Arche is designed for the development of scientific, individual-based models rather than for game development. This motivates some design decisions, with an emphasis on simplicity, safety and performance. Nevertheless, Arche can also be used for game development.
The ecs.World object is a pure and simple ECS implementation in the sense of a data store
for entities and components, with query and iteration capabilities.
More advanced features like batch operations or entity relations are provided through separate objects.
There is neither an update loop nor systems. These should be implemented by the user. For a batteries-included implementation, see module arche-model.
The type-safe generic API and advanced logic filters are provided in the packages generic and filter, respectively. Both packages are built on top of the core ecs package, so they could also be implemented by a user.
Iteration order in Arche is deterministic and reproducible.
This does not mean that entities are iterated in their order of insertion, nor in the same order in successive iterations.
However, given the same operations on the ecs.World, iteration order will always be the same.
Arche puts an emphasis on safety and on avoiding undefined behavior. It panics on unexpected operations, like removing a dead entity, adding a component that is already present, or attempting to change a locked world. This may not seem idiomatic for Go. However, explicit error handling in performance hot spots is not an option. Neither is silent failure, given the scientific background.
World is limited to 256. This is mainly a performance decision.uint32 ID).A tabular overview of the runtime cost of typical Arche ECS operations is provided under benchmarks in the Arche's User Guide.
For a benchmark comparison with other ECS implementations, see the go-ecs-benchmarks repository.
Lange, M. (2023): Arche – An archetype-based Entity Component System for Go. DOI 10.5281/zenodo.7656484, GitHub repository: https://github.com/mlange-42/arche
This project is distributed under the MIT license.
No open issues yet, or sync has not completed.