UReplicationGraph

Manages actor replication for an entire world / net driver

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

ReplicationGraph

Header

/Engine/Plugins/Runtime/ReplicationGraph/Source/Public/ReplicationGraph.h

Include

#include "ReplicationGraph.h"

Syntax

UCLASS(Transient, Config=Engine)
class UReplicationGraph : public UReplicationDriver

Remarks

Manages actor replication for an entire world / net driver

Variables

Name Description

Protected variable

TSet< AActor &#...

 

ActiveNetworkActors

The authoritative set of "what actors are in the graph"

Protected variable

bool

 

bEnableFullActorPrioritizationDetailsAllConnections

Public variable UProperty

TArray< TObject...

 

Connections

List of connection managers. This list is not sorted and not stable.

Protected variable

TArray< UNetCon...

 

ConnectionsNeedingsPostTickDispatchFlush

Connections needing a FlushNet in PostTickDispatch

Protected variable

FReplicationGra...

 

CSVTracker

Public variable

float

 

DestructInfoMaxDistanceSquared

The max distance between an FActorDestructionInfo and a connection that we will replicate.

Public variable

FFastSharedPath...

 

FastSharedPathConstants

Protected variable

FOutBunch *

 

FastSharedReplicationBunch

Protected variable

UActorChannel &...

 

FastSharedReplicationChannel

Protected variable

FName

 

FastSharedReplicationFuncName

Protected variable

uint32

 

GlobalActorChannelFrameNumTimeout

How long, in frames, without replicating before an actor channel is closed on a connection.

Protected variable

FGlobalActorRep...

 

GlobalActorReplicationInfoMap

Protected variable UProperty

TArray< TObject...

 

GlobalGraphNodes

A list of nodes that can add actors to all connections.

Protected variable

TSharedPtr< FRe...

 

GraphGlobals

Public variable UProperty

TObjectPtr< UNe...

 

NetDriver

Public variable UProperty

TArray< TObject...

 

PendingConnections

ConnectionManagers that we have created but haven't officially been added to the net driver's ClientConnection list.

Protected variable UProperty

TArray< TObject...

 

PrepareForReplicationNodes

A list of nodes that want PrepareForReplication() to be called on them at the top of the replication frame.

Public variable

FPrioritization...

 

PrioritizationConstants

Protected variable

FPrioritizedRep...

 

PrioritizedReplicationList

Temporary List we use while prioritizing actors

Public variable UProperty Config

TSubclassOf< UN...

 

ReplicationConnectionManagerClass

The per-connection manager class to instantiate.

Protected variable

TClassMap< bool...

 

RPC_Multicast_OpenChannelForClass

Protected variable

TMap< FObjectKe...

 

RPCSendPolicyMap

Special case handling of specific RPCs. Currently supports immediate send/flush for multicasts

Constructors

Name Description

Public function

UReplicationGraph()

Functions

Name Description

Public function

void

 

AddConnectionGraphNode

(
    UReplicationGraphNode* GraphNo...,
    UNetConnection* NetConnection
)

Public function

void

 

AddConnectionGraphNode

(
    UReplicationGraphNode* GraphNo...,
    UNetReplicationGraphConnection*...
)

Associate a node to a specific connection.

Public function

void

 

AddGlobalGraphNode

(
    UReplicationGraphNode* GraphNo...
)

Add a global node to the root that will have a chance to emit actor rep lists for all connections

Protected function Virtual

void

 

AddReplayViewers

(
    UNetConnection* NetConnection,
    FNetViewerArray& Viewers
)

Public function Virtual Const

void

 

CollectRepListStats

(
    FActorRepListStatCollector& StatCo...
)

Public function Virtual Const

AReplication...

 

CreateDebugActor()

Public function

T *

 

CreateNewNode()

Creates a new node for the graph.

Public function Const

void

 

DebugPrintCullDistances

Print the Net Culling Distance of all actors in the RepGraph.

Protected function

UNetReplicat...

 

FindOrAddConnectionManager

(
    UNetConnection* NetConnection
)

Public function Const

const TShare...

 

GetGraphGlobals()

Public function Const

uint32

 

GetReplicationGraphFrame()

Public function Const

uint16

 

GetReplicationPeriodFrameForFrequency

(
    float NetUpdateFrequency
)

Public function Virtual Const

UWorld *

 

GetWorld()

Protected function

void

 

HandleStarvedActorList

(
    const FPrioritizedRepList& List,
    int32 StartIdx,
    FPerConnectionActorInfoMap& Connec...,
    uint32 FrameNum
)

Protected function Virtual

void

 

InitConnectionGraphNodes

Override this function to init/configure graph for a specific connection.

Protected function Virtual

void

 

InitGlobalActorClassSettings()

Override this function to initialize the per-class data for replication

Protected function Virtual

void

 

InitGlobalGraphNodes()

Override this function to init/configure your project's Global Graph

Protected function Virtual

void

 

InitializeForWorld

(
    UWorld* World
)

Protected function Virtual

void

 

InitNode

(
    UReplicationGraphNode* Node
)

Public function

bool

 

IsConnectionReady

(
    UNetConnection* Connection
)

Public function Virtual Const

void

 

LogConnectionGraphNodes

(
    FReplicationGraphDebugInfo& DebugI...
)

Public function Virtual Const

void

 

LogGlobalGraphNodes

(
    FReplicationGraphDebugInfo& DebugI...
)

Public function Virtual Const

void

 

LogGraph

(
    FReplicationGraphDebugInfo& DebugI...
)

Public function

void

 

NotifyConnectionSaturated

Protected function Virtual

void

 

PostServerReplicateStats

(
    const FFrameReplicationStats& Stat...
)

Event called after ServerReplicateActors to dispatch the replication stats from this frame

