Navigation
API > API/Plugins > API/Plugins/MultiServerReplication
A network proxy that intercepts and forwards UE game network connections to backend game servers.
The proxy externally behaves the same as a normal game server when game clients connect and as a normal client when connecting to game servers. This means that there is no need for the clients and game servers that the proxy is connected to have any special proxy-aware configuration.
Internally, the proxy is made up of an instance of UProxyNetDriver that listens for incoming connections, known as proxy connections, and an instance of UProxyBackendNetDriver for each connection to a backend game server. State from the backend servers is replicated into a single, shared UWorld and the listening UProxyNetDriver replicates that state out to proxy connections.
All actors replicated to the proxy from remote game servers will have the same role as a client (ROLE_SimulatedProxy or ROLE_AutonomousProxy) and will be replicated as-is to the proxy client.
When a proxy connection (UNetConnection) is opened in UProxyNetDriver it opens a game server connection (UNetConnection) to each registered backend server.
For each proxy connection one of the game servers are considered the primary game server. This is the game server that spawns the proxy client's pawn, player controller, receive RPCs from the proxy connection, and send RPCs to the proxy connection. The other game servers are considered non-primary game servers and only replicate state relevant to that connection to the proxy.
When connecting to non-primary game servers the game server will spawn a ANoPawnPlayerController player controller, and not spawn a pawn. These connections will replicate state from the game server but not maintain a player presence.
| Name | UProxyNetDriver |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MultiServerReplication/Source/MultiServerReplication/Public/MultiServerProxy.h |
| Include Path | #include "MultiServerProxy.h" |
Syntax
UCLASS ()
class UProxyNetDriver : public UIpNetDriver
Inheritance Hierarchy
- FExec → UNetDriver → UIpNetDriver → UProxyNetDriver
- UObjectBase → UObjectBaseUtility → UObject → UNetDriver → UIpNetDriver → UProxyNetDriver
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bCyclePrimaryGameServer | bool | After a client connects to the proxy increment the value of PrimaryGameServerForNextClient. | MultiServerProxy.h | |
| bRandomizePrimaryGameServerForNextClient | bool | As a client connects to the proxy, randomize PrimaryGameServerForNextClient to one of the known game servers. | MultiServerProxy.h | |
| DeferredReassignment | TMap< TObjectPtr< UNetConnection >, FPlayerControllerReassignment > | MultiServerProxy.h | ||
| GameServerConnections | TArray< FGameServerConnectionState > | Net drivers and associated state used to connect to backend game servers. | MultiServerProxy.h | |
| InternalRoutes | TMap< uint32, FMultiServerProxyInternalConnectionRoute > | Map client handshake ids to a route data structure. | MultiServerProxy.h | |
| NextClientHandshakeId | uint32 | MultiServerProxy.h | ||
| NextGameServerClientId | int32 | MultiServerProxy.h | ||
| PlayerToPrimaryGameServerPlayerController | TMap< TObjectPtr< class ULocalPlayer >, TObjectPtr< const APlayerController > > | Map a player to it's primary game server player controller. | MultiServerProxy.h | |
| PrimaryGameServerForNextClient | int32 | The primary game server to use for the next primary game client. | MultiServerProxy.h | |
| ProxyConnectionToPrimaryGameServerPlayerController | TMap< TObjectPtr< UNetConnection >, TObjectPtr< const APlayerController > > | Map a proxy connection to the primary game server player controller. | MultiServerProxy.h | |
| ProxyListenerNotify | TObjectPtr< UProxyListenerNotify > | Proxy listener handshake logic. | MultiServerProxy.h | |
| SharedBackendNetGuidCache | TSharedPtr< FNetGUIDCache > | A single NetGUID cache used by all netdrivers used to connect to backend servers. | MultiServerProxy.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void FlushSplitJoinRequests
(
FGameServerConnectionState* GameServerConnectionState |
Send any split join requests that have been queued up to the game server. | MultiServerProxy.h | |
void GameServerAssignPlayerController
(
UNetConnection* ChildGameServerConnection, |
Called when the player controller associated with a connection is changed (either at the end of initial connection handshake, or if changed after successfully connected). | MultiServerProxy.h | |
int32 GetGameServerChildConnectionCount() |
Return the number of child connections to the game servers. | MultiServerProxy.h | |
FGameServerConnectionState * GetGameServerConnection
(
int32 Index |
MultiServerProxy.h | ||
int32 GetGameServerConnectionCount() |
Enumerate through all outgoing connections to game servers. | MultiServerProxy.h | |
uint32 GetNextClientHandshakeId() |
Get the next connection handshake id. | MultiServerProxy.h | |
int32 GetNextGameServerClientId() |
Get the next identifier for outgoing connections to game servers. | MultiServerProxy.h | |
TSharedPtr< FNetGUIDCache > GetSharedBackendNetGuidCache() |
Return a pointer to the shared NetGUID cache used by backend network connections. | MultiServerProxy.h | |
void HandleClosedProxyConnection
(
UNetConnection* ProxyConnection |
Called when an incoming proxy connection has been closed and closes connections to backend servers. | MultiServerProxy.h | |
bool IsConnectedToAllGameServers() |
Return true if all registered servers are connected. | MultiServerProxy.h | |
void RegisterGameServer
(
const FURL& GameServerURL |
Register a game server. | MultiServerProxy.h |
Overridden from UNetDriver
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AddNetworkActor
(
AActor* Actor |
MultiServerProxy.h | ||
virtual bool CanDowngradeActorRole
(
UNetConnection* ProxyConnection, |
MultiServerProxy.h | ||
| MultiServerProxy.h | |||
virtual bool InitBase
(
bool bInitAsClient, |
UNetDriver interface function. | MultiServerProxy.h | |
virtual bool InitConnect
(
FNetworkNotify* InNotify, |
MultiServerProxy.h | ||
virtual void InternalProcessRemoteFunction
(
AActor* Actor, |
MultiServerProxy.h | ||
virtual void NotifyActorChannelOpen
(
UActorChannel* Channel, |
MultiServerProxy.h | ||
virtual void RemoveNetworkActor
(
AActor* Actor |
MultiServerProxy.h | ||
virtual int32 ServerReplicateActors
(
float DeltaSeconds |
MultiServerProxy.h | ||
virtual void SetupNetworkMetrics() |
MultiServerProxy.h | ||
virtual bool ShouldCallRemoteFunction
(
UObject* Object, |
MultiServerProxy.h | ||
| MultiServerProxy.h | |||
virtual void Shutdown() |
MultiServerProxy.h | ||
virtual void TickFlush
(
float DeltaSeconds |
MultiServerProxy.h |