I've just started to try and learn how to use ECS (Entity component systems) in games, but I've found it a bit hard to understand. Right now I have two main questions:
- In an ECS, is it preferable to store a boolean value in a component to flag an entity, and keep that component permanently on that entity, or to add/remove a component to flag an entity? For example, if I want some way of flagging an entity when it dies so it can be removed, is it better to have an AliveComponent with a boolean dead to indicate if it's dead or a DeadComponent that gets added to indicate if an entity is dead.
- Should adding more types of components, or trying to make a component reusable through its fields be favored? For example, if I'm trying to give all entities a shape for collision detection, should I have a different component for every shape (RectangleComponent, CircleComponent, PolygonComponent), or should I have one ShapeComponent, and in there have a field which is of type Shape, with Shape having subclasses Rectangle, Circle, and Polygon.
Also, I couldn't find many good resources on ECS concepts, so if anyone knows any good ones, it would be really helpful.
Thanks!