Entity Component System focused on usability and flexibility.
Entity Component System focused on usability and flexibility.
use shipyard::{Component, IntoIter, View, ViewMut, World};
#[derive(Component)]
struct Health(u32);
#[derive(Component)]
struct Position {
x: f32,
y: f32,
}
fn in_acid(positions: View, mut healths: ViewMut) {
for (_, health) in (&positions, &mut healths)
.iter()
.filter(|(pos, _)| is_in_acid(pos))
{
health.0 -= 1;
}
}
fn is_in_acid(_: &Position) -> bool {
// it's wet season
true
}
fn main() {
let mut world = World::new();
world.add_entity((Position { x: 0.0, y: 0.0 }, Health(1000)));
world.run(in_acid);
}Inspired by Erik Hazzard's Rectangle Eater.
shipyard_proc, mainly to derive Component!Send and !Sync componentsAssembly lines take input, process it at each step, and output a result. You can have multiple lines working in parallel as long as they don't cross paths.
Shipyards such as the Venetian Arsenal are some of the oldest examples of successful, large-scale, industrial assembly lines.
So successful that it could output a fully-finished ship every day.
Shipyard is a library you can use to build your own highly-parallel software.
I initially wanted to make an ECS to learn how they work. After a failed attempt and some research, I started working on Shipyard.
Specs was already well established as the go-to Rust ECS but I thought I could do better and went with EnTT's core data-structure (SparseSet) and grouping model. A very flexible combo.
Licensed under either of
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.
No open issues yet, or sync has not completed.