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
| Moment | Where it is set | When it plays, and where | Duration it gets |
|---|---|---|---|
| Cast | Ability Definition > Effects > Cues > Cast | As the cast starts, on the caster | the cast time; for a charged ability, plus the longest it can be held |
| Travel | Cues > Travel | On the projectile while it flies | the flight |
| Hit | Cues > Hit | On each unit hit, when the server hits it | 0 |
| Area | Cues > Area | Where an area ability or a blink lands; as a charged ability is released; around a channel for as long as it lasts | 0, or the channel |
| Effect | Effects > an entry's Cue | On the unit, for as long as that effect lasts: a buff's aura, a stun's stars | the effect's |
| Attack wind-up, flight, hit | Champion, Minion, Monster or Structure Definition > Attack Cues | As a basic attack starts, on its projectile, on the unit hit | the 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
-
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.
-
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. -
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" -
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
| Name | Type | Value |
|---|---|---|
User.Radius | float, cm | the ability's Radius: an area's size |
User.Length | float, cm | its Range: a skillshot's or a cone's length |
User.Width | float, cm | its Width: a skillshot's width |
User.Angle | float, degrees | its Angle: a cone's spread |
User.Duration | float, s | how long the moment lasts |
User.TeamColor | linear color | the team color of the unit that made the effect |
User.IsEnemy | bool | true when that unit is an enemy of the player watching; enemy areas get a thin red rim from it |
User.Charge | float, 0 to 1 | how far a charged ability was charged when it was released |
User.FeetHeight | float, cm | how 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.
- Give the unit's Blueprint a skeletal mesh and leave its Anim Class empty.
- In the unit's definition (Champion, Minion or Monster Definition), fill in Animation:
| Field | What it does | Default |
|---|---|---|
| Idle | Plays, looping, while the unit stands | none |
| Move | Plays, looping, while the unit moves, faster or slower with its speed | none |
| Move Clip Speed | The speed at which the Move clip's feet keep to the ground | 300 cm/s |
| Attack | Plays once at each basic attack, timed so its blow lands when the wind-up ends | none |
| Attack Impact Time | How far into the Attack clip the blow lands; 0 takes the clip's middle | 0 s |
| Death | Plays once when the unit dies; its last frame holds while the body stays | none |
| Blend Time | How long one clip takes to blend into the next | 0.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()).