Getting Started with Universal Player Combat

Documentation Unreal Engine Player Combat Tutorial

Turn Universal Player Combat on, play the demo map and land a hit with a sword off the rack, then build on the demo player or remove the demo when you no longer need it.


Set it up

5 minutes
  1. 1

    Turn the plugin on

    Get Universal Player Combat on Fab and click Install to Engine in the Epic Games Launcher (5.6, 5.7 or 5.8). In your project, open Edit > Plugins, tick it and restart. The engine plugins it needs switch on with it and its gameplay tags register themselves: no collision channels, surface types or tag files to set up.
  2. 2

    Open the demo map

    Turn on Show Plugin Content in the Content Browser's settings, then open Demo/Maps/LVL_UPC_Demo.
    LVL_UPC_Demo
    ▾Game Mode
    GameMode OverrideNone
    Set in the demo map's World Settings. For a level of your own, set it there or as the Default GameMode in Project Settings > Maps & Modes.
  3. 3

    Take a sword

    Press Play and walk down the hallway to the weapon rack on your left. Look at a sword and press E: it goes on belt slot 1 and into your hand. 1 puts it away and draws it again.
  4. 4

    Hit a training dummy

    The two training dummies stand on the right, a few steps back. The left mouse button is a light attack (click again during each swing for a three-hit combo), the right a heavy one. The dummies cannot die; the right one adds sparks and a short pause on each hit.

Keys

ActionKeyboard and mouseGamepad
Move, lookW A S D, mouseLeft stick, right stick
Light attackLeft mouse buttonRight shoulder
Heavy attackRight mouse buttonRight trigger
Guard: a sword parries on a press as the hit lands and blocks while held; a shield risesQLeft trigger
Lock on, then flick sideways to switch targetMiddle mouse button, then the mouseTop face button, then the right stick
Dash: a dodge with a weapon, a vault over an enemy with bare fistsSpaceLeft shoulder
Interact, and the second option (kick, break)E, FBottom face button, left face button
Draw or put away a belt slot1 to 4D-pad
Drop what is in handGRight face button
Open the inventoryITap View
Sprint (hold)Left ShiftLeft stick click
Swap the camera shoulderVRight stick click
Jump to the start, the paired actions, the style plates7, 8, 9Hold the right special button, press the D-pad up, right, down
On the Freeflow style plate (below), the right mouse button guards instead, and a guard on a punch showing the counter marker counters it.

What the demo shows

