Patterns

Documentation Unreal Engine Player Combat Recipes

Recipes built on the demo: the three combat styles, a parry and a block, a counter, a shield bash, a dodge with two charges, an execution, a door and a chest, and a heavy that shrugs off hits.


Build on copies of the demo assets: a plugin update replaces the plugin's content, edits included. Turn on Show Plugin Content in the Content Browser's settings to see the Demo folder.

Three combat styles

A style plate at the end of the hallway switches the player's Combat Style and loadout and opens its arena.
StyleLoadoutFeel
CombatStyle_UCF_OverShoulder (the start)Sword and shieldFaces the camera, attacks straight ahead, close shoulder camera.
CombatStyle_UCF_FreeflowBare fistsStrikes aimed by the stick, no lock-on; the right mouse button guards.
CombatStyle_UCF_SoulslikeTwo swordsFaces where it moves, attacks where it faces, the target while locked.
For a fourth, duplicate the nearest style and change one fragment at a time; BP_UCF_StylePlate calls Set Style on the Combat component, then adds the new items.

A parry and a block

The demo sword (Soulslike plate) parries a blow when Guard is pressed as it lands, and blocks while Guard is held. Item_UCF_Sword's Guard fragment (the item part that supplies a defense set) lends DefenseRuleSet_UCF_Sword, which holds two UCF Guard rules with the parry first:
FieldParryBlock
Required Defender TagsUCF.State.ParryingUCF.State.Blocking
Arc Half Angle Degrees4560
Damage Multiplier00
Blocked Attack TagsUCF.Attack.UnparryableUCF.Attack.Unblockable
Result TagUCF.DamageResult.ParriedUCF.DamageResult.Blocked
Cost Vital TagUCF.Vital.StanceUCF.Vital.Stance
Cost Per Damage0.51
Spend Remainder when Unaffordableonon
Guarding spends stance, the large pool that stuns its owner when it breaks. A parried 10-damage blow costs 5 stance, a blocked one 10, and no health. With 4 stance left, the parry spends those 4 (Spend Remainder when Unaffordable) and then declines the blow, which falls through to the responses below it: the 4 stance is spent and the blow is not parried; the next rule decides what it does.
  1. Make a Defense Rule Set (UCF, Damage and Defense) with the two rules, parry first, and set it as your weapon's Guard fragment Defense Set.
  2. In the weapon's graph, wire Guard into a raise node, the raise's Action Completed into a Hold node with Applied Tags UCF.State.Blocking, and Guard released out of both into a lowering node.
  3. On the raise montage, add a UCF State Tag Window holding UCF.State.Parrying over the frames that parry.
AG_UCF_Sword does this with Interrupt transitions from idle and each light attack; AM_UCF_Sword_Parry parries for the raise's first quarter second, a held guard as long as a tap (Defense).
AdvancedThe recoil and the counter window
  • A parried attacker recoils. The rule set's Outcome Effects send UCF.Event.ParryRecoil to the attacker, which GA_UCF_ParryRecoil answers; AbilitySet_UCF_Default grants it to the player, and each demo enemy carries it in its Starting Abilities (Hit Reactions).
  • A counter window. A UCF Apply Gameplay Effect outcome applies GE_UCF_CounterWindow on a parry, holding UCF.State.CanCounter on the defender for half a second. Put that tag in a transition's Required Tags for a move that only follows a parry.

A counter

In the Freeflow arena, Guard while a counter marker shows over an enemy's first or second punch plays a paired counter. Otherwise Guard plays Failed Guard Attempt, a guard animation that blocks nothing.
One tag chain ties the three assets together:
AssetHoldsSays
AM_UCF_Unarmed_Combo, trace windowExtra Damage Tags UCF.Attack.Counterable.AThis punch is a counterable one, variant A.
AM_UCF_Unarmed_Combo, UCF Telegraph Window before itTags UCF.Attack.Counterable, Find The Attack Automatically onHold the trace window's tags on the enemy while it winds up, and show the marker (TelegraphStyle_UCF_Default).
PairedActionSet_UCF_Unarmed, rowRequired Target Tags UCF.Attack.Counterable.APlay Paired_UCF_Unarmed_Counter_A, the player as Defender; .B plays _B.
The enemy's role has Sync with Current, taking over the punch at the Sync UCF Paired Sync Marker. In AG_UCF_Unarmed, Guard leaves idle and every punch on two Interrupt transitions:
TransitionPriorityGateLeads to
The counter10Paired Action Available with the setPlay Paired Action, Source Paired Action Sets
The fallback0Blocked Tags UCF.State.ActionRunningFailed Guard Attempt
Step by step: Paired Actions.

