I am attempting to design a combat system that is commonly seen in MMORPGs, but I’m not sure if I am approaching it the right way. The behaviour I want is as follows: Mobs idle and as a party of player controlled characters approaches, the mobs detect the player characters and engage in combat. During the combat the mobs switch target as the player characters generate various amount of threat or die. When all the player characters are dead, they reset.
What I am having trouble with are the following aspects:
Listening for actions.
Right now each character has a triggerbox that represents their aggro range, I suppose.
Even if only the relevant collision settings are set, I wonder if this is an acceptable way to detect things? Are there any other methods?
With state I mostly mean if a target is alive or dead.
To be able to switch target when the target dies or otherwise becomes an invalid target, all possible targets needs to be tracked, because that also means being informed of when a possible target becomes invalid, say if they die. The way I do this now is - as a target is detected, they bind to an ondeath dispatcher.
I’ve thought about maybe having some kind of combat manager - similar to a party manager - to track things but I don’t know which would be the ‘better’ option.
Or, Instead of listening to a dispatcher, I’ve instead thought of having an OnDeath-spell happen, which would be similar to an area damage spell but instead of damage, provides information about a death event.
- Listening for actions.
Mostly i’m thinking of a healing action which should add threat to any mob that has the healed player character detected.
Again, in order to track if a player character is healed, each mob needs to listen to each player character.
Very similar problem to tracking state.
So in a situation like above, where two groups fight each other, how should these aspects be handled? Is listening to dispatchers a good way? Because I feel like it’s not that extendable to new features. I know that really, if implemented right any of these systems would *work *but i’m looking for a solid design that doesn’t get overwhelmed with new features.
Thanks for any insight.