I've been working on how to build some of my game systems using components and systems. I'm having a little trouble following the approach that components should just be bags of data and systems should implement the logic. It'd seem for this to be true you have to limit the complexity of the components or somehow make the system aware of all possible complexity.
For example, I have equipment in my game that characters can equip. Equipment has an "Item" component that has an item name, description, value etc. and allows me to identify it as an item for the purpose of character inventory, etc. That's simple enough.
Here's my problem though. Equipment also needs to be "equippable". Originally, I implemented it as something like this:
class EquipComponent : public Component
{
public:
virtual bool equip(Entity* character) = 0;
virtual bool unequip(Entity* character) = 0;
};
then I'd export this class to my scripting engine, and I'm free to have equip/unequip do whatever I want to the character they're being equipped too.
When I try to implement this component as just a bag of data, it just seems so limited. If I want the equipment to increase stats, I can add an array of stat adders/multipliers. If I want to have equipment add status effect resistances, I can add a table for that. If a piece of equipment has different effects for different weatrers, now I have to add data on a per user basis. Suddenly my simple bag of data has gotten massive. I could split it into seperate components, but now my system needs to be aware of every possible component that can change how an item is equipped.
I can see problems like this popping up in a lot of potential components/systems, so I was wondering how one can decouple the components and systems? Am I thinking too rigidly that most component logic should be handled by systems? As much as this is a learning experience, I would like to have something I can use for more than one project and that has good scalability.
Any insight or advice would be appreciated!