Multiplayer Support
Documentation Unreal Engine AI Multiplayer Replication
Server-authoritative AI with replicated pawn state for client UI, animation, and feedback.
AAIControllerand its SEC components exist only on the server. Clients read replicated pawn fields for telegraphs, combat roles, equipped weapons, and GAS montages.
When to Use This
- Listen server or dedicated server co-op.
- Client HUD for enemy health, current action, or combat role.
- Server-side hit resolution with client-facing attack animation through GAS.
Single-player needs no extra replication wiring.
How It Works
Unreal runs AI on the server. The plugin splits work three ways:
- Server brain: score actions, move, assign roles, trace melee, run awareness, evaluate reactions.
- Bridge: on possession,
SECCombatControllerComponentbinds eval delegates to pawn notify methods and pushes role tags throughSetCombatRole. - Client mirror: bind UI and VFX to replicated pawn delegates and GAS montage playback.
Server Side
AI controller
These components live on
AEnemyControllerBase (or your controller). AI controllers exist only on the server, so none of this replicates to clients:| Component | Role |
|---|---|
SECCombatControllerComponent | AIConfig cache, role sync, delegate bridge to pawn |
ActionEvaluationComponent | Action selection and execution |
ReactionEvaluationComponent | Reaction selection and execution |
MovementEvaluatorComponent | Tactical movement input |
USECAwarenessComponent | Perception memory (header: server-only) |
ThreatDetectionComponent | Player stare detection |
USECBrainComponent | StateTree or native loop |
World subsystems (server authority, not pawn components):
| Subsystem | Role |
|---|---|
UAICombatRoleSubsystem | Role assignment, combat targets |
USECWorldTagSubsystem | World tag writes |
Pawn (authority only)
These stay on the possessed pawn but skip client simulation:
| Piece | Notes |
|---|---|
USECMeleeTraceComponent | StartTracing and tick check HasAuthority. See Melee Trace. |
| Melee damage | ISECDamageable::ApplyDamage or legacy ApplyPointDamage on authority. |
Clients see swings through GAS montage replication.
OnMeleeHitResponse fires on authority; route hit VFX through replicated health, gameplay cues, or your own RPC layer.Replicated on the Pawn
AEnemyCharacterBase also creates USECMeleeTraceComponent by default (authority-only; see above). These four replicate combat state to clients:| Component | Clients receive |
|---|---|
SECActionSetComponent | Current action id, executing flag, active action set, equipped weapon ref, cooldown events |
SECReactionSetComponent | Current reaction id, executing flag, active reaction set, cooldown events |
SECCombatRoleComponent | CombatRole gameplay tag |
UAbilitySystemComponent | GAS state and montages |
Panels below show replicated runtime fields on each pawn component (what clients receive during play, not Blueprint defaults you set once in the editor):
Details
SEC Action Set Component (SECActionSetComponent)
SEC|Action State
Current Action Id
None
Action Executing
Active Action Set
DA_EnemyActions
Weapon
Equipped Weapon
BP_EnemySword
Replicated runtime state on the pawn. The server writes via NotifyActionStarted and role sync; clients read fields or bind OnActionExecutionStarted.
Details
SEC Combat Role Component (SECCombatRoleComponent)
AI|Combat Role
Combat Role
SEC.Role.Attacker
Replicated runtime state on the pawn. SECCombatControllerComponent calls SetCombatRole on the server; clients bind OnCombatRoleChanged.
SECCombatControllerComponent wires controller delegates into pawn notify methods: NotifyActionStarted, NotifyActionCompleted, NotifyCooldownStarted, NotifyCooldownExpired, and USECCombatRoleComponent::SetCombatRole. Reaction evaluation uses the same bridge with NotifyReactionStarted, NotifyReactionCompleted, and matching cooldown notifies on SECReactionSetComponent.Clients bind
OnActionExecutionStarted, OnCombatRoleChanged, OnReactionExecutionStarted, and related cooldown delegates on the pawn.ASECWeaponBase sets bReplicates = true. Attachment replicates with the character mesh.UGameplayAbilityBase (used by GA_SEC_Attack) defaults to server-initiated execution with replicated montages. Exact enum values sit in the GameplayAbilityBase defaults collapsible.Setup
1. Register player targets
Call
RegisterCombatTarget for each player pawn from GameMode or player spawn:UAICombatRoleSubsystem* Roles = GetWorld()->GetSubsystem<UAICombatRoleSubsystem>();
Roles->RegisterCombatTarget(PlayerPawn, /*bAutoAssignUnassigned=*/ true);Co-op needs one entry per player. See Targeting System.
2. Bind client UI to pawn components
USECActionSetComponent* Actions = Enemy->FindComponentByClass<USECActionSetComponent>();
Actions->OnActionExecutionStarted.AddDynamic(this, &UMyHUD::OnEnemyAction);
USECCombatRoleComponent* Role = Enemy->FindComponentByClass<USECCombatRoleComponent>();
Role->OnCombatRoleChanged.AddDynamic(this, &UMyHUD::OnRoleChanged);Mirror the same pattern on
SECReactionSetComponent with OnReactionExecutionStarted (and completion/cooldown delegates as needed).3. Optional health component
UBasicHealthComponent is not on EnemyCharacterBase by default. Add it in Blueprint for replicated Health. OnHealthChanged and OnHealthDecreased fire when health updates ( OnRep_Health on clients; SetHealth calls the same path on the server).SECCombatControllerComponent binds OnHealthZero to HandleDeath when bAutoBindBasicHealthComponent is true (default). Disable that flag if you drive death from GAS or a custom health system.ISECDamageable on EnemyCharacterBase is the preferred damage path for SEC actors.4. Dedicated server animation
AEnemyCharacterBase::BeginPlay sets AlwaysTickPoseAndRefreshBones on dedicated servers. Without it, DS socket positions stay at bind pose and melee traces miss.Integration
| System | Multiplayer note |
|---|---|
| Action System | Execution on server; state on SECActionSetComponent. |
| Reaction System | Same bridge via SECReactionSetComponent. |
| Combat Roles | Subsystem on server; tag on SECCombatRoleComponent. |
| Melee Trace | Traces and damage on authority only. |
| Awareness System | Server-only perception. |
| Movement System | MovementEvaluatorComponent on server; CharacterMovementComponent replicates pose. |
AdvancedGameplayAbilityBase defaults
UGameplayAbilityBase constructor sets:NetExecutionPolicy = ServerInitiated;
ReplicationPolicy = ReplicateYes;
InstancingPolicy = InstancedPerActor;Server activates abilities; GAS replicates montage playback to clients.
AdvancedWorld tags on clients
USECWorldTagSubsystem mutators are server-only. For client reads, add USECWorldTagComponent to GameState. It mirrors subsystem tags through OnRep_Tags. USECWorldTagLibrary read helpers route by net mode.AdvancedClient HUD example
void UEnemyHUD::BindToPawn(APawn* Enemy)
{
if (auto* Health = Enemy->FindComponentByClass<UBasicHealthComponent>())
{
Health->OnHealthChanged.AddDynamic(this, &UEnemyHUD::RefreshBar);
Health->OnHealthDecreased.AddDynamic(this, &UEnemyHUD::FlashDamage);
}
if (auto* Actions = Enemy->FindComponentByClass<USECActionSetComponent>())
{
Actions->OnActionExecutionStarted.AddDynamic(this, &UEnemyHUD::ShowTelegraph);
}
if (auto* Role = Enemy->FindComponentByClass<USECCombatRoleComponent>())
{
Role->OnCombatRoleChanged.AddDynamic(this, &UEnemyHUD::SetRoleIcon);
}
}