Course contentsShow
← Unreal Engine Game Development
Lesson 757 of 88010. Networking and ReplicationFree lesson

Optimizing RPCs with Reliable and Unreliable Channels

Distinguish between critical and transient game events to choose the appropriate RPC reliability settings, preventing unnecessary network buffer bloat.

In this lesson, you will learn how to distinguish between critical and transient game events to choose the correct RPC reliability setting, effectively preventing network buffer bloat.

In Unreal Engine, choosing between Reliable and Unreliable RPCs is a fundamental decision that dictates how your game handles packet loss and bandwidth consumption. When you mark an RPC as Reliable, the engine guarantees that the message will arrive at the destination, even if it requires retransmission. Conversely, Unreliable RPCs are "fire and forget"—if a packet is lost during transit, the message is simply discarded.

Identifying the Right Tool

To keep your network traffic lean, you must categorize your game events:

  • Critical Events: These are essential state changes that must be processed to maintain game integrity. Examples include spawning an inventory item, triggering a gameplay win condition, or changing an ownership state. If these are lost, the game client and server desynchronize permanently. Use Reliable for these.
  • Transient Events: These are time-sensitive updates where the current value matters, but losing a single packet is irrelevant because a newer update will follow immediately. Examples include real-time cosmetic effects, footstep particles, or non-critical voice feedback. Using Reliable for these is dangerous because if a packet is dropped, the engine queues subsequent messages in a buffer, waiting for the missing packet to be acknowledged. This causes "Head-of-Line Blocking," inflating your latency and bloating the network buffer.

Practical Implementation

When declaring your functions in the header, keep your business logic categorized:

// Critical: Must happen exactly once to avoid desync
UFUNCTION(Server, Reliable, WithValidation)
void Server_PurchaseItem(int32 ItemID);

// Transient: Frequent updates; loss is acceptable
UFUNCTION(NetMulticast, Unreliable)
void Multicast_PlayFootstepEffect(FVector Location);

By defaulting to Unreliable for high-frequency or cosmetic events, you allow the engine to discard stale data when the network is congested. This keeps your buffer clear and ensures that your critical, Reliable traffic is never waiting behind non-essential data.

Key Takeaway: Reserve Reliable RPCs exclusively for state-critical events that require guaranteed delivery, and utilize Unreliable RPCs for high-frequency, transient updates to prevent network buffer bloat and latency spikes.