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
An empty Source Component Tag traces the body mesh. The punch's trace window lists FistR under Socket IDs.
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. 1

    Add ten components

    Press Add in your Character Blueprint's Components panel.
    Components
    + Add
    BP_MyCharacter (Self)
    Capsule Component
    Mesh
    Ability System
    Add
    UCF Action Graph
    Add
    UCF Input Mapping
    Add
    UCF Inventory
    Add
    UCF Equipment Manager
    Add
    UCF Melee Trace
    Add
    UCF Anim Manager
    Add
    UCF Vitals
    Add
    UCF Defense
    Add
    UCF Team
    Add
    Names as the Add list shows them.
  2. 2

    Fill in four settings

    • UCF Vitals: add a Vitals row with Vital Tag UCF.Vital.Health and Max Value 100. 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, and UCF.Attachment.Body, where items hang. With no UCF.Attachment tag, items spawn unattached.
  3. 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 Graph
    Event BeginPlay
    Notify Ability System Ready
    Avatarself
    Ability System
    Event Receive Controller Changed
    Old Controller
    New Controller
    Notify Ability System Ready
    Avatarself
    Ability System
  4. 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 Tag UCF.Vital.Health.
    BP_MyCharacter · UCF Damageable interface
    Handle Incoming Damage
    Damage Info
    UCFDefense
    Resolve Defense and Apply Damage
    Target is UCF Defense Statics
    Defense
    Damage Info
    Health Vital TagUCF.Vital.Health
    Return Value
    Return Node
    Return Value
  5. 5

    Check the Animation Blueprint

    Your Animation Blueprint needs a Slot node for DefaultSlot, where the punches play, then UCF Hit Stop and Inertialization after it, or the log warns once (The Animation Blueprint lists the rest).
  6. 6

    Press Play and punch

    Make your character your game mode's Default Pawn Class, point a copy of LVL_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

ComponentDoes
Ability SystemPlays each move as a gameplay ability.
UCF Action GraphPicks the next move: the current node, its action window, a press waiting to chain.
UCF Input MappingTurns keys into input tags for the graph. Drawn items add their keys here.
UCF InventoryWhat the character owns, starting with its Starting Items.
UCF Equipment ManagerDraws and puts away items, hands the character the drawn item's graph and keys, and falls back to the Default Item.
UCF Melee TraceSweeps drawn items' hit volumes during trace windows, passing over teammates.
UCF Anim ManagerNames the mesh items hang on, links item animation layers, mirrors montages to extra meshes, holds the pose on hits.
UCF VitalsHealth, and any pool you add, such as stamina.
UCF DefenseParries, blocks, invulnerability. Empty, it lets each hit land in full until a drawn item lends it rules.
UCF TeamThe character's side.

Add more for more features

FeatureAdd
Attacks that turn and close the gapUCF Targeting with a Targeting Config, UCF Attack Approach, Motion Warping
Lock onThose three, and a lock press (below)
Be locked ontoUCF Targetable
A combat style for rotation, targeting and cameraUCF Combat with a Combat Style
Doors, chests and pickupsUCF Interactor, and an interact press (below)
Sprint on a held buttonUCF Sprint, and its ability (below)
Put-away items shown on the bodyUCF Stow Visual
Flinching bones, a ragdoll on deathUCF Physical Reaction
Warnings over an enemy's swingUCF Telegraph Viewer
Footsteps and effects from animationUCF 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:
  1. 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 Tag UCF.Input.LockOn, Input Action IA_UCF_LockOn.
  2. Add the set to Ability Sets to Grant on the Equippable fragment of each such item. For the demo fists, duplicate Item_UCF_Unarmed and make the copy the Default Item.
  3. Give IA_UCF_LockOn a key: IMC_UCF_Default, which BP_UCF_PlayerController adds, 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

  1. Add UCF Quick Bar to your player controller, or use UCF Player Controller, which carries one.
  2. 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.
  3. 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: DefaultSlot unless you pick another. The demo's montages also use UpperBody for 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_MannequinBase or a child.
AdvancedWhat only the character base does
The baseOn your character
Moves with UCF Character Movement: smoother corrections under lag, and a Grace Tag that keeps the server from pulling a dashing player backC++, since a Blueprint cannot change the movement component's class; every feature works on the engine's Character Movement
A Health row on its VitalsStep 2
Draws its starting items, unless a belt that takes new items doesEquip Item for each, on the server, from Begin Play
Ignore Camera Collision: the camera's spring arm passes through charactersThe Camera channel on Ignore on the capsule and mesh
No character can stand on its headThe 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 AUCFCharacterBase does. It calls InitAbilityActorInfo(Owner, this) on possession and when the PlayerState arrives, RefreshAbilityActorInfo() from NotifyControllerChanged (a client can receive the PlayerState first), and UUCFAbilitySystemReady::NotifyAbilitySystemReady(this, AbilitySystem) after each.
  • IUCFDamageable::HandleIncomingDamage_Implementation makes one call, UUCFDefenseStatics::ResolveAndApplyIncomingDamage(Defense, DamageInfo, HealthVitalTag).
  • UUCFAbilitySet::GiveToAbilitySystem and RegisterInputMappings grant an ability set and its keys. UUCFInputMappingComponent::BindInputs, from SetupPlayerInputComponent, 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 constructor AUCFCharacterBase(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's AllocateNewMove.
    • AddReferencedObjects, GetPredictionData_Client, ClientUpdatePositionAfterServerUpdate, ClientHandleMoveResponse, UpdateFromCompressedFlags, MoveAutonomous, SimulatedTick, TickCharacterPose, and ServerCheckClientError, ServerShouldUseAuthoritativePosition and ServerMoveHandleClientError as the overloads taking FMovementBaseInterfaceData* from UE 5.8, UPrimitiveComponent* before.
    • FUCFMoveResponseData with its CorrectedMove fields and two overrides, set in the constructor with SetMoveResponseDataContainer and returned by GetUCFMoveResponseData.
    • Every member those bodies use, among them FUCFMovementSettings with its static_assert, and the file-local FindStraightGlideTarget and HoldToLine.
AdvancedTroubleshooting
The character does nothing when the key is pressed
  • No Default Item, or one with no Action Graph: UCF.Debug.Actions 1 shows 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.ActionsBlocked by default.