Sparsey
Sparsey is a sparse set-based Entity Component System (ECS).
Design Goals
- Be flexible: Any
Send + Sync + 'static
type can be used as a component. - Be concise: The most commonly used functionalities should require the least amount of typing.
- Make use of sparse sets: Provide features exclusive to sparse set-based ECS.
Example
use *;
;
;
Features
Easy to Use Systems
Systems are plain functions.
;
let mut world = default;
world.entities.;
world.entities.;
world.resources.insert;
world.run;
world.run;
Expressive Queries
Get, include and exclude components using Sparsey's query API.
Great Performance with Grouped Storages
Sparsey allows the user to "group" component storages to greatly optimize
iteration performance. Groups are created by setting a GroupLayout
.
let layout = builder
.
.
.build;
let entities = new;
After the layout is set, iterators over the grouped storages become "dense", greatly improving their performance. Additionally, grouped storages allow access to their components and entities as slices.
Thanks
Sparsey takes inspiration and borrows features from other free and open source ECS projects, namely Bevy, EnTT, Legion, Shipyard and Specs. Make sure you check them out!
License
Sparsey is dual-licensed under either
-
MIT License (LICENSE-MIT or https://opensource.org/license/mit/)
-
Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
at your option.
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 above without any additional terms or conditions.