Character Setup
Documentation Unreal Engine Player Combat Tutorial
Make a character of your own fight without changing its parent class: the components to add, the settings they need, the ready signal and the interface that answers hits.
The quick start uses the demo's fists, made for the demo mannequin's skeleton and its
hand_r and hand_l bones. On another skeleton, make your own punch montages and give each hand a hit volume as Build Your First Combo does for the sword. For a right hand bone named RightHand, add a Trace Sockets row to the fists item's Equippable fragment, and put a UPC Melee Trace Window naming the same ID on the punch montage:Item_MyFists
▾Trace Sockets
IDNone
Socket or Bone NameTraceStart
Make the fists item by duplicating
Item_UPC_Unarmed, point its Equippable Action Graph at a graph whose montages fit your skeleton, and set it as the Equipment Manager's Default Item. Set the Equipment Manager's Body Places to your hand bones too (defaults hand_r and hand_l; Equipment). A character free to change its parent can reparent to UPC Character Base instead.Set it up
10 minutes- 1
Add ten components
Press Add in your Character Blueprint's Components panel.Components+ AddBP_MyCharacter (Self)Capsule ComponentMeshAbility SystemAddUPC Action GraphAddUPC Input MappingAddUPC InventoryAddUPC Equipment ManagerAddUPC Melee TraceAddUPC Anim ManagerAddUPC VitalsAddUPC DefenseAddUPC TeamAddNames as the Add list shows them. - 2
Fill in four settings
- UPC Vitals: add a Vitals row with Vital Tag
UPC.Vital.Healthand Max Value100. A Vitals component added by hand has none. - UPC Team: Team Id
0, the demo player's side. A new Team component starts on 1, the demo enemies' side. - UPC Equipment Manager: Default Item
Item_UPC_Unarmed, the demo's fists, which give the moves when nothing else is in hand (on another skeleton, your fists item). - Mesh: the Component Tags
UPC.Montage, where montages play, andUPC.Attachment.Body, where items hang. With noUPC.Attachmenttag, items spawn unattached.
- UPC Vitals: add a Vitals row with Vital Tag
- 3
Send the ready signal
Call Notify Ability System Ready from Event BeginPlay and Event Receive Controller Changed. It grants the abilities that need no key: hit confirmation, draws and put-aways, the paired role and the interactor's payload ability. Abilities a key starts (lock-on, interact, sprint) come from an ability set (below). Begin Play covers the ability system; the controller call covers the Default Item, which adds its keys once a player controller holds the character.BP_MyCharacter · Event GraphEvent BeginPlayNotify Ability System ReadyAvatarselfAbility SystemEvent Receive Controller ChangedOld ControllerNew ControllerNotify Ability System ReadyAvatarselfAbility System - 4
Answer incoming hits
In Class Settings, add the UPC Damageable interface. Its Handle Incoming Damage returns Resolve Defense and Apply Damage, with the UPC Defense component as Defense and Health Vital TagUPC.Vital.Health.BP_MyCharacter · UPC Damageable interfaceHandle Incoming DamageDamage InfoUPCDefenseResolve Defense and Apply DamageTarget is UPC Defense StaticsDefenseDamage InfoHealth Vital TagUPC.Vital.HealthReturn ValueReturn NodeReturn Value - 5
Check the Animation Blueprint
Your Animation Blueprint needs a Slot node forDefaultSlot, where the punches play, then UPC Hit Stop and Inertialization after it, or the log warns once (The Animation Blueprint lists the rest). - 6
Press Play and punch
Make your character your game mode's Default Pawn Class, point a copy ofLVL_UPC_Demo's GameMode Override at that game mode, and press Play. Punch a training dummy with the left mouse button.
What each component does
| Component | Does |
|---|---|
| Ability System | Plays each move as a gameplay ability. |
| UPC Action Graph | Picks the next move: the current node, its action window, a press waiting to chain. |
| UPC Input Mapping | Turns keys into input tags for the graph. Drawn items add their keys here. |
| UPC Inventory | What the character owns, starting with its Starting Items. |
| UPC Equipment Manager | Draws and puts away items, hands the character the drawn item's graph and keys, and falls back to the Default Item. |
| UPC Melee Trace | Sweeps drawn items' hit volumes during trace windows, passing over teammates. |
| UPC Anim Manager | Names the mesh items hang on, links item animation layers, mirrors montages to extra meshes, holds the pose on hits. |
| UPC Vitals | Health, and any pool you add, such as stamina. |
| UPC Defense | Parries, blocks, invulnerability. Empty, it lets each hit land in full until a drawn item lends it rules. |
| UPC Team | The character's side. |
Add more for more features
| Feature | Add |
|---|---|
| Attacks that turn and close the gap | UPC Targeting with a Targeting Config, UPC Attack Approach, Motion Warping |
| Lock on | Those three, and a lock press (below) |
| Be locked onto | UPC Targetable |
| A combat style for rotation, targeting and camera | UPC Combat with a Combat Style |
| Doors, chests and pickups | UPC Interactor, and an interact press (below) |
| Sprint on a held button | UPC Sprint, and its ability (below) |
| Put-away items shown on the body | UPC Stow Visual |
| Flinching bones, a ragdoll on death | UPC Physical Reaction |
| Warnings over an enemy's swing | UPC Telegraph Viewer |
| Footsteps and effects from animation | UPC Anim Effects with an Anim Effect Bank |
UPC Character Base creates every component on this page but Motion Warping, UPC Sprint, UPC Stow Visual, UPC Physical Reaction and UPC Telegraph Viewer.
Lock-on, interact and sprint are abilities on a key, separate from the ready signal's. UPC Character Base grants them from its Starting Ability Set; your Blueprint has no such slot, so an item grants them instead: on the Default Item they work bare-handed, on a sword only while it is drawn. For lock-on:
- Create a UPC Ability Set (right-click in the Content Browser, UPC, Actions, Ability Set). Add a Granted Gameplay Abilities row: Ability
UPC Lock On Ability, Input TagUPC.Input.LockOn, Input ActionIA_UPC_LockOn. - Add the set to Ability Sets to Grant on the Equippable fragment of each such item. For the demo fists, duplicate
Item_UPC_Unarmedand make the copy the Default Item. - Give
IA_UPC_LockOna key:IMC_UPC_Default, whichBP_UPC_PlayerControlleradds, maps it to the middle mouse button. With a controller of your own, map it in a context that controller adds.
Interaction and sprint take a row each in the same set:
UPC Interact Ability on UPC.Input.Interact and IA_UPC_Interact, UPC Sprint Ability on UPC.Input.Sprint and IA_UPC_Sprint.Draw items from a belt
- Add UPC Quick Bar to your player controller, or use UPC Player Controller, which carries one.
- On your own controller, bind On Possessed Pawn Changed and call the Quick Bar's Initialize for Pawn with a valid New Pawn, on the server and the player's machine alike.
- Tick Auto Populate from Inventory and list items in the inventory's Starting Items: each takes the first free slot, and the first that fits comes to hand.
A character with no belt, such as an AI, draws on the server with Equip Item or Draw With Reach.
The Animation Blueprint
- A Slot node for each slot the montages use:
DefaultSlotunless you pick another. The demo's montages also useUpperBodyfor draws, parries and pickups. - UPC Hit Stop after the slot, then Inertialization: freezes the pose briefly on a hit.
- Optional Linked Anim Layer nodes take a drawn item's animation layer (its own walk, say); without them the layer is ignored. The demo's layers fit
ABP_UPC_MannequinBaseor a child.
AdvancedWhat only the character base does
| The base | On your character |
|---|---|
| Moves with UPC Character Movement: smoother corrections under lag, and a Grace Tag that keeps the server from pulling a dashing player back | C++, since a Blueprint cannot change the movement component's class; every feature works on the engine's Character Movement |
| A Health row on its Vitals | Step 2 |
| Draws its starting items, unless a belt that takes new items does | Equip Item for each, on the server, from Begin Play |
| Ignore Camera Collision: the camera's spring arm passes through characters | The Camera channel on Ignore on the capsule and mesh |
| No character can stand on its head | The capsule's Walkable Slope Override, Walkable Slope Behavior Unwalkable |
Debug it
UPC.Debug.Actions 1 // Each character's node, window and waiting press
UPC.Debug.Anim 1 // The meshes found, and which plays montages
AdvancedLeaving a component out
- Ability System: no move runs, and setting a graph warns.
- UPC Input Mapping: no key reaches a move unless your input calls the graph's Process Action Input.
- UPC Melee Trace: no hits; an item with hit volumes warns as it is drawn.
- UPC Anim Manager: montages play, but items do not attach, and item layers and hit stop do not run.
- UPC Team: teamless; enemies still target it, and teammates' swings still hit it.
- Motion Warping: an attack with a warp window plays its own motion and steers nothing; the log warns once per class.
AlternativeUse the character base instead
File, Reparent Blueprint, UPC Character Base, then delete the components your Blueprint added that the base creates, a UPC Team among them. Set Team Id on the base's Team Component, which starts on no team (255), tag the mesh and set the Default Item. The demo player,
BP_UPC_Character, is built this way.MultiplayerMultiplayer
- The ability system stays on the character; a Blueprint cannot put it on the PlayerState. Added in Blueprint, it replicates in Full mode, which suits players and AI.
- The ready signal is safe on every machine: only the server grants abilities.
- Without the ready signal, a client player's hits do not reach the server, and that client logs it.
- A graph set with Set Action Graph goes on every machine: it does not replicate, and the owning player predicts with it.
C++C++
- A C++ pawn may host its ability system on the PlayerState, as
AUPCCharacterBasedoes. It callsInitAbilityActorInfo(Owner, this)on possession and when the PlayerState arrives,RefreshAbilityActorInfo()fromNotifyControllerChanged(a client can receive the PlayerState first), andUUPCAbilitySystemReady::NotifyAbilitySystemReady(this, AbilitySystem)after each. IUPCDamageable::HandleIncomingDamage_Implementationmakes one call,UUPCDefenseStatics::ResolveAndApplyIncomingDamage(Defense, DamageInfo, HealthVitalTag).UUPCAbilitySet::GiveToAbilitySystemandRegisterInputMappingsgrant an ability set and its keys.UUPCInputMappingComponent::BindInputs, fromSetupPlayerInputComponent, binds the component's own Input Mappings.SetDefaultSubobjectClass<UUPCCharacterMovementComponent>(ACharacter::CharacterMovementComponentName)gives a character UPC Character Movement. A C++ child of the base passes its own movement class to the protected constructorAUPCCharacterBase(const FObjectInitializer&, TSubclassOf<UCharacterMovementComponent>).- A movement component of your own takes UPC Character Movement's fixes by copying from
UUPCCharacterMovementComponent:FUPCSavedMove(Clear,SetMoveFor,CanCombineWith,PrepMoveFor,PostUpdate,GetCompressedFlags), its casts pointed at your component; unchanged, it treats every run as predicted. The prediction data'sAllocateNewMove.AddReferencedObjects,GetPredictionData_Client,ClientUpdatePositionAfterServerUpdate,ClientHandleMoveResponse,UpdateFromCompressedFlags,MoveAutonomous,SimulatedTick,TickCharacterPose, andServerCheckClientError,ServerShouldUseAuthoritativePositionandServerMoveHandleClientErroras the overloads takingFMovementBaseInterfaceData*from UE 5.8,UPrimitiveComponent*before.FUPCMoveResponseDatawith itsCorrectedMovefields and two overrides, set in the constructor withSetMoveResponseDataContainerand returned byGetUPCMoveResponseData.- Every member those bodies use, among them
FUPCMovementSettingswith itsstatic_assert, and the file-localFindStraightGlideTargetandHoldToLine.
AdvancedTroubleshooting
The character does nothing when the key is pressed
- No Default Item, or one with no Action Graph:
UPC.Debug.Actions 1shows no graph. - No key reached it: the Default Item adds its keys once a player controller holds the character, so check the controller-changed call.
- No montage plays: the Animation Blueprint lacks the montage's Slot, or the montage is for another skeleton.
- The press is refused: the character carries a Global Block Tags tag of the UPC Action Graph,
UPC.State.ActionsBlockedby default.