Replicating Functions

Function Replication (Remote Procedure Calls or RPCs for short) are functions that are called locally, but executed remotely on another machine (separate from the machine performing the call). RPC functions can be very useful and allow either the Client or the Server to send messages to each other over a network connection. Replicated function calls can be set to either Reliable or Unreliable where Reliable calls are guaranteed to occur, while Unreliable calls may be dropped during heavy network traffic. Most Replicated Functions that handle cosmetic visuals are unreliable to avoid saturating the network.

There are 3 primary types of Replicated Functions: Multicast, Run on Server, and Run on owning Client. Multicast functions should be called on the Server, where they are executed, and then forwarded automatically to Clients. Server functions are called by a Client and then only executed on the Server. Client functions are called by the Server and then only execute on the owning Client.

Server and Client Replicated Functions have some restrictions, for one they can only be used on Actors that have a Net Owner. Actors have Net Owners if they are a Player Controller or owned by a Player Controller. For example, a Pawn possessed by a Player Controller can have Server or Client Replicated Functions executed upon it.

Implementation Guides