Hi,
Trying to wrap my head around basic Entity Component System design principles and how to model a simple weapon / combat system within ECS. Consider a simple case containing the following entities: Human, Goblin, NormalSword, MagicSword where the two different swords have unique specialized implementations. Humans can carry one of the sword types if he has found any, and choose to attack a Goblin if encountered.
Some questions:
1. How would you represent the weapon being wielded by the Human? By a “Wielded” component on the Human containing the ID of the NormalSword or MagicSword entity he is carrying?
2. How would you handle combat? My first thought was to add a “Combat” component to the Human when combat starts and then have separate systems for each weapon type and have those weapon systems traverse all entities that currently have a “Combat” component AND a “weapon of the type associated with the system”. But I'm stuck on “weapon of the type associated with the system”… what would that really mean? The weapons are entities, not components so that would not work…. the Humans carrying weapons would all have a “Wielded” component containing a reference to the weapon which would make it really ugly to iterate through and does not seem like the ECS way to do it?
Any feedback on the questions or suggestions for completely different ways to do it would be appreciated
Cheers