TinyECS
Another Entity-Component-System, written in Rust.
Usage
Usage
Add the following to the Cargo.toml in your project:
[dependencies]
tinyecs = "*"
# features = ["prof"] <- for monitoring each system performance, but working only on nightly rust
and import using:
extern crate tinyecs;
use tinyecs::*;
Why another ecs?
- mutliple mutable components access
- no boilerplate for entity and systems creation/accessing
- no restrictions on component content - non-copyable non-clonable structs is OK
- entity creation possible almost everywhere
- data aspects - possibility to view some additional entities while processing
Overview:
-
Entity is set of components identified by unique ID.
-
Component is struct with data.
-
System is behaviour working with components.
-
components:
Entities:
let mut entity_manager = world.entity_manager;
let entity = entity_manager.create_entity;
entity.add_component;
entity.add_component;
entity.refresh;
Systems:
process_entities!;
Or without macroses:
;
More features, described only in /examples atm:
- Aspects
- Entity creation from system's process
- Data aspects - for additional kind of entities in process
- Different process styles