I've just started to try and learn how to use ECS (Entity component systems), but I'm having trouble understanding the concepts behind components.
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 class Shape
having subclasses Rectangle
, Circle
, and Polygon
.
I'm unsure because using a Shape
seems to be much more flexible and easier to implement systems, but it also feels like I'm violating the ECS rule of not having any functionality in components.