First off, I know the system isn’t really supported for general use, is undocumented, not finished, etc.
I’m looking for a way to implement Gameplay Effects with modifiers that change over the duration of the effect. An example would be Phase’s R from Paragon, Hyperflux:
The decaying movement speed boost is exactly what I’m looking for. The effect is applied, boosting movement speed attribute by x amount, and fades down to 0 over the duration of the effect.
My first idea was to use periodic executions to update the modifier, but turns out if you have a periodic effect the modifiers are essentially treated as instant and permanent, so it keeps updating the base attribute every execution rather than a modifier like I would expect.
I then dug around in source and found out that attribute modifiers can dynamically recalculate themselves based on dependencies updating, where I assumed they were only calculated once on effect application. Simple example of this would be a damage boost based on your health - when your health attribute changes, the damage modifier is notified and recalculates the magnitude of the attribute. This can be done with attribute-based modifiers and also mod magnitude calculation classes that capture attributes.
The other nice thing is that it looks like the recalculation can be triggered by external dependencies, meaning you could have the calculation class for the modifier determine exactly when the magnitude should be recalculated, so in the case of what I want it could just recalculate every 0.1 seconds or so after the application. It also looks like the recalculation happens on predicting clients too - awesome!
The only remaining problem is how to actually determine how long the effect has been active for inside the mod magnitude calculation. It gets access to the effect spec that created it, but as far as I can tell that’s not very useful in this case since the information is only on the Active Effect and there’s no reference to that. We don’t have the target actor / ability system either which means we can’t use the spec to find the active effect.
I could put the target or effect application time in the context, but that doesn’t feel too robust considering the same spec can potentially be applied to multiple targets at different times so they would override each other in that case.
Maybe I’m missing something that would make this easier? How would Paragon be doing it?
Any help appreciated!