# README
GO ECS
Go ECS is a simple sparse set, query based Entity Component System (ECS) library.
Description
This ECS implementation uses a sparse set style data structure for packing the entity and component (arbitrary data) arrays while allowing O(1) entity lookups. It is simple and lightweight.
Iterating over a list of entities and components is optimal. However, iterating over archetypes with multiple components is only supported through O(N) queries. There is no grouping feature to improve query time as of now. However, this is still very fast and allows for extremely fast add and remove operations.
Creation and destruction must be handled by the user. Systems are not managed by the world: there is no scheduler or event system. There are only queries. The rest is up to the programmer. This is not a framework, just another tool.
This package has no external dependencies and avoids reflection by way of Go's limited generic types. As a tradeoff, a separate query function must be written for every number of components queried (Go does not support variadic generics).
Usage
Go get the package.
go get github.com/jdavasligil/go-ecs@latest
Import the package.
import (
"github.com/jdavasligil/go-ecs"
)
See the examples folder for code examples. The basic example should be enough to get you going.
You can run the example with the following.
go run ./examples/basic
Authors
Version History
- 1.0.0
Contributing
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
License
© <2024> <Jaedin Davasligil>.
This project is licensed under either of
The SPDX license identifier for this project is MIT OR Apache-2.0
.