Skip to content
TECHNICALLYARTIST
FAB

Multiplayer & Replication

Resource Gathering Minions is server-authoritative by design. The same setup works in single player with no extra steps, but networked games need to get authority and ownership right.

The Gatherer Component only runs its logic on an owner that has authority. In single player your pawns have authority automatically, so everything just works. In multiplayer, the server has authority, and the minion must be owned by the player who is commanding it so client requests can route to the server.

Try Begin Assignment is a reliable server function: calling it on a client forwards the call to the server, but only if the calling client owns the minion.

When you spawn minions at runtime in multiplayer, set the new minion’s Owner to the controlling Player Controller. A typical server-side spawn does:

  1. Spawn the minion character.
  2. Possess it with an AI Controller.
  3. Call Set Owner on the minion, passing the commanding Player Controller.

With ownership set, that player’s Try Begin Assignment calls reach the server and drive the minion. The plugin’s demo project (BP_Player) shows a client requesting the server to spawn a minion and assigning ownership this way.

A client has no authority, so input runs a Run on Server event rather than spawning the minion directly:

A key press calling a Server Spawn Minion event that is replicated to the server

The custom event's Replicates option set to Run on Server

On the server, spawn the minion, possess it with an AI Controller, then set its owner to the commanding player:

The server event spawning the BP_Minion actor

Spawning an AI Controller and possessing the minion, tracked in a Last Spawned Minion variable

Set Owner called on the minion with the commanding player's controller so it can run server RPCs

ReplicatedOnWhy
Current Gathering StateGatherer ComponentSo clients can play the right animation (idle / extracting / carrying).
Extractions RemainingResource ComponentDrives the resource removing itself on every machine when it is used up.
Gatherer referenceExtracted Resource ComponentLets the carried actor react to being dropped on all machines.

The Gatherer also sets the spawned carried actor and any Home Actor to replicate when it creates them, so you do not have to. The one thing you must do yourself is enable Replicates on your resource actor (the tree, the rock): without it, Extractions Remaining cannot replicate and the resource will not disappear on clients when it is exhausted.

The resource actor's Replicates checkbox enabled in Class Defaults

Ownership shifts briefly during extraction so the right machine can run the right code:

  • When the minion overlaps a resource, it sets itself as the owner of that resource actor so the resource’s server-side extraction can execute, then clears that ownership when the minion leaves.
  • The spawned carried actor is owned by the minion’s owner (the commanding player), keeping the whole chain under that player’s authority.

This is handled internally; it is described here so the ownership changes you may see at runtime are not a surprise.