A shield bash

With sword and shield drawn (Over Shoulder plate), hold Guard, let go, and press it again within a quarter second: the shield bashes for 100 stance and no health.
Node in AG_UCF_ShieldPayloadLeads on
Guard HoldHold, Applied Tags UCF.State.BlockingGuard released: Guard Lower
Guard LowerDelay, Delay Seconds 0.25Guard pressed: Shield Bash; Action Completed: idle
Shield BashPlay Montage AM_UCF_Shield_BashAction Completed: idle
  • Whose moves. Item_UCF_Shield has Main Weapon off, so with both drawn the sword's AG_UCF_Sword gives every move.
  • Where the guard comes from. AG_UCF_Sword folds AG_UCF_Shield in as a sub graph. Its Entry Required Tags UCF.Equipment.Shielded, the tag the drawn shield puts on the character, adds the shield's moves only while the shield is out; Priority Bias 20 lets its Guard win over the sword's.
  • The block. The shield's own Guard fragment lends DefenseRuleSet_UCF_Shield, a block on UCF.State.Blocking.
  • The bash. It deals Damage_UCF_Shield, its stance under Additional Vital Damage.

A dodge with two charges

Two dodges in a row, then a wait; each spends stamina.
  1. In your weapon's graph, add a node Dodge playing AM_UCF_DodgeBack, which holds UCF.State.Intangible from 0.17 to 0.95 seconds; a melee trace with the default Pass Through Tags passes through it.
  2. Under its Gates, add Cooldown: Cooldown Tag UCF.Cooldown.Ability.Dodge, Seconds 3, Charges 2.
  3. Under Costs, add Vital: Vital Tag UCF.Vital.Stamina, Amount 25.
  4. Wire idle and each attack to Dodge on UCF.Input.Dodge, Timing Interrupt from the attacks.
  5. Map an Input Action to UCF.Input.Dodge in the item's Input Mappings, with that action in the item's Input Mapping Context (Inputs an item brings); the demo's IA_UCF_Dash sits on Space and the left shoulder.
Each charge returns 3 seconds after its use; AG_UCF_Sword's dash uses the same gate tag and a stamina cost. Gates, Costs and Cooldowns adds a fallback move and a HUD countdown. Online, a long fast dodge needs UCF.State.Dashing in its State Tag Window as well, beside UCF.State.Intangible (see Multiplayer).
This dodge is a move in the action graph, so it cannot break out of an interaction, which shuts the graph; that takes a dodge granted as an ability of its own (Let a dodge break out).

An execution

The hallway's paired stations loop Paired_UCF_Sword_Execute_A, Paired_UCF_Sword_Execute_B (one against two, with an authored camera) and Paired_UCF_Unarmed_Execute_A; on the ring marked (you), E plays one. The Soulslike arena's boss dies to Paired_UCF_Sword_Execute_A, which anchors on the Victim and turns it toward the Attacker, so the stunned boss holds its place while the player slides in, and a Disarm event on the Victim at the first slash knocks one of its swords to the ground. In a fight, the unarmed demo executes a stunned enemy:
  • The stun. A demo enemy's Stance row sends UCF.Event.GuardBreak as it empties (Depleted Gameplay Event); GA_UCF_Stun, Server Initiated in each demo enemy's Starting Abilities, answers and holds UCF.State.Staggered.
  • The gate. PairedActionSet_UCF_UnarmedExecute's row requires that tag in Required Target Tags and picks the victim with Primary Picker Current Target.
  • The press. UCF.Input.Execute (IA_UCF_Execute on the demo weapons) leads to a Play Paired Action node sourcing the set.
