Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leudz/shipyard
Entity Component System focused on usability and flexibility.
https://github.com/leudz/shipyard
architectural-patterns data-oriented ecs entity-component entity-component-system game-development gamedev parallel-ecs rust shipyard
Last synced: 2 months ago
JSON representation
Entity Component System focused on usability and flexibility.
- Host: GitHub
- URL: https://github.com/leudz/shipyard
- Owner: leudz
- License: other
- Created: 2019-06-23T18:08:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T17:57:44.000Z (4 months ago)
- Last Synced: 2024-10-07T01:17:38.903Z (3 months ago)
- Topics: architectural-patterns, data-oriented, ecs, entity-component, entity-component-system, game-development, gamedev, parallel-ecs, rust, shipyard
- Language: Rust
- Homepage:
- Size: 13.7 MB
- Stars: 744
- Watchers: 14
- Forks: 44
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- AwesomeCppGameDev - shipyard
README
Shipyard ⚓
Shipyard is an Entity Component System focused on usability and speed.
If you have any question or want to follow the development more closely [![Chat](https://img.shields.io/badge/join-Zulip-brightgreen.svg)](https://shipyard.zulipchat.com).
[![Crates.io](https://img.shields.io/crates/v/shipyard)](https://crates.io/crates/shipyard)
[![Documentation](https://docs.rs/shipyard/badge.svg)](https://docs.rs/shipyard)
[![LICENSE](https://img.shields.io/crates/l/shipyard)](LICENSE-APACHE)### [Guide Master](https://leudz.github.io/shipyard/guide/master) | [Guide 0.7](https://leudz.github.io/shipyard/guide/0.7) | [Demo](https://leudz.github.io/shipyard/bunny_demo) | [Visualizer](https://leudz.github.io/shipyard/visualizer)
## Basic Example
```rust
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);
}
```## Small Game Example
Inspired by Erik Hazzard's [Rectangle Eater](http://erikhazzard.github.io/RectangleEater/).
[![Play](https://img.shields.io/badge/Play-Online-green)](https://leudz.github.io/shipyard/square_eater)
[![Source](https://img.shields.io/badge/View-Source-blue)](square_eater/src/main.rs)## Table of Contents
- [Origin of the name](#origin-of-the-name)
- [Motivation](#motivation)
- [Cargo Features](#cargo-features)
- [License](#license)
- [Contributing](#contributing)## Origin of the name
Assembly 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 bother each other.
Shipyards such as the [Venetian Arsenal](https://en.wikipedia.org/wiki/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 project you can use to build your own highly-parallel software processes.
## Motivation
I initially wanted to make an ECS to learn how it works. After a failed attempt and some research, I started working on Shipyard.
[Specs](https://github.com/amethyst/specs) was already well established as the go-to Rust ECS but I thought I could do better and went with [EnTT](https://github.com/skypjack/entt)'s core data-structure (`SparseSet`) and grouping model. A very flexible combo.
## Cargo Features
- **parallel** _(default)_ — enables workload threading and add parallel iterators
- **proc** _(default)_ — re-exports macros from `shipyard_proc`, mainly to derive `Component`
- **serde1** — adds (de)serialization support with [serde](https://github.com/serde-rs/serde)
- **std** _(default)_ — lets Shipyard use the standard library
- **thread_local** — adds methods and types required to work with `!Send` and `!Sync` components
- **tracing** — reports workload and system execution## License
Licensed under either of
- Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.
## 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 above, without any additional terms or conditions.