Closed LukeWood closed 1 year ago
I might be misinterpreting your example but iirc you're supposed to define the ecs state like this:
interface State {
position?: Vector3 // shared component between player & terrain etc
velocity?: Vector3
player?: boolean
terrain?: {
// terrain properties (idk if vertices is supposed to be unique to the terrain component)
vertices: Vector3
}
}
const ecs = new World<State>()
const players = ecs.with('position', 'player')
const terrains = ecs.with('position', 'terrain')
You can also chain archetypes:
const movableObjects = ecs.with('position', 'velocity')
const players = movableObjects.with('player')
Ok Iām understanding much better now. I think I was missing a core concept of ECS
First of all, great work on miniplex. It is awesome.
Second, how do we represent multiple types of entities? Do we just do:
Is that how we're meant to do these sorts of things? Then...