3 ms·
I suggest you read more into component signatures and how systems decide which components to operate on. Specifically, systems do not own components. Nor do th
by dyarosla 9y ago
I suggest you read more into component signatures and how systems decide which components to operate on.
Specifically, systems do not own components. Nor do they operate on full entities. Nor is there any coupling.
If you have entities that need to be rendered, you would give them a render component. A render system would render all render components that exist (thus 'rendering the entities' for whom those render components belong to)
If you have entities with positions but not render components, the render system would not operate on those entities.
Similarly if an entity has a render component but no, say, velocity component, it would not be registered to a movementSystem.
Systems that need to propagate data between components would have component signatures that include those components for which they need the data of. So a positionRender system would have an aspect of [PositionComp, RenderComp] and would be the only system to copy over data from one to the other.
There will always have to be a place that decides what object has which components. This should be as close as possible to the 'aggregate root' (a term from DI), and generally in ECS at the point of instantiation of the entity. I believe this question is prompted by a fundamental misunderstanding of ECS.