Property Replication vs RPC: Choosing Under a Bandwidth Budget
Most networking problems are not "the API was called wrong" but "the wrong channel was chosen": state that should be replicated is sent as an RPC, and one-shot events are replicated every frame. This article puts both channels inside the same bandwidth budget — do the arithmetic first, then talk about style.
The property names and functions referenced here are stable interfaces of the UE5 networking layer. Default values and quantisation rules change between versions; check
NetDriver.cppandEngine/NetSerialization.hin the version you actually build.
The semantic difference
| Dimension | Property replication | RPC |
|---|---|---|
| What it carries | "what it is now" | "what just happened" |
| Reliability | unreliable, but the next update self-corrects | optional; reliable is not free |
| Cost of loss | one frame of stale value | the event is gone forever |
| Ordering | per property, later write wins | reliable RPCs are ordered, unreliable ones are not |
| Cost model | scales with change frequency | scales with call count |
| Typical misuse | replicating a health number every frame | synchronising position via RPC |
The rule is one sentence: anything that converges on a final state belongs to replication; only instantaneous, non-reconstructable events belong to RPC. Position, health and state enums converge. Firing, one-shot effects and interaction requests do not.
Cost a single actor first
Replication cost is not "how many bytes a property is", it is size × update frequency × relevant clients. Order-of-magnitude estimates:
| Type | Unquantised size | Note |
|---|---|---|
bool | 1 bit | multiple bools pack into one update |
uint8 / enum | 1 byte | the underlying width matters; do not use int32 for state |
float | 4 bytes | quantise to uint16 when precision allows |
FVector | 12 bytes | default precision is wasted on distant objects |
FRotator | 12 bytes | facing often needs only yaw |
| struct | sum of members + overhead | splitting fields with individual conditions is often cheaper |
Concrete example: 200 NPCs, 40 bytes each per update, NetUpdateFrequency at 2 Hz.
200 × 40 B × 2 /s = 16000 B/s ≈ 15.6 KB/s
That looks small, but it is one actor class only. Add the movement component, montage state and replicated gameplay abilities and the same crowd easily exceeds 100 KB/s downstream — while a 64-player server typically budgets tens of KB/s per client. The first optimisation is always lowering frequency and cutting fields, never a better compressor.
Relevancy: the cheapest optimisation available
The networking layer already only replicates actors that matter to a connection. Every tightening here is an order-of-magnitude change:
| Tool | Effect | Price |
|---|---|---|
NetCullDistanceSquared | stops replicating beyond a distance | pop-in at the boundary |
bOnlyRelevantToOwner | send to the owner only | nobody else sees it; fine for private items |
bNetUseOwnerRelevancy | inherit the owner's relevancy | the usual choice for vehicles and pets |
NetDormancy | stop updating while static; FlushNetDormancy() wakes it | forget to flush and it never moves again |
NetDormancy is the most overlooked item. NPCs idling in a queue are static; putting them in DORM_DormantAll and flushing only when they actually start moving beats any compression tweak. It is also the easiest to break: switch to dormant, forget the flush, and clients see an NPC frozen in place while the server believes everything is fine.
Conditional replication: declare what should not be sent
Every replicated property is registered in GetLifetimeReplicatedProps, where conditions can be attached:
void AVMAvatarCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// sent once at channel open: data that never changes again
DOREPLIFETIME_CONDITION(AVMAvatarCharacter, MeshVariantId, COND_InitialOnly);
// owner only: exact health for me, a percentage for everyone else
DOREPLIFETIME_CONDITION(AVMAvatarCharacter, Health, COND_OwnerOnly);
// skip the owner: it is already predicted locally
DOREPLIFETIME_CONDITION(AVMAvatarCharacter, MoveState, COND_SkipOwner);
// use the NOTIFY variant when a callback is required
DOREPLIFETIME_CONDITION_NOTIFY(AVMAvatarCharacter, TeamId, COND_None, REPNOTIFY_Always);
}
| Condition | Meaning | Common trap |
|---|---|---|
COND_None | default: every relevant connection | easiest way to waste bandwidth on owner-only data |
COND_InitialOnly | once at channel open | change the value later and clients never learn |
COND_OwnerOnly | owner only | reconnecting owners must redo initialisation |
COND_SkipOwner | everyone but the owner | the owner must predict, or it sees nothing |
COND_SimulatedOnly | simulated proxies only | autonomous proxies rely on prediction |
COND_Custom | decided in PreReplication | a wrong decision silently stops replication |
PreReplication is the place for "send only when in this state":
void AVMAvatarCharacter::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
Super::PreReplication(ChangedPropertyTracker);
// lock-on details only matter in combat
DOREPLIFETIME_ACTIVE_OVERRIDE(AVMAvatarCharacter, LockOnTargetId, bInCombat);
}
Priority and update rate: queueing inside a fixed budget
When there are more relevant actors than fit in one update, the layer sorts by NetPriority to decide who goes first. This decides who is deferred under congestion; it does not change total bandwidth.
| Parameter | Typical default | Guidance |
|---|---|---|
NetUpdateFrequency | 100 Hz | players 20–30, NPCs 2–5, static props 1 or dormant |
MinNetUpdateFrequency | 2 Hz | the floor under congestion; 0 means distant actors stop updating |
NetPriority | 1.0 | players > engaged NPCs > queued NPCs |
ForceNetUpdate() | — | push immediately on a state change instead of waiting a cycle |
A practical combination: NPCs idle at NetPriority = 0.5, NetUpdateFrequency = 3; on entering an interaction with a player, raise to NetPriority = 2 and ForceNetUpdate(), then drop back. Bandwidth goes where the player is looking.
The price of RPC is the word "reliable"
A reliable RPC enters the channel's reliable buffer and stays until acknowledged. Therefore:
- call rate above the round-trip rate means the buffer only grows
- an overflowing buffer drops the channel (the log shows a reliable buffer overflow style error); the player experiences a disconnect
- sending reliable RPCs from
Tickis the classic mistake: the higher the frame rate, the faster the connection dies
| Scenario | Right choice |
|---|---|
| Position every frame | replication (COND_SkipOwner) plus client prediction |
| Firing / hit events | unreliable RPC with server validation; losing one is acceptable |
| Interaction requests (must arrive) | reliable RPC, but rate-limited |
| Commands that must take effect | reliable RPC with idempotent server handling |
| Many small events | batch into one RPC, or promote to replicated state |
A reusable decision path
- Does this data converge on a final value? Yes → replication, step 2. No → RPC, step 4.
- How often does it change? Below 1 Hz, drop
NetUpdateFrequencyto match. - Does every client need it? No → add
COND_OwnerOnly/COND_InitialOnly/ distance culling. - What if the event is lost? Only a missing effect → unreliable. Game logic broken → reliable, and check the call rate.
- Finally capture packets and confirm the per-client downstream fits the budget, instead of "it does not feel laggy".
Common mistakes
| Pattern | Symptom | Correct approach |
|---|---|---|
| RPC for position | jitter at high latency, teleport after packet loss | replication plus client prediction |
| Reliable RPC every frame | disconnect after playing a while | unreliable, or batch and throttle |
Replicating an FString name | tens of constant bytes every update | a uint8 index into a data table |
Forgetting FlushNetDormancy | NPCs frozen on clients | flush explicitly on state change |
int32 for a state enum | 3 extra bytes × rate × players | uint8 with UENUM(BlueprintType) |
| Testing on localhost only | PIE has zero latency and hides everything | simulate with Net PktLag=100 and similar |
The last row matters most: on a LAN or in local PIE, replication problems barely surface. A scheme only counts as verified once it survives 100 ms latency with 5% packet loss.