GameplayAbilities and you

I do charged attacks and had a couple of issues. Maybe there’s a better way, but all of my abilities are charged, and are split between vector cast and non-vector cast (ie. some spells are directional, others just use the caster’s direction or ignore direction altogether). I initially implemented charge as an attribute, but in order to have it increase along with the gametime I have to have a short period on an effect that increases it. I found 0.1s was bearable but still not exactly smooth for the purposes of updating UI elements. The problem is that attributes are replicated, and with 40 characters all replicating an attribute every 0.1s to each other the replication load was insane. I had to remove that and instead increase a float in tick when the charging tag is added, and reset back to 0 when it’s not there. This means I only have to replicate the charging tag (plus a paused tag in my case). The charge ability is added completely separate to the rest of the ability system, and all abilities that require charge require that tag to be added in order for the ability to be activateable. So actually the only ability the player can use is the one to start charging, and then the other abilities are available after that. The final note is that the player is generally very sensitive to charge times, particularly if you have different charging tiers that do different things, so I actually ended up using the client’s Charge and sending it to to the ability cast via the targeting actor, then on the server it checks that it’s within 200ms to prevent cheating. This prevents the user from putting in whatever time they like, but also means that (very) high ping users won’t be able to use charge abilities.

If you’re charging things that also may mean you don’t want static values in your gameplay effects. You have two options for setting values at runtime here: SetByCallerMagnitude and Level. I originally did the former, and it works perfectly well, but similar to the charging issues it creates extra replication load, as each effect you use SetByCallerMagnitude on will now have an extra entry in its array, and that gets replicated to all clients. So if you’re setting damage or something that way it can really add up. I originally did it this way because I wanted to use Level for the ability level, but I realised I can just incorporate that calculation in the ability itself and it’s easier. I made a simple MagnitudeCalculation class that returns the magnitude as the level, and using that I can also set the duration via the level of the effect. This is good for something like ‘Chill’ where the character is slowed a static amount, but I want to have different abilities apply different durations of chill. If you need both runtime-set duration and magnitude then you’ll have to use SetByCallerMagnitude.