StopTryOpen
DoorE opens it, F kicks it openBP_UPC_Door
Training dummiesThe right one has a defense set of its ownBP_UPC_HitDummy, DefenseRuleSet_UPC_HitDummy
ChestsE opens a chest, F breaks the lid offBP_UPC_Chest
Loot chestE opens your inventory beside it on a style that has a screen (switch at the wardrobe's style pads first), F takes everything that fitsBP_UPC_LootChest
Places on the BodyTwo figures draw and sheathe two swords, and a sword and shieldBP_UPC_EquipmentShowcase
Weapon rackE takes a sword or the shield, or puts a sword back on an empty pegBP_UPC_WeaponRack
Paired actionsSix stations loop executions, counters and a vault; step onto the ring marked (you) and press EBP_UPC_PairedStation, Paired_UPC_*
Style platesOver Shoulder (sword and shield), Freeflow (bare fists), Soulslike (two swords), each with its arena; a red plate brings you backBP_UPC_StylePlate, Demo/Combat/Styles
Wardrobe plate, in the start roomA pad for each weapon and worn item, and pads that switch the inventory styleLVL_UPC_Wardrobe
The arenas
ArenaEnemiesWhat it shows
Over ShoulderThree bosses with a two-handed baton, one attacking at a timeBlock, parry, a shield bash, telegraphed swings
FreeflowFour weaker enemies, two attacking at onceStrikes aimed with the stick, a dash strike at range, a counter on a punch showing the counter marker, a vault over an enemy
SoulslikeOne boss with a two-handed baton, picking its swing by your distance. After 250 damage it stays stunned until you walk up and press Light Attack, and only that sword execution kills itLock-on, parry and block with two swords, a finisher
The enemies are built on UPC Character Base and run action graphs pressed by a Behavior Tree: the Freeflow crowd uses the player's unarmed graph, the bosses the baton's. They take turns through an attack token pool per arena (BP_UPC_AttackTokens). Patterns walks through their moves.

Build on the demo player

Duplicate BP_UPC_Character (Demo/Characters/Player) and swap its mesh and Animation Blueprint. The demo's moves fit the demo mannequin's skeleton, so another skeleton needs animations of its own and the Animation Blueprint needs the Slot nodes the montages play in (The Animation Blueprint). A character with its own parent class follows Character Setup.
WhereSettingValue
Class DefaultsStarting Ability SetAn asset listing abilities and their input bindings; the demo's AbilitySet_UPC_Default holds lock-on, interact, sprint, drop, item use, and the demo's hit reactions
Equipment ManagerDefault ItemItem_UPC_Unarmed, the fists it fights with when nothing else is drawn
Equipment ManagerBody PlacesMain hand hand_r, off hand hand_l, three sheaths on the back
InventoryConfigInventoryConfig_UPC_Simple: it carries what the belt holds and the gear it wears, and opens no inventory screen; no Starting Items
CombatStyleCombatStyle_UPC_OverShoulder
TargetingTargeting ConfigTargetingConfig_UPC_OverShoulder
VitalsVitalsHealth, Stamina and Stance (a pool whose emptying staggers the character), each 100 and refilling 10 a second after 3 seconds (Vitals)
TeamTeam Id0; the demo's enemies are on 1
MeshComponent TagsUPC.Montage, UPC.Attachment.Body
BP_UPC_PlayerController, a UPC Player Controller, carries the belt (a UPC Quick Bar of four slots that takes new items and draws them), the shared keys (IMC_UPC_Default), the HUD and the inventory screens. BP_UPC_GameMode names both classes. To play your duplicate, duplicate BP_UPC_GameMode, set its Default Pawn Class to your character, and set it as the level's GameMode Override.
The demo map's Level Blueprint (Blueprints > Open Level Blueprint) holds one comment box per system of unconnected example nodes to copy.

Removing the demo (optional)

The Demo folder is optional. Keep it to learn from, or remove it once nothing of yours uses it. The plugin's Core folder holds everything it needs to run. With the plugin installed to the engine, every project on that engine shares the Demo folder, so leave it in place there.
  1. Untick Load Demo Hit Effects in Project Settings > Plugins > Universal Player Combat Demo. It loads the demo's sparks, sounds and camera shakes; hit stop plays without it. It takes effect on the next start.
  2. Right-click each of your assets built from the demo (your character, game mode, items and levels) and open the Reference Viewer: each asset it lists under Demo is one your asset still references. A duplicate of BP_UPC_Character, for one, still points at the demo assets in the table above, such as AbilitySet_UPC_Default and Item_UPC_Unarmed.
  3. Duplicate each of those into your own folders and point your asset at the copy. A copy can point at demo assets of its own (your character, then its item, then the item's action graph, then the graph's montages), so repeat until the Reference Viewer shows nothing under Demo.
  4. Last, delete the Demo folder.

Debug it

UPC.Debug.All 1          // Every overlay above every character; UPC.Debug.All 0 clears them
UPC.Debug.Actions 1      // The node each character is in, its window, a press waiting
UPC.Debug.Equipment 1    // What each character holds, which item drives combat, what it carries
UPC.Debug.Targeting 1    // Who each character fights, and each candidate's score
UPC.Debug.Interaction 1  // What the character can use, and the option a press would run
UPC.Debug.Vitals 1       // Every pool against its maximum
UPC.Logs Verbose         // Every log category; UPC.Logs alone puts back warnings only
AdvancedMore debug switches
  • UPC.Debug.WatchPawn <name> narrows every overlay to one character, part of a name being enough; UPC.Debug.WatchClear puts them all back.
  • UPC.Debug.MaxDistance sets how far from the camera a character still draws (4000 cm), and UPC.Debug.TextScale sizes the text.
  • UPC.Debug.Melee.DrawTracing 1 draws every weapon sweep, and UPC.Debug.Steering.Draw 1 where each attack steers.
  • The plugin logs only warnings, each naming a setup mistake and its fix; Log LogUPCInventory Verbose raises one category.
AdvancedWhat the demo player is made of
Components
+ Add
BP_UPC_Character (Self)
Capsule Component
Arrow Component
Mesh
SpringArm
Add
TPSCamera
Add
Character Movement
Equipment Manager Component
Inventory Component
Action Graph Component
Melee Trace Component
Input Mapping Component
Anim Manager Component
Vitals Component
Defense Component
Targeting Component
Targetable Component
Team Component
Approach Component
Combat Component
Interactor Component
Anim Effect Component
Ability System Component
UPCSpeedModifier
Add
UPCPhysicalReaction
Add
UPCTelegraphViewer
Add
MotionWarping
Add
UPCStowVisual
Add
UPCCameraRig
Add
Sprint
Add
Grayed rows come with the engine's Character and UPC Character Base; the rest is what the demo Blueprint adds.
Character Setup says what each of the base's components does. The base moves with UPC Character Movement, which keeps a player's corrections smooth under lag, and answers hits itself: its defenses resolve the hit and the rest comes off its health. Override On Damage Taken in a Blueprint child for a flinch or a death (Damage and Hit Effects). Its Class Defaults:
SettingDefaultDoes
Starting Ability SetNoneAbilities the character has from the start, bound to their keys on the player's machine. Weapon moves belong on the item.
Draw Starting ItemsonDraws the inventory's equippable items into the hands, unless the controller's belt has Auto Populate from Inventory on and takes them.
Ignore Camera CollisiononKeeps a camera from zooming in when this character walks between it and the player it follows.
Health Vital TagUPC.Vital.HealthThe pool a hit takes its damage off.
Its Vitals start with a Health row of 100 and its Team Component on no team (255) until you set Team Id.
MultiplayerAn ability system on the PlayerState
The demo keeps each character's ability system on the character, in Mixed replication mode. To keep a player's abilities across deaths and respawns, host it on the PlayerState:
  1. Write a PlayerState in C++ that implements IAbilitySystemInterface and creates a replicated ability system component in Mixed replication mode. Raise its Net Update Frequency (100 works); the engine's default is low.
  2. Set the game mode's Player State Class to it.
A character built on UPC Character Base uses a PlayerState's ability system in place of its own, granting its abilities on possession and taking them back when it ends. The PlayerState needs C++ because Blueprint cannot implement the interface. Get Ability System Component Internal, overridable in a Blueprint child of the base, points the character at an ability system kept elsewhere.
C++C++
  • AUPCCharacterBase (UPCGame) is Abstract and Blueprintable, derives from ACharacter, and implements IAbilitySystemInterface and IUPCDamageable.
  • InitializeAbilityActorInfo (virtual, protected) runs from PossessedBy on the server and OnRep_PlayerState on clients: it calls InitAbilityActorInfo(Owner, this), grants the Starting Ability Set and sends UUPCAbilitySystemReady::NotifyAbilitySystemReady. NotifyControllerChanged calls RefreshAbilityActorInfo(), which a PlayerState-hosted system needs since a client can receive the PlayerState before the controller.
  • GetAbilitySystemComponentInternal (BlueprintNativeEvent) resolves the ability system, PlayerState first; OnDamageTaken (BlueprintNativeEvent, authority only) and ResolveIncomingHit are the damage seams.
  • A C++ child that moves with a movement component of its own passes its class to the protected constructor AUPCCharacterBase(const FObjectInitializer&, TSubclassOf<UCharacterMovementComponent>).
  • AUPCPlayerController creates the UUPCQuickBarComponent and calls InitializeForPawn from OnPossess and OnRep_Pawn.