In this lesson, you’ll learn how to decouple visual and audio feedback from your game logic using Gameplay Cues, ensuring consistent cross-network execution without cluttering your Ability code.
The Problem with Hard-Coded Feedback
If you trigger a particle effect or sound directly inside a GameplayAbility, you often end up with redundant code that struggles with network replication. If a server triggers an effect, it doesn't automatically fire on every client. Manually handling RPCs (Remote Procedure Calls) for every single hit impact or status effect quickly becomes a maintenance nightmare.
The Gameplay Cue Solution
Gameplay Cues act as "passive observers" of the GameplayTag system. Instead of telling an ability to "play sound X," you simply add a specific GameplayCue tag to your GameplayEffect or trigger it manually via the AbilitySystemComponent.
When the tag is added, removed, or executed, the Gameplay Ability System (GAS) automatically handles the network multicast for you. You create a GameplayCueNotify actor (usually a Static or Actor variant) that listens for a specific tag (e.g., GameplayCue.HitImpact.Fire). When the tag is broadcast, the system automatically instantiates or triggers that cue on all clients.
Implementation Pattern
You don't write logic inside the ability to trigger these; you associate them with your Gameplay Effects or invoke them via the ASC:
// Instead of custom RPCs, use the GameplayCue system:
FGameplayCueParameters CueParams;
CueParams.Location = HitResult.Location;
CueParams.Normal = HitResult.ImpactNormal;
// This triggers the cue on all clients automatically
AbilitySystemComponent->ExecuteGameplayCue(Tag_GameplayCue_FireImpact, CueParams);
By creating a GameplayCueNotify_Static class, you define the visual response in a dedicated, reusable asset. The OnExecute event within the Notify class acts as the bridge, playing your Niagara system or sound cue based on the provided FGameplayCueParameters (like location or normal). Because the tag itself is what propagates, the logic remains completely decoupled: your ability doesn't need to know what happens when a fire effect hits, only that the "FireImpact" event occurred.
Key Takeaway: Gameplay Cues decouple visual and audio feedback from game logic by using Gameplay Tags to automatically multicast notifications across the network, eliminating the need for manual RPCs.