ue-gameplay-abilities
Use when implementing or debugging the Gameplay Ability System in C++ — abilities, effects, attributes, cues and the AbilitySystemComponent. Also use when the user mentions 'GAS', 'UGameplayAbility', 'ActivateAbility', 'CommitAbility', 'UGameplayEffect', 'UAttributeSet', 'FGameplayAttributeData', 'AbilitySystemComponent', 'InitAbilityActorInfo', 'GiveAbility', 'TryActivateAbility', 'ability task', 'GameplayCue', 'cooldown', 'cost', 'buff', 'debuff', 'damage execution' or 'ASC on PlayerState'. For montage playback, see ue-animation-system; for replication modes and prediction, see ue-networking-replication.
quodsoler · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add quodsoler/unreal-engine-skills --skill ue-gameplay-abilitiesAbout this skill
name: ue-gameplay-abilities description: "Use when implementing or debugging the Gameplay Ability System in C++ — abilities, effects, attributes, cues and the AbilitySystemComponent. Also use when the user mentions 'GAS', 'UGameplayAbility', 'ActivateAbility', 'CommitAbility', 'UGameplayEffect', 'UAttributeSet', 'FGameplayAttributeData', 'AbilitySystemComponent', 'InitAbilityActorInfo', 'GiveAbility', 'TryActivateAbility', 'ability task', 'GameplayCue', 'cooldown', 'cost', 'buff', 'debuff', 'damage execution' or 'ASC on PlayerState'. For montage playback, see ue-animation-system; for replication modes and prediction, see ue-networking-replication." metadata: version: "2.0.0" engine: "5.8"
UE Gameplay Ability System
Target engine: UE 5.8. APIs below are verified against the 5.8 headers; older forms are listed under "Deprecated — do not use".
GAS ships as the GameplayAbilities plugin (Engine/Plugins/Runtime/GameplayAbilities), which is production-ready, not Experimental. Enable it in the .uproject, then add "GameplayAbilities", "GameplayTags" and "GameplayTasks" to PublicDependencyModuleNames in your module's Build.cs. This skill covers UAbilitySystemComponent, UGameplayAbility, UGameplayEffect, UAttributeSet, UAbilityTask and Gameplay Cues.
Context
Read .agents/ue-project-context.md if it exists (module names, conventions, enabled plugins, GAS/networking setup). Do not stop if it is missing.
Identify the area from the request and the codebase. Ask only when two plausible readings would produce different code.
| Request is about… | Go to |
|---|---|
| Where the ASC lives, init order, respawn, replication mode | ASC Ownership and Initialization |
| Writing an ability, activation, cost, cooldown, policies | Gameplay Abilities |
| Waiting on montages, events, targeting, timers, tag queries | Ability Tasks |
| Damage, buffs, stacking, executions, immunity, GE components | Gameplay Effects |
| Health/mana floats, clamping, attribute replication | Attribute Sets |
| Tags that block, grant or cancel abilities; loose tags | Tags in GAS |
| Particles, sounds, hit impacts, cue notify classes | Gameplay Cues |
| Cue scan paths, global curve tables, project config | Project Settings |
GAS Architecture
| Pillar | Class | Header | Purpose |
|---|---|---|---|
| Component | UAbilitySystemComponent | AbilitySystemComponent.h | Owns abilities, effects, attributes, tags |
| Abilities | UGameplayAbility | Abilities/GameplayAbility.h | What happens when activated |
| Effects | UGameplayEffect | GameplayEffect.h | Data-driven attribute mutation |
| Attributes | UAttributeSet | AttributeSet.h | Replicated FGameplayAttributeData stats |
| Tasks | UAbilityTask | Abilities/Tasks/AbilityTask.h | Latent steps inside an ability |
Gameplay tags thread through all of them as requirements, grants and blockers.
ASC Ownership and Initialization
| Owner | When | Notes |
|---|---|---|
APlayerState | Networked player characters | ASC survives pawn death; use Mixed replication |
APawn / ACharacter | AI, single-player | Simplest; use Minimal for AI, Full if a pawn-owned ASC needs full data on all clients |
Every actor that owns or exposes an ASC implements IAbilitySystemInterface:
// MyCharacter.h
#pragma once
#include "GameFramework/Character.h"
#include "AbilitySystemInterface.h"
#include "MyCharacter.generated.h"
class UAbilitySystemComponent;
UCLASS()
class MYGAME_API AMyCharacter : public ACharacter, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
AMyCharacter();
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "GAS")
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
};
// MyCharacter.cpp
#include "MyCharacter.h"
#include "AbilitySystemComponent.h"
AMyCharacter::AMyCharacter()
{
AbilitySystemComponent = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
AbilitySystemComponent->SetIsReplicated(true);
AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
}
UAbilitySystemComponent* AMyCharacter::GetAbilitySystemComponent() const
{
return AbilitySystemComponent;
}
InitAbilityActorInfo(OwnerActor, AvatarActor) must run on both server and client. For a pawn-owned ASC that is BeginPlay with (this, this). For a PlayerState-owned ASC it is PossessedBy on the server and OnRep_PlayerState on the client, with (PlayerState, Character). Full dual-path code, respawn handling and the AI variant are in gas-setup-patterns.md.
EGameplayEffectReplicationMode | Effect on simulated proxies |
|---|---|
Minimal | No GE replication; minimal tag/cue data only. AI and non-player actors |
Mixed | Full GEs to the owning connection, minimal to everyone else. Player characters |
Full | Every GE replicates to every client |
Mixed sends full GE data to the connection that owns the ASC's owner actor (GameplayEffect.cpp:5240), so it works for a PlayerState-owned ASC and for a pawn-owned ASC once a PlayerController possesses the pawn. Choosing Full over Mixed is a bandwidth decision, not a correctness one. Minimal does not work for player-owned ASCs (AbilitySystemComponent.h:83). See ue-networking-replication for what each mode costs on the wire.
Gameplay Abilities
// MyFireballAbility.h
#pragma once
#include "Abilities/GameplayAbility.h"
#include "MyFireballAbility.generated.h"
class UGameplayEffect;
UCLASS()
class MYGAME_API UMy
Read the complete source ↗