Main question: How is a character ability system handled in a game?
Two setups I've thought of with examples:
1) Player Character A activates ability 1 through input. Input system sends out some kind of "ActivatedAbilityOne" Event. StabAbilityComponent is tied to ability slot one and has registered to receive the event (alternatively the component could be tied directly to the slot instead of using events). It sends out a "StabAbility" event.
GameLogic and AnimationSystem listen for this event. GameLogic finds possible actors in front of Player Character A and checks the event for how much damage is caused. AnimationSystem starts the StabAnimation.
This seems feasible to me except that the GameLogic and AnimationSystem could be potentially listening to tons of specific "ability" events. Perhaps an AbilitySystem within the GameLogic to handle the events? It could then send the required info along (targets, how much damage, which animation, etc)
2) The specific ability components do the heavy lifting. Each component finds it's own possible targets and passes along to a corresponding component the needed info. For example using same basic setup as above, StabAbilityComponent is activated. It finds possible targets (in this case an actor in front of the player) and gets their HealthComponent and uses the takeDamage method. The StabAbilityComponent also sends out an animation for the AnimationSystem to play.
This way seems like it would reduce the number of events, but increase coupling between components.
Is either of these ways even close to a "correct" or possible way?
Two setups I've thought of with examples:
1) Player Character A activates ability 1 through input. Input system sends out some kind of "ActivatedAbilityOne" Event. StabAbilityComponent is tied to ability slot one and has registered to receive the event (alternatively the component could be tied directly to the slot instead of using events). It sends out a "StabAbility" event.
GameLogic and AnimationSystem listen for this event. GameLogic finds possible actors in front of Player Character A and checks the event for how much damage is caused. AnimationSystem starts the StabAnimation.
This seems feasible to me except that the GameLogic and AnimationSystem could be potentially listening to tons of specific "ability" events. Perhaps an AbilitySystem within the GameLogic to handle the events? It could then send the required info along (targets, how much damage, which animation, etc)
2) The specific ability components do the heavy lifting. Each component finds it's own possible targets and passes along to a corresponding component the needed info. For example using same basic setup as above, StabAbilityComponent is activated. It finds possible targets (in this case an actor in front of the player) and gets their HealthComponent and uses the takeDamage method. The StabAbilityComponent also sends out an animation for the AnimationSystem to play.
This way seems like it would reduce the number of events, but increase coupling between components.
Is either of these ways even close to a "correct" or possible way?