The issue
Sometimes we want a simple effect, that only triggers a simple effect on Init. Currently, we're using a full modifier object for such simple logic. It'd be much more efficient to only directly use the aforementioned simple effect, and skip the entire modifier setup.
Possible issues with the feature
If we want some basic checks like cooldown to work, we still need to store the effect in some kind of wrapper, and therefore another pool.
Sending/setting up future UI info might become a problem, since modifiers are directly stored in the unit, modifier-less effects would need to send a UI event/trigger themselves each time we're adding them. Which might become an issue.
Implementation
It would require a new API in ModifierController, and maybe in IModifierOwner or IUnit to feed the desired target for the effect. Effects would also need their own IDs and pooling if we should preserve state.
Performance
Initial benchmarking shows that a modifier-less Init damage effect is 4± times faster than modifier-based Init damage.
With a single array by ID lookup, and take damage effect. Modifier-less effects would also not store any mutable state, meaning there would be only one instance of each one (making it possible for them to be structs as well).
The issue Sometimes we want a simple effect, that only triggers a simple effect on
Init
. Currently, we're using a full modifier object for such simple logic. It'd be much more efficient to only directly use the aforementioned simple effect, and skip the entire modifier setup.Possible issues with the feature If we want some basic checks like cooldown to work, we still need to store the effect in some kind of wrapper, and therefore another pool.
Sending/setting up future UI info might become a problem, since modifiers are directly stored in the unit, modifier-less effects would need to send a UI event/trigger themselves each time we're adding them. Which might become an issue.
Implementation It would require a new API in
ModifierController
, and maybe inIModifierOwner
orIUnit
to feed the desired target for the effect. Effects would also need their own IDs and pooling if we should preserve state.Performance Initial benchmarking shows that a modifier-less Init damage effect is 4± times faster than modifier-based Init damage. With a single array by ID lookup, and take damage effect. Modifier-less effects would also not store any mutable state, meaning there would be only one instance of each one (making it possible for them to be structs as well).