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 UCF 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_UCF_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 UCF 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 SystemAddUCF Action GraphAddUCF Input MappingAddUCF InventoryAddUCF Equipment ManagerAddUCF Melee TraceAddUCF Anim ManagerAddUCF VitalsAddUCF DefenseAddUCF TeamAddNames as the Add list shows them. - 2
Fill in four settings
- UCF Vitals: add a Vitals row with Vital Tag
UCF.Vital.Healthand Max Value100. A Vitals component added by hand has none. - UCF Team: Team Id
0, the demo player's side. A new Team component starts on 1, the demo enemies' side. - UCF Equipment Manager: Default Item
Item_UCF_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
UCF.Montage, where montages play, andUCF.Attachment.Body, where items hang. With noUCF.Attachmenttag, items spawn unattached.
- UCF 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 UCF Damageable interface. Its Handle Incoming Damage returns Resolve Defense and Apply Damage, with the UCF Defense component as Defense and Health Vital TagUCF.Vital.Health.BP_MyCharacter · UCF Damageable interfaceHandle Incoming DamageDamage InfoUCFDefenseResolve Defense and Apply DamageTarget is UCF Defense StaticsDefenseDamage InfoHealth Vital TagUCF.Vital.HealthReturn ValueReturn NodeReturn Value - 5
Check the Animation Blueprint
Your Animation Blueprint needs a Slot node forDefaultSlot, where the punches play, then UCF 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_UCF_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. |
| UCF Action Graph | Picks the next move: the current node, its action window, a press waiting to chain. |
| UCF Input Mapping | Turns keys into input tags for the graph. Drawn items add their keys here. |
| UCF Inventory | What the character owns, starting with its Starting Items. |
| UCF Equipment Manager | Draws and puts away items, hands the character the drawn item's graph and keys, and falls back to the Default Item. |
| UCF Melee Trace | Sweeps drawn items' hit volumes during trace windows, passing over teammates. |
| UCF Anim Manager | Names the mesh items hang on, links item animation layers, mirrors montages to extra meshes, holds the pose on hits. |
| UCF Vitals | Health, and any pool you add, such as stamina. |
| UCF Defense | Parries, blocks, invulnerability. Empty, it lets each hit land in full until a drawn item lends it rules. |
| UCF Team | The character's side. |
Add more for more features
| Feature | Add |
|---|---|
| Attacks that turn and close the gap | UCF Targeting with a Targeting Config, UCF Attack Approach, Motion Warping |
| Lock on | Those three, and a lock press (below) |
| Be locked onto | UCF Targetable |
| A combat style for rotation, targeting and camera | UCF Combat with a Combat Style |
| Doors, chests and pickups | UCF Interactor, and an interact press (below) |
| Sprint on a held button | UCF Sprint, and its ability (below) |
| Put-away items shown on the body | UCF Stow Visual |
| Flinching bones, a ragdoll on death | UCF Physical Reaction |
| Warnings over an enemy's swing | UCF Telegraph Viewer |
| Footsteps and effects from animation | UCF Anim Effects with an Anim Effect Bank |
UCF Character Base creates every component on this page but Motion Warping, UCF Sprint, UCF Stow Visual, UCF Physical Reaction and UCF Telegraph Viewer.
Lock-on, interact and sprint are abilities on a key, separate from the ready signal's. UCF 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 UCF Ability Set (right-click in the Content Browser, UCF, Actions, Ability Set). Add a Granted Gameplay Abilities row: Ability
UCF Lock On Ability, Input TagUCF.Input.LockOn, Input ActionIA_UCF_LockOn. - Add the set to Ability Sets to Grant on the Equippable fragment of each such item. For the demo fists, duplicate
Item_UCF_Unarmedand make the copy the Default Item. - Give
IA_UCF_LockOna key:IMC_UCF_Default, whichBP_UCF_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:
UCF Interact Ability on UCF.Input.Interact and IA_UCF_Interact, UCF Sprint Ability on UCF.Input.Sprint and IA_UCF_Sprint.Draw items from a belt
- Add UCF Quick Bar to your player controller, or use UCF 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. - UCF 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_UCF_MannequinBaseor a child.
AdvancedWhat only the character base does
| The base | On your character |
|---|---|
| Moves with UCF 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
UCF.Debug.Actions 1 // Each character's node, window and waiting press
UCF.Debug.Anim 1 // The meshes found, and which plays montages
AdvancedLeaving a component out
- Ability System: no move runs, and setting a graph warns.
- UCF Input Mapping: no key reaches a move unless your input calls the graph's Process Action Input.
- UCF Melee Trace: no hits; an item with hit volumes warns as it is drawn.
- UCF Anim Manager: montages play, but items do not attach, and item layers and hit stop do not run.
- UCF 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, UCF Character Base, then delete the components your Blueprint added that the base creates, a UCF 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_UCF_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
AUCFCharacterBasedoes. It callsInitAbilityActorInfo(Owner, this)on possession and when the PlayerState arrives,RefreshAbilityActorInfo()fromNotifyControllerChanged(a client can receive the PlayerState first), andUUCFAbilitySystemReady::NotifyAbilitySystemReady(this, AbilitySystem)after each. IUCFDamageable::HandleIncomingDamage_Implementationmakes one call,UUCFDefenseStatics::ResolveAndApplyIncomingDamage(Defense, DamageInfo, HealthVitalTag).UUCFAbilitySet::GiveToAbilitySystemandRegisterInputMappingsgrant an ability set and its keys.UUCFInputMappingComponent::BindInputs, fromSetupPlayerInputComponent, binds the component's own Input Mappings.SetDefaultSubobjectClass<UUCFCharacterMovementComponent>(ACharacter::CharacterMovementComponentName)gives a character UCF Character Movement. A C++ child of the base passes its own movement class to the protected constructorAUCFCharacterBase(const FObjectInitializer&, TSubclassOf<UCharacterMovementComponent>).- A movement component of your own takes UCF Character Movement's fixes by copying from
UUCFCharacterMovementComponent:FUCFSavedMove(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.FUCFMoveResponseDatawith itsCorrectedMovefields and two overrides, set in the constructor withSetMoveResponseDataContainerand returned byGetUCFMoveResponseData.- Every member those bodies use, among them
FUCFMovementSettingswith 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:
UCF.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 UCF Action Graph,
UCF.State.ActionsBlockedby default.