Building one: An execution on a stunned enemy; a marker over the stunned enemy: Telegraphs.

A door and a chest

ActorOptionsWhat makes it work
BP_UCF_DoorOpen on Interact, Kick on UCF.Input.Interact.SecondaryAM_UCF_DoorOpen, AM_UCF_DoorKick. A UCF Interaction Option Provider, it gives each character the spot on its side and the section that pulls or pushes.
BP_UCF_ChestOpen, and Break on the second keyAM_UCF_ChestOpen, AM_UCF_ChestBreak, from the spot tagged CharacterPosition (Spot Component Tag). A break throws the lid off as cosmetic pieces; the chest closes after 5 seconds.
Both follow the chest recipe. How the door answers each side: Answer per character.

A heavy that shrugs off hits

Poise is a small pool every hit drains; the hit that empties it flinches a demo character, cutting its attack short. Stance, the large pool, stuns when it breaks (Hit Reactions). Under hyper armor a swing takes half the poise damage: light hits land and it finishes, a heavy one still breaks it.
  • The window. In AM_UCF_Unarmed_Combo, the sixth punch (section 5, Punch 6 in AG_UCF_Unarmed) holds UCF.State.HyperArmor over its windup and swing through a UCF State Tag Window.
  • The bonus. DefenseRuleSet_UCF_Character opens with a UCF Scale Damage response that requires UCF.State.HyperArmor, with a Vital Damage Multipliers row: Vital Tag UCF.Vital.Poise, Multiplier 0.5.
  • The reaction. On a hit that empties poise (UCF.DamageResult.PoiseBroken) and was not blocked or parried, the set's Outcome Effects send UCF.Event.Reaction, which GA_UCF_HitReact answers, and a UCF Refill Vital fills the pool again.
On a character set up like the demo's, with a Poise row, DefenseRuleSet_UCF_Character and a flinch ability, your own heavy needs only the tag window; Hyper armor builds the rest from scratch.

More from the demo
MoveWhereHow
Dash strikeFreeflowA light attack at an enemy 4 to 8 m away: a Priority 5 transition with Target Distance Greater Than (>) 400 and Less Or Equal (<=) 800 into Strike Dash, whose montage carries a UCF Gap Closer Warp window.
VaultFreeflowSpace vaults the target: Play Paired Action with Paired_UCF_Unarmed_Vault, Primary Picker Current Target; with no target, nothing.
A swing by distanceOver Shoulder, a combo enemy holding the batonAG_UCF_TwoHanded sends a light attack to one of three swings by Target Distance: under 150, 150 to 300, or farther. Its heavy is an unblockable stomp.
Warnings over swingsEvery arenaTelegraphStyle_UCF_Default: a red cross over an unblockable swing, a blue counter marker, a yellow flare over the rest.
Enemies on action graphsOver Shoulder, SoulslikeThe combo enemies and the dual-sword boss play their item's graph through Action Graph Combo actions (Action Graphs in Action Sets).
Two swordsSoulslikeItem_UCF_Sword twice; its Hold Places list the main hand, then the off hand, and the first drawn gives the moves.
A weapon rackBeside the door and chestBP_UCF_WeaponRack is an item holder: a peg filtered on UCF.Slot.Weapon.Sword offers Take and Put Back.

Debug it

UCF.Debug.Actions 1        // Node and waiting press
UCF.Debug.Paired 1         // Paired move, role, partners
UCF.Debug.Vitals 1         // Health, stamina, stance
UCF.Debug.Targeting 1      // Target, and why
AdvancedTroubleshooting
The recipe reads wrong in play
  • No parry: the tag window misses the hit's frames, or the blow carries UCF.Attack.Unparryable. Health falling under UCF.Debug.Vitals 1 means no rule claimed the hit.
  • No counter: the enemy carries no UCF.Attack.Counterable.A or .B at the press; UCF.Debug.Paired.DrawSelection 1 draws each refusal.
  • A third dodge: no Cooldown gate, an empty Cooldown Tag (which turns it off), Seconds 0 or Charges above 2. The graph editor shows charges live in play.
  • No execution: the enemy lacks the tag the row or role requires, or no target is picked.