Melee Combat System on the Gameplay Ability System (GAS)
Documentation Unreal Engine Player Combat Gameplay Ability System Tutorial
A GAS melee combat system for Unreal Engine 5: each move a predicted gameplay ability, combos in a visual graph, hit cues, effects and events, set up in Blueprint.
The Gameplay Ability System gives Unreal Engine abilities, tags, effects, cues and prediction, and leaves the fighting to you: it has no combo system, no weapon traces, no parry and no lock-on. Universal Player Combat is that combat layer, built on GAS. Each move runs as a gameplay ability, states and inputs are gameplay tags, and a landed hit plays gameplay cues, applies gameplay effects and sends gameplay events.
It targets Unreal Engine 5.6, 5.7 and 5.8, and the GAS parts below run the same in single player, on a listen server and on a dedicated server.
What the plugin does with each part of GAS
| GAS part | What Universal Player Combat does with it | Page |
|---|---|---|
| Gameplay abilities | Each move in an action graph runs as its own predicted ability. Lock-on, interaction, sprint and dropping an item are abilities too. | Action Graph |
| Ability System Component | Sits on the character, or on the PlayerState to keep a player's abilities across respawns. | Getting Started |
| Ability sets | An Ability Set grants abilities and binds each to an input tag and a key. A drawn weapon grants its own sets while it is drawn. | Input |
| Gameplay tags | Inputs (UPC.Input.LightAttack), states (UPC.State.Blocking, UPC.State.LockedOn) and hit results (UPC.DamageResult.Parried). Every gate, condition and defense reads them. | Combo System |
| Gameplay effects | Each cooldown use applies a gameplay effect as its timer, and a parry can apply one that opens a counter window. | Gates, Costs and Cooldowns |
| Gameplay cues | Sparks, blood and sounds on a hit, with a variant per surface struck. The attacker's cues play at contact. | Damage and Hit Effects |
| Gameplay events | A landed hit sends an event that starts a flinch, a stun or a parry recoil ability. | Hit Reactions |
| Attribute sets | A move can spend an attribute your project already defines, in place of a Vitals pool. | Gates, Costs and Cooldowns |
| Prediction | A move starts on the player's machine at the press and the server confirms it, or rolls it back. | Multiplayer Melee Combat |
Health, stamina and stance live on the UPC Vitals component rather than in an attribute set, so a character needs no attribute set to fight; they replicate on their own.
Bind an ability of your own into the fight
An ability you write in Blueprint answers a key next to the plugin's moves, and can cut a running attack.
Set it up
5 minutes- 1
Make the ability
Create a Blueprint class whose parent is Gameplay Ability,GA_MyWarCry. In its event graph, play a montage with Play Montage and Wait and call End Ability from its On Completed, On Interrupted and On Cancelled pins. - 2
Bind it to a key
Duplicate the demo'sAbilitySet_UPC_Default, which holds lock-on, interaction, sprint and the rest, asAbilitySet_MyCharacter, and add a row: AbilityGA_MyWarCry, Input TagUPC.Input.Special, Input Action an action of your own,IA_WarCry, mapped to a key in a mapping context the player has. Tick Interrupts Action Graph so the ability cuts a running attack as it starts.AbilitySet_MyCharacter▾Granted Gameplay Abilities > Index [ n ]AbilityNoneInput TagNoneInput ActionNone▾Interrupts Action Graph - 3
Grant the set
On your copy ofBP_UPC_Character, or any character built on UPC Character Base, set Starting Ability Set in the Class Defaults toAbilitySet_MyCharacter. The character grants the set's abilities and binds their keys when it is possessed. A character that keeps its own parent has no such slot: add the set to Ability Sets to Grant on its Default Item's Equippable fragment, which grants it while that item is drawn (Input). - 4
Press it mid-combo
Press Play, start a combo and press the key: the attack stops and the war cry plays. A press the ability's cooldown or cost refuses cuts nothing.
When a move of the drawn weapon's graph and an ability listen for the same input tag, the graph asks first (Input lists who answers when). To run an ability as a move inside a combo instead, give a graph card the Trigger Ability / Event payload, which activates abilities by tag or sends a gameplay event (Action Graph).
Start an ability from a hit
A hit reaction is a gameplay ability that a landed hit starts by sending it a gameplay event. A UPC Send Gameplay Event row in a Defense Rule Set's Outcome Effects sends
UPC.Event.Reaction to the character struck, and an ability with that tag as its trigger answers: it cuts the character's attack and plays a flinch. Gate the row on the hit's result, so a blocked or parried blow sends nothing (Hit Reactions).The same row shape sends
UPC.Event.ParryRecoil to a parried attacker, and a demo enemy's stance pool sends UPC.Event.GuardBreak as it empties, which the demo's stun ability answers (Parry, Block and Executions).AdvancedAbilities the plugin grants on its own
A character built on UPC Character Base sends a ready signal when its ability system comes up, and each feature grants the abilities that need no key: the confirmed hit ability that deals each landed hit, the draw and put-away ability, the paired action role, and the interaction payload ability. A character of your own sends the signal with Notify Ability System Ready (Character Setup).
A refused Cooldown gate reports the Gameplay Abilities Activate Fail Cooldown Tag, as an ability's own cooldown does, so a failed-activation listener can answer it.
MultiplayerGAS online
- A player's ability system replicates in Mixed mode; the UPC Character Base's own runs Mixed. Under Minimal the player's machine receives no cooldown timers.
- An ability system on the PlayerState needs a C++ PlayerState with a replicated component in Mixed mode and a raised Net Update Frequency (Getting Started).
- Unreal sends a character two gameplay cue calls per network update at most. A hit effect holds a cue past that limit for a later update, for up to a quarter of a second.
- A hit reaction ability is Server Initiated, because the event that starts it goes out on the server.
C++C++
AUPCCharacterBaseimplementsIAbilitySystemInterface;GetAbilitySystemComponentInternal(aBlueprintNativeEvent) resolves the ability system, PlayerState first.- Each action graph move runs as a
LocalPredictedability. A payload subclassesUUPCActionPayloadand overridesExecute(UUPCPayloadHostAbility& Host). UUPCAbilitySystemReady::NotifyAbilitySystemReady(Avatar, AbilitySystem)is the Notify Ability System Ready node.
Common questions
Do I need to know GAS to use it? No. The plugin creates and grants the abilities behind each move, and you wire moves and fill in items in the editor. GAS knowledge helps once you write abilities of your own.
Can I add it to a project that already uses GAS? Yes. Its components work with an Ability System Component on the character or on its PlayerState, and Character Setup adds them with the character's parent class left as it is.
Can health live in my own attribute set? Yes, through a damage path of your own: Resolve Incoming Damage on the UPC Defense component runs the parries and blocks and drains nothing, so you subtract what it lets through from your attribute (Defense).
Are cooldowns gameplay effects? Yes. Each use applies one as its timer. To shorten cooldowns from a stat, point the Cooldown gate's Effect Class at a subclass with a custom duration calculation.
Does it need C++? Nothing on this page does. An ability system kept on the PlayerState needs a C++ PlayerState, and UPC Character Movement on a character that keeps its own parent class takes C++ to set (Melee Combat Without C++).
Related
| Page | Why |
|---|---|
| Input | Keys to input tags, ability sets, and who answers a shared tag |
| Hit Reactions | A reaction ability step by step, poise and hyper armor |
| Damage and Hit Effects | What a hit is worth, cues, effects and hit stop |
| Multiplayer Melee Combat | Prediction and server-side hit checks |