Resource
Replication conditions, DOREPLIFETIME macros, RPCs, push model, net roles, relevancy, and custom serialization. The networking reference you keep going back to.
Conditions control when a property replicates. Pass them to DOREPLIFETIME_CONDITION or set them in FDoRepLifetimeParams. Every condition is evaluated per-connection.
COND_NoneNo condition. Property replicates every time it changes.
COND_InitialOnlyOnly replicates on the initial bunch. After first replication, never updates.
COND_OwnerOnlyOnly replicates to the actor's owner connection.
COND_SkipOwnerReplicates to every connection except the owner.
COND_SimulatedOnlyOnly replicates to simulated proxies (not the autonomous proxy).
COND_AutonomousOnlyOnly replicates to the autonomous proxy (the owning client).
COND_SimulatedOrPhysicsReplicates to simulated proxies or actors with bRepPhysics enabled.
COND_InitialOrOwnerReplicates on the initial bunch or to the owner connection.
COND_CustomNo built-in condition. Toggle replication on or off at runtime using DOREPCUSTOMCONDITION_SETACTIVE_FAST.
COND_ReplayOrOwnerReplicates to the replay connection or the owner.
COND_ReplayOnlyOnly replicates to the replay connection.
COND_SimulatedOnlyNoReplaySimulated proxies only, excluding replay connections.
COND_SimulatedOrPhysicsNoReplaySimulated or physics proxies, excluding replay connections.
COND_SkipReplayReplicates to all connections except replay.
COND_DynamicCondition is set at runtime. Defaults to always replicate until changed.
COND_NeverProperty never replicates.
COND_NetGroupSubobject replicates to connections in the same net group. Not valid for properties.
Controls when the OnRep callback fires. Set via DOREPLIFETIME_CONDITION_NOTIFY or the RepNotifyCondition field in FDoRepLifetimeParams.
REPNOTIFY_OnChangedOnly fires if the received value differs from the local value. This is the default.
REPNOTIFY_AlwaysFires every time the property is received from the server, even if the value hasn't changed.
All of these go inside GetLifetimeReplicatedProps. The _FAST variants use compile-time generated enums for faster property lookup.
DOREPLIFETIME(Class, Prop)Replicate with no conditions. The simplest form.
DOREPLIFETIME_CONDITION(Class, Prop, Cond)Replicate with a specific condition (COND_OwnerOnly, etc).
DOREPLIFETIME_CONDITION_NOTIFY(Class, Prop, Cond, NotifyCond)Replicate with condition and RepNotify behavior.
DOREPLIFETIME_WITH_PARAMS(Class, Prop, Params)Full control via FDoRepLifetimeParams struct.
DOREPLIFETIME_WITH_PARAMS_FAST(Class, Prop, Params)Optimized version using compile-time enums.
DISABLE_REPLICATED_PROPERTY(Class, Prop)Stop replicating a property inherited from a parent class.
DISABLE_REPLICATED_PRIVATE_PROPERTY(Class, Prop)Same as above but for private inherited properties.
DISABLE_ALL_CLASS_REPLICATED_PROPERTIES(Class, SuperBehavior)Disable all replicated properties of a class.
RESET_REPLIFETIME(Class, Prop)Reset inherited property replication to COND_None.
RESET_REPLIFETIME_CONDITION(Class, Prop, Cond)Change the replication condition of an inherited property.
The params struct gives full control over replication behavior. Pass it to DOREPLIFETIME_WITH_PARAMS.
ConditionELifetimeConditionCOND_NoneRepNotifyConditionELifetimeRepNotifyConditionREPNOTIFY_OnChangedbIsPushBasedboolfalseCreateAndRegisterReplicationFragmentFunctionUE::Net::CreateAndRegisterReplicationFragmentFuncnullptrRemote Procedure Calls execute a function on a different machine. The specifier determines direction. Reliable or Unreliable determines delivery guarantee.
ServerClient → ServerServer onlyRequires actor ownership. Pair with Reliable or Unreliable.
ClientServer → ClientOwning clientOnly the client that owns the actor receives it.
NetMulticastServer → AllServer + all clientsExecutes locally on server and replicates to every client.
ReliableGuaranteed delivery via reliable channel. Queue can overflow if overused.
UnreliableBest-effort delivery. May be dropped under congestion. Use for frequent calls.
WithValidationRequires _Validate function. Return false to reject RPC and disconnect client.
Every RPC requires a _Implementation function. The engine generates a thunk that routes the call over the network. WithValidation additionally requires a _Validate function that returns bool.
COND_Custom lets you toggle replication on/off at runtime. COND_Dynamic lets you change the condition itself at runtime.
DOREPCUSTOMCONDITION_SETACTIVE_FAST(Class, Prop, bActive)Toggle a COND_Custom property on or off at runtime.
DOREPDYNAMICCONDITION_INITCONDITION_FAST(Class, Prop, Cond)Set initial condition for a COND_Dynamic property.
DOREPDYNAMICCONDITION_SETCONDITION_FAST(Class, Prop, Cond)Change a COND_Dynamic property's condition at runtime.
DOREPLIFETIME_ACTIVE_OVERRIDE_FAST(Class, Prop, bActive)Override whether a property is active for replication.
By default, the engine polls every replicated property every frame to check if it changed. Push model skips the polling — you tell the engine when a property is dirty. This saves CPU on actors with many replicated properties that rarely change.
bIsPushBased = true in FDoRepLifetimeParams when registering the property.MARK_PROPERTY_DIRTY_FROM_NAME or UNetPushModelHelpers::MarkPropertyDirty whenever you change the value.Use these instead of raw FVector for replicated properties to reduce bandwidth. Each trades precision for smaller packet size.
FVector_NetQuantize0 decimals20 bitsFVector_NetQuantize101 decimal24 bitsFVector_NetQuantize1002 decimals30 bitsFVector_NetQuantizeNormalNormalized (-1 to 1)16 bitsEvery actor has a local role and a remote role. Check GetLocalRole() to know what this machine is responsible for.
ROLE_AuthorityThis machine owns the authoritative state. On the server for replicated actors.
ROLE_AutonomousProxyClient-controlled proxy. The owning client predicts movement and sends input to the server.
ROLE_SimulatedProxyServer-controlled proxy on a non-owning client. State is received from the server and interpolated.
ROLE_NoneNo role assigned. The actor is not replicated or has not been initialized for networking.
These properties on AActor control how the actor behaves in a networked context.
bReplicatesboolMaster flag. If false, nothing on this actor replicates.NetUpdateFrequencyfloatHow often (Hz) the actor considers replicating. Default is 100.MinNetUpdateFrequencyfloatFloor for adaptive replication frequency.NetPriorityfloatRelative priority for bandwidth allocation. Higher = more bandwidth.NetCullDistanceSquaredfloatSquared distance beyond which the actor is not relevant to a connection.An actor is only replicated to connections it's relevant to. Override IsNetRelevantFor for custom logic.
bAlwaysRelevant — actor replicates to every connection regardless of distance.bOnlyRelevantToOwner — actor only replicates to its owning connection.bNetUseOwnerRelevancy — defer relevancy check to the owner actor.NetCullDistanceSquared — distance-based relevancy culling.IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation) — override for custom relevancy logic.For structs that need tighter control over what bytes go over the wire.
NetSerializeFull custom serialization for a USTRUCT. Implement on the struct and set WithNetSerializer in TStructOpsTypeTraits.
NetDeltaSerializeDelta compression. Only sends what changed since the last acknowledged state. Used by FastArraySerializer.
SafeNetSerializeTArray_Default<MaxNum>Serialize a TArray with a max element count to prevent malicious allocation.
SafeNetSerializeTArray_WithNetSerialize<MaxNum>Same but calls NetSerialize on each element instead of the << operator.
SerializeOptionalValueSerialize a value only if it differs from the default. Costs 1 bit when value matches default.