Multiplayer Support

Documentation Unreal Engine AI Multiplayer Replication

Run SEC in co-op: the server decides, and every client receives the health, action, role and weapon state a HUD draws from.


The server makes every AI decision. Clients receive the pawn state a health bar, a telegraph and a role icon need, and the animations arrive on their own through the ability system.

What runs where

Decisions sit on the AI controller and stay on the server. Output sits on the pawn and replicates.
Server side. Nothing here decides anything on a client. The controller components exist on the server alone, and the two pawn components ride along on a client and stay inert there.
PieceLives onDecides
SEC Combat ControllerAI controllerResolves the AI Config, syncs sets on a role change, orchestrates death
SEC BrainAI controllerRuns the StateTree or the native loop
Action EvaluationAI controllerScores actions and starts the winner
Reaction EvaluationAI controllerPicks the answer to an incoming hit
Movement EvaluatorAI controllerSteers the pawn
SEC AwarenessAI controllerPerception memory, sight and hearing
Threat DetectionAI controllerHow long the player has been staring
SEC TerritoryEnemy pawnPatrol posts, the wander area, the leash
SEC Token Budget ComponentThe actor being attackedHow many enemies may swing at once
Reaches every client. Bind your UI to these.
PieceLives onClients read
SEC VitalsEnemy pawnEvery vital's value, including a smooth regenerating one
SEC Action Set ComponentEnemy pawnThe running action, the active set, cooldowns
SEC Reaction Set ComponentEnemy pawnThe running reaction, the active set, cooldowns
SEC Combat RoleEnemy pawnThe assigned role tag
SEC Equipment ComponentEnemy pawnWhich actor the enemy holds as its weapon
SEC TeamEnemy pawnTeam Id and Free For All
The ability systemEnemy pawnGameplay cues, replicated tags, montage playback
An AI controller reaches no client. Unreal marks a controller relevant only to its own player, and an AI enemy has no player, so on a client Get Controller on that enemy returns nothing and every controller component in the first table is out of reach. Client UI binds to the pawn components in the second table. Blueprint that reads the controller works in a single-process Play In Editor session and returns null the moment you run a real client.

Point the AI at every player

Enemies fight the actors registered as combat targets, and co-op needs one entry per player. Register from the player pawn's Event BeginPlay, behind a Has Authority branch, so each player registers itself as it spawns.
Player pawn · Event BeginPlay
AICombatRoleSubsystem
Register Combat Target
Target is AICombat Role Subsystem
Target
Target ActorSelf
Auto Assign Unassigned
Reevaluate Existing
Every call gives each idle enemy another pass over the pool, so a player joining late is picked up with no extra wiring. Tick Auto Assign Unassigned to evaluate roles straight away instead of waiting for the reassignment timer. See Targeting System.
Register the pawn, not the controller. Perception and awareness key off the pawn, and team reads go through the pawn's SEC Team component, so a registered controller carries neither.

Draw an enemy's health on a client

Health lives on the pawn's SEC Vitals component, which the shipped enemy carries with one Health row at 100.
  1. On the client, find SEC Vitals on the enemy actor.
  2. Bind On Vital Changed. It carries the vital tag, the new value, the old value and the max, and fires on the server and on each client as the change replicates. Filter by tag when the pawn holds more than one pool.
  3. Drive the bar's fill from Get Vital Fraction, polled each frame.
Regeneration's smooth rise raises no event. Each machine works the current value out from the last replicated anchor against server time, so a client reads a smooth bar with no extra call and no per-tick traffic. See Vitals.

Show what an enemy is doing

The pawn's action and reaction components carry the running move down to clients. Bind these on the enemy actor from client code.
DelegateOnFires when
On Action Execution StartedSEC Action Set ComponentA move starts, carrying the action id
On Action Execution CompletedSEC Action Set ComponentThe move ends, carrying whether it succeeded
On Action Cooldown Started / ExpiredSEC Action Set ComponentA cooldown opens or closes
On Reaction Execution StartedSEC Reaction Set ComponentA parry, block or dodge starts
On Combat Role ChangedSEC Combat RoleThe role tag changes, carrying new and previous
Polling works too: Get Current Action Id, Is Action Executing, Get Active Action Set and Get Remaining Cooldown all answer on a client. A cooldown replicates with the world time the server ends it at, and the On Action Cooldown Started and Expired pair marks each edge as it happens.
Details
SEC Action Set Component
SEC|Action State
Current Action Id
None
Action Executing
Active Action Set
DA_EnemyActions
SEC|ActionSet
Provided Action Set
DA_GreatswordActions
Replicated runtime state on the pawn. The server writes via NotifyActionStarted and role sync; clients read fields or bind OnActionExecutionStarted.
Details
SEC Combat Role
AI|Combat Role
Combat Role
SEC.Role.Attacker
Replicated runtime state on the pawn. SECCombatControllerComponent calls SetCombatRole on the server; clients bind OnCombatRoleChanged.

Damage lands on the server

Melee sweeps run on the machine holding authority, so one swing lands once. Clients see the attack through the montage the ability replicates.
  • The swing. SEC's ability base starts abilities on the server and replicates them, so the montage plays everywhere with no wiring on your side.
  • Impact cues. A landed hit runs the damage config's Hit Effects. SEC Play Gameplay Cues goes through the ability system and reaches every client. SEC Apply Physics Impulse stays on the machine that ran it.
  • Defense. Resolve Incoming Damage charges the cost of a parry or a block, so run it on the server. To show a player what a hit would cost without taking it, use Preview Incoming Damage, which charges nothing.
Call Run Hit Effects on the authority. A physics impulse, and any effect you write yourself, runs on the machine that called it, so a server call and a predicting client's call run it twice. Gate the call when you drive damage yourself.

Dedicated server checklist

Three things behave differently with no rendering and no local player.
CheckWhy
Mesh poseThe shipped enemy sets its mesh to Always Tick Pose And Refresh Bones on a dedicated server at Begin Play. A custom character has to set it, or sockets keep the bind pose and melee sweeps read positions that never move. The trace component warns once per character when it spots this.
World tagsTag writes are server-side. For client reads, add a SEC World Tag Component to your GameState; it mirrors the server's tags and fires On Tags Changed. A client read without it returns nothing and warns once.
EncountersA SEC Encounter Trigger reacts to the locally controlled player pawn on that player's own machine, so each player gets their own encounter and nothing crosses the wire. Enemy health reaches the bar through the enemies' own replication.

Debug it

The overlays read live component state on the machine running them. Role, Actions, Reactions, Vitals and Teams read replicated pawn state, so they draw on a client as well as the server. Decision, Movement, Awareness, Territory, Scoring and Tokens are worked out on the server and draw there alone, so run those on the server or the listen-server host.
SEC.Debug.All 1                  // Every overlay section at once
SEC.Debug.WatchPawn <name>       // Narrow the overlays to one enemy
SEC.Debug.LogActionExecution 1   // Action starts, ends and cooldowns
SEC.Debug.Melee.DrawTracing 1    // Sweep shapes, on the machine that traces
To reproduce a client-only bug in the editor, open the Play dropdown, set Net Mode to Play As Client and Number of Players to 2 under Multiplayer Options. That runs a real server, which is where a HUD reading the AI controller falls over.
NetEmulation.PktLag 150   // Add 150 ms of latency to every packet
NetEmulation.Off          // Clear it
AdvancedA client shows nothing at all
In the order worth checking:
  • The binding went to the AI controller. It exists on the server alone. Bind to the pawn components instead.
  • Nothing registered that player. An enemy with no combat target scores nothing and starts nothing, so every replicated field stays at its idle value. This is the common one and it logs nothing.
  • The widget bound before the pawn arrived. An enemy streaming in later reaches a client after the HUD built. Bind as each enemy actor appears rather than once at level start.
  • The delegate fires and the widget is stale. Regeneration raises no event by design; poll Get Vital Fraction for a moving bar.
AlternativeSweeping for hits on a machine other than the server
SEC Melee Trace asks Should Detect Hits before every sweep, which answers with the owner's authority. Override it in a Blueprint subclass to detect on the owning client instead, for a project that predicts its own hits.
Two things change once you do:
  • A team id carried on a controller reads as no team on a client, because a controller replicates only to its own player. Put the id on the pawn or its Player State, which is what the pawn's SEC Team component does.
  • A gameplay cue fired off the authority and outside a prediction window plays nothing, so a client-detected hit needs its cues driven locally.
AdvancedSpeed changes that disagree between machines
Walk speed is not a replicated property, so each machine works its own copy out from the tags it can see. A SEC Speed Modifier driven by a tag added with Add Loose Gameplay Tag slows the owner on one machine and leaves it at full speed on the others.
Add the driving tag through a Gameplay Effect, or through Add Replicated Loose Gameplay Tag, and both sides agree.
AdvancedWhich machine runs an animation notify
SEC's notifies fire wherever the animation plays and send nothing over the wire:
NotifyRuns
SEC State Tag WindowOn each machine playing the montage. The server plays it too, which is what server-side checks read.
SEC Melee Trace WindowEverywhere, but the sweep inside it is gated on authority.
SEC Play Anim Effect / SEC Anim Effect WindowOn each machine playing the animation, and not at all on a dedicated server.
SEC Gameplay EventOn each machine playing the montage, raised locally.
SEC Approach WindowOn the server and on a player's own machine. A copy of someone else's character receives the motion already resolved.
One caveat for player characters: on the server's copy of a character a connected client controls, Unreal 5.6 and 5.7 begin and end every montage notify state once per frame while the montage plays on. Anything opening on begin and closing on end is torn down and rebuilt every frame there.
AdvancedSteering an attack toward a target across the wire
SEC Approach stores its target on the machine the call runs from, which suits an attack played through an ability, since the ability graph runs on the server and on the player's own machine alike.
When the code storing the target runs on the server alone, turn Replicate on so the server sends it to the owning player as well. Anywhere other than the server, that switch stores the target and sends nothing. The glide itself predicts on the owning client and simulates for everyone else, and the warp goal is worked out wherever the warp runs.
AdvancedEvery field that replicates, component by component
ComponentReplicated
SEC Action Set ComponentCurrent Action Id, Action Executing, Active Action Set, Provided Action Set, Last Action Succeeded, Completed Action Id, cooldown started and expired records
SEC Reaction Set ComponentThe same shape for reactions
SEC Combat RoleCombat Role
SEC VitalsOne anchor per vital, holding value, server timestamp and regen rate
SEC Equipment ComponentEquipped Weapon
SEC TeamTeam Id, Free For All
SEC ApproachStored approach targets, to the owning player alone
SEC World Tag ComponentTags, when you add it to GameState
The enemy's ability system runs in Minimal replication mode, which keeps effect bookkeeping on the server while the cues an effect fires still reach every client. A weapon actor replicates, and its attachment to the character mesh travels with it.
SEC Token Budget Component replicates nothing on purpose: token accounting decides which enemy may swing, and that decision belongs to the server.