https://github.com/yosriady/ecs
:rabbit: Entity Component System
https://github.com/yosriady/ecs
ecs elixir entity-component entity-component-system
Last synced: 3 months ago
JSON representation
:rabbit: Entity Component System
- Host: GitHub
- URL: https://github.com/yosriady/ecs
- Owner: yosriady
- Created: 2016-09-15T17:08:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T15:16:30.000Z (over 4 years ago)
- Last Synced: 2025-04-01T10:21:14.177Z (10 months ago)
- Topics: ecs, elixir, entity-component, entity-component-system
- Language: Elixir
- Homepage: http://yos.io/2016/09/17/entity-component-systems/
- Size: 12.7 KB
- Stars: 68
- Watchers: 7
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Entity Component System
```elixir
ECS.Registry.start
# Create an entity with a given collection of components.
bunny = ECS.Entity.build([TimeComponent.new(%{age: 0})])
# Each game turn, we may trigger a system to process and push some state updates to our components.
TimeSystem.process
TimeSystem.process
# Because Elixir is immutable, we need to pull the latest state.
bunny = ECS.Entity.reload(bunny)
# New components can be added at runtime, adding new behaviour to existing entities.
bunny = ECS.Entity.add(bunny, TimeComponent.new(%{age: 10}))
# State updates will also be pushed to components added at runtime.
TimeSystem.process
bunny = ECS.Entity.reload(bunny)
```
## Thanks
**ecs** © 2016+, Yos Riady. Released under the [MIT] License.
Authored and maintained by Yos Riady with help from contributors ([list][contributors]).
> [yos.io](http://yos.io) ·
> GitHub [@yosriady](https://github.com/yosriady)
[MIT]: http://mit-license.org/
[contributors]: http://github.com/yosriady/ecs/contributors