Public function

void

 

RemoveConnectionGraphNode

(
    UReplicationGraphNode* GraphNo...,
    UNetReplicationGraphConnection*...
)

Public function

void

 

RemoveConnectionGraphNode

(
    UReplicationGraphNode* GraphNo...,
    UNetConnection* NetConnection
)

Public function

void

 

RemoveGlobalGraphNode

(
    UReplicationGraphNode* GraphNo...
)

Protected function

void

 

ReplicateActorListsForConnections_Default

(
    UNetReplicationGraphConnection*...,
    FGatheredReplicationActorLists& Ga...,
    FNetViewerArray& Viewers
)

Default Replication Path

Protected function

void

 

ReplicateActorListsForConnections_FastShared

(
    UNetReplicationGraphConnection*...,
    FGatheredReplicationActorLists& Ga...,
    FNetViewerArray& Viewers
)

"FastShared" Replication Path

Public function Virtual

void

 

ReplicateActorsForConnection

(
    UNetConnection* NetConnection,
    FPerConnectionActorInfoMap& Connec...,
    UNetReplicationGraphConnection*...,
    const uint32 FrameNum
)

Public function

int64

 

ReplicateSingleActor

(
    AActor* Actor,
    FConnectionReplicationActorInfo& A...,
    FGlobalActorReplicationInfo& Globa...,
    FPerConnectionActorInfoMap& Connec...,
    UNetReplicationGraphConnection& Co...,
    const uint32 FrameNum
)

Public function

int64

 

ReplicateSingleActor_FastShared

(
    AActor* Actor,
    FConnectionReplicationActorInfo& C...,
    FGlobalActorReplicationInfo& Globa...,
    UNetReplicationGraphConnection& Co...,
    const uint32 FrameNum
)

Public function Virtual

void

 

RouteAddNetworkActorToNodes

(
    const FNewReplicatedActorInfo& Act...,
    FGlobalActorReplicationInfo& Globa...
)

Public function Virtual

void

 

RouteRemoveNetworkActorToNodes

(
    const FNewReplicatedActorInfo& Act...
)

Public function

void

 

SetActorDestructionInfoToIgnoreDistanceCulling

(
    AActor* DestroyedActor
)

Public function

void

 

SetActorDiscoveryBudget

(
    int32 ActorDiscoveryBudgetInKBytesP...
)

Public function

void

 

SetAllCullDistanceSettingsForActor

(
    const FActorRepListType& Actor,
    float CullDistanceSquared
)

Sets the global and connection-specific cull distance setting of this actor

Public function Const

void

 

UpdateActorChannelCloseFrameNum

(
    AActor* Actor,
    FConnectionReplicationActorInfo& C...,
    const FGlobalActorReplicationInfo&...,
    const uint32 FrameNum,
    UNetConnection* NetConnection
)

Overridden from UReplicationDriver

Name Description

Public function Virtual

void

 

AddClientConnection

(
    UNetConnection* NetConnection
)

Called by the NetDriver when the client connection is ready/added to the NetDriver's client connection list

Public function Virtual

void

 

AddNetworkActor

(
    AActor* Actor
)

Public function Virtual

void

 

FlushNetDormancy

(
    AActor* Actor,
    bool bWasDormInitial
)

Public function Virtual

void

 

ForceNetUpdate

(
    AActor* Actor
)

Public function Virtual

void

 

InitForNetDriver

(
    UNetDriver* InNetDriver
)

Called to associate a netdriver with a rep driver.

Public function Virtual

void

 

InitializeActorsInWorld

(
    UWorld* InWorld
)

Called after World and NetDriver have been set.

Public function Virtual

void

 

NotifyActorDormancyChange

(
    AActor* Actor,
    ENetDormancy OldDormancyState
)

Public function Virtual

void

 

NotifyActorFullyDormantForConnection

(
    AActor* Actor,
    UNetConnection* Connection
)

Public function Virtual

void

 

NotifyActorTearOff

(
    AActor* Actor
)

Public function Virtual

void

 

NotifyDestructionInfoCreated

(
    AActor* Actor,
    FActorDestructionInfo& Destruction...
)

Called when a destruction info is created for an actor.

Public function Virtual

void

 

PostTickDispatch()

Called after the netdriver has handled TickDispatch

Public function Virtual

bool

 

ProcessRemoteFunction

(
    AActor* Actor,
    UFunction* Function,
    void* Parameters,
    FOutParmRec* OutParms,
    FFrame* Stack,
    UObject* SubObject
)

Handles an RPC.

Public function Virtual

void

 

RemoveClientConnection

(
    UNetConnection* NetConnection
)

Public function Virtual

void

 

RemoveNetworkActor

(
    AActor* Actor
)

Public function Virtual

void

 

ResetGameWorldState()

Public function Virtual

int32

 

ServerReplicateActors

(
    float DeltaSeconds
)

The main function that will actually replicate actors. Called every server tick.

Public function Virtual

void

 

SetRepDriverWorld

(
    UWorld* InWorld
)

Called to associate a world with a rep driver. This will be called before InitForNetDriver

Public function Virtual

void

 

SetRoleSwapOnReplicate

(
    AActor* Actor,
    bool bSwapRoles
)

Public function Virtual

void

 

TearDown()

Overridden from UObject

Name Description

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Classes

Name

Description

Public struct

FFastSharedPathConstants

Protected struct

FFrameReplicationStats

Collects basic stats on the replicated actors

Public struct

FPrioritizationConstants

Prioritization Constants: these affect how the final priority of an actor is calculated in the prioritize phase

Constants

Name

Description

OnListRequestExceedsPooledSize

Invoked when a rep list is requested that exceeds the size of the preallocated lists