Eccy
Yet Another ECS Library
Status
Very experimental, early development. You probably shouldn't use this for any real stuff just yet.
How to use
1. Define a component
A component can be any class.
@component()
class Position {
public constructor(
public x: number,
public y: number,
) {}
}
2. Define some systems
class RenderSystem extends System {
private positions = Query.entities()
.select(Position)
.query();
public override run() {
for (let [position] of this.positions) {
position.x++;
}
}
}
@system({ runOnce: true })
class StartupSystem extends System {
public override run(cmd: Commands) {
cmd.spawn(new Position(10, 12));
}
}
3. Configure the engine
let engine = new Engine()
.system(StartupSystem, RenderSystem)
.finalise();
4. Ready, set, go!
await engine.run(60);