Skip to main content

Effects and animation

An ability's and a basic attack's effects are Gameplay Cues: the cast, the projectile's flight, each hit, the area it lands, and a buff or a stun on the unit for as long as it lasts. Each cue plays a Niagara system on players' games only, so effects never slow the server. The framework fires the cues; a cue notify asset says what plays.

Units animate from four clips in their definition, with no Anim Blueprint graph: idle, move, attack and death, plus a clip per ability.

The moments​

MomentWhere it is setWhen it plays, and whereDuration it gets
CastAbility Definition > Effects > Cues > CastAs the cast starts, on the casterthe cast time; for a charged ability, plus the longest it can be held
TravelCues > TravelOn the projectile while it fliesthe flight
HitCues > HitOn each unit hit, when the server hits it0
AreaCues > AreaWhere an area ability or a blink lands; as a charged ability is released; around a channel for as long as it lasts0, or the channel
EffectEffects > an entry's CueOn the unit, for as long as that effect lasts: a buff's aura, a stun's starsthe effect's
Attack wind-up, flight, hitChampion, Minion, Monster or Structure Definition > Attack CuesAs a basic attack starts, on its projectile, on the unit hitthe wind-up, the flight, 0

A Blueprint ability plays the same cast, hit and area cues through the base class, and can play any cue of its own with Play Cue.

Who sees what​

  • The caster's own game plays a predicted cast's cues at once. Everyone else plays them when the server's arrive.
  • Hits, effects, and every cue of a cast that waits for the server, are the server's: they reach every game, the caster's included, a round trip after the cast.
  • Each game plays the travel cue on its own copy of the projectile.
  • A dedicated server plays no cue at all.
  • Cues follow the fog of war. A champion's cues travel through the champion, so only the players whose team sees it get them. A champion's lasting cues (a buff's aura, a channel's area) come with it when it comes into sight.

Make an effect​

  1. Make the Niagara system. Give it the user parameters it needs from the table below, with these names and types, and read them in its modules. One system then fits every size of ability.

  2. Make the cue notify: a Blueprint of Niagara Cue (Burst) (UMobaNiagaraCueBurst) for a cast, a hit or an area, or of Niagara Cue (Looping) (AMobaNiagaraCueLoop) for a trail, an aura or a channel's area. Set its Gameplay Cue Tag and its Effect, and whether it follows the unit (Attach To Unit, with a socket if wanted). A burst system should end by itself; a looping one stops spawning when the cue ends.

  3. Keep the notify in a folder the Gameplay Ability System scans. Add your project's folders in DefaultGame.ini:

    [/Script/GameplayAbilities.AbilitySystemGlobals]
    +GameplayCueNotifyPaths="/Game/Effects"
  4. Name the tag in the Ability Definition (or the attack's definition). The tag must exist: add it in Project Settings > Gameplay Tags under GameplayCue.

A cue notify can do more than play Niagara: a sound, a camera shake, a decal. Any Gameplay Cue notify works with the same tags; Spawn Cue Effect and Get Cue User Parameters help a Blueprint one.

The user parameters​

NameTypeValue
User.Radiusfloat, cmthe ability's Radius: an area's size
User.Lengthfloat, cmits Range: a skillshot's or a cone's length
User.Widthfloat, cmits Width: a skillshot's width
User.Anglefloat, degreesits Angle: a cone's spread
User.Durationfloat, show long the moment lasts
User.TeamColorlinear colorthe team color of the unit that made the effect
User.IsEnemybooltrue when that unit is an enemy of the player watching; enemy areas get a thin red rim from it
User.Chargefloat, 0 to 1how far a charged ability was charged when it was released
User.FeetHeightfloat, cmhow far below the effect the ground is. Draw shapes that lie on the ground at -FeetHeight

A basic attack has no Ability Definition, so its cues have no sizes. A wall's Niagara components get the wall's size as User.Length, User.Width and User.Height.

The sample's cues​

The cue notifies are the sample's, in /PioneerMOBA/Sample/GameplayCues, which the plugin's config tells the Gameplay Ability System to scan; the framework's own attack and ability clips play through cues that need no notify. Unreal Engine 5.8 does not read a plugin's tag files, so the sample's cue tags are defined in C++:

  • GameplayCue.Sample.<Champion>.<P|Q|W|E|R|Attack>.<Cast|Travel|Hit|Area|Effect>, one per moment of each sample champion's kit;
  • GameplayCue.Sample.State.<Stun|Slow|Root|Silence|KnockUp|Taunt>, the crowd control every champion shares;
  • the minions', towers', monsters', summoner spells', recall's, potion's and ward's cues.

The framework's own minions, structures and spells name the sample's cues, and their notifies sit in the Sample folder. A project without the Sample folder plays no effects for them until it adds notifies of its own. Your project's own tags work as always, in Project Settings or DefaultGameplayTags.ini.

Team colors​

Project Settings > Pioneer MOBA Framework > Effects: Blue Team Color (sRGB 47, 111, 208), Red Team Color (sRGB 200, 64, 46) and Neutral Color (sRGB 176, 168, 150), for User.TeamColor and the minions' TeamColor material parameter.

Unit animations​

A unit's mesh can play its clips with no Anim Blueprint: idle while it stands, move while it walks, its attack at each basic attack and its death when it dies, blending from one to the next. Minions, champions and jungle monsters all play through it.

  1. Give the unit's Blueprint a skeletal mesh and leave its Anim Class empty.
  2. In the unit's definition (Champion, Minion or Monster Definition), fill in Animation:
FieldWhat it doesDefault
IdlePlays, looping, while the unit standsnone
MovePlays, looping, while the unit moves, faster or slower with its speednone
Move Clip SpeedThe speed at which the Move clip's feet keep to the ground300 cm/s
AttackPlays once at each basic attack, timed so its blow lands when the wind-up endsnone
Attack Impact TimeHow far into the Attack clip the blow lands; 0 takes the clip's middle0 s
DeathPlays once when the unit dies; its last frame holds while the body staysnone
Blend TimeHow long one clip takes to blend into the next0.15 s

When the unit begins play and its mesh has no Anim Class, the mesh gets Moba Unit Anim Instance, which plays these. A mesh with an Anim Blueprint of its own keeps it, and the definition's clips are then not used. All clips must be on the mesh's skeleton; saving the definition reports a clip on another one.

Abilities and attacks​

  • Move or stand follows how fast the unit goes over the ground, so it is right for minions too. Moving at twice Move Clip Speed plays the clip twice as fast.
  • Attack starts on every game that plays the attack's wind-up cue, at the rate that brings its Attack Impact Time to the end of the wind-up. A champion's own game plays it at once, with its predicted attack.
  • An ability plays its Ability Definition's Cast Clip on every game that sees the cast. Clip Effect Time is the moment in the clip the ability fires at: the part before it is fitted to the cast time, and an ability without a cast time starts its clip there. A charged ability holds its Charge Clip's last frame while its key is held. A passive that empowers attacks plays its Cast Clip for the empowered attack.
  • A dedicated server poses nothing. A minion out of the camera's view stops posing until it is seen again.

Gear and team color​

A minion's or a champion's Blueprint can dress the body with parts of its own:

  • Skinned parts follow the body. Every other skeletal mesh component with no Anim Class of its own (a tabard, a cowl, a cloak skinned to the body's bone names) takes the body's pose each frame, so it needs no animation of its own.
  • Rigid gear goes on a socket. Attach a static mesh, such as a sword, to a socket of the body with its Parent Socket in the Details panel.
  • Every mesh of a minion shows its team's color. Each mesh's materials get the vector parameter TeamColor. Mask the parts of a material that should show the team to that parameter. Champions don't: they read by their own colors, and the health bar shows the team.

A unit class of your own gets the same with MobaUnitLook::FollowBody(*this, Mesh) and MobaUnitLook::ShowTeamColor(*this, Color) in its BeginPlay, and plays its clips by implementing IMobaUnitInterface::GetUnitAnimations() and calling UMobaUnitAnimInstance::UseFor(Mesh, GetUnitAnimations()).