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

Filtering Variable Updates Using Replication Frequency

You will adjust replication frequency settings to control how often variable changes are pushed to clients for performance optimization.

In this lesson, you will learn how to optimize your network bandwidth by explicitly controlling how often the server updates specific actor properties to connected clients.

Mastering NetUpdateFrequency

While GetLifetimeReplicatedProps handles what data gets replicated, NetUpdateFrequency defines how often the server attempts to replicate that data for an actor. By default, Unreal Engine uses a fixed frequency (often 100Hz for character movement), but blindly replicating every variable at that rate is a common cause of network congestion in complex multiplayer games.

The core concept here is Throttling. Not every variable needs to change 100 times per second. For example, a "Player Rank" or a "Current Inventory Weight" variable only needs to be pushed when it changes, and definitely doesn't require a high-frequency heartbeat. If you have an actor that performs many minor updates, you can lower its NetUpdateFrequency to reduce the CPU cost of serialization and the total bandwidth consumption.

Controlling Frequency via C++

You can set this in your Actor’s constructor. If an actor is purely cosmetic or handles slow-changing game states, dropping the frequency significantly can save massive amounts of overhead:

AMyLowPriorityActor::AMyLowPriorityActor()
{
    // Lower the update frequency to 5 times per second (default is often 100)
    NetUpdateFrequency = 5.0f;
    
    // Ensure the actor is set to replicate
    bReplicates = true;
}

Strategic Trade-offs

When you lower the NetUpdateFrequency, you are essentially introducing a "polling latency." If you set a frequency of 2Hz, a client might wait up to 0.5 seconds to see a change in a replicated property.

To optimize effectively:

  1. Identify high-frequency vs. low-frequency actors: Separate your gameplay logic so that fast-paced objects (projectiles, movement) have high frequencies, while environmental objects or scoreboards have low frequencies.
  2. Use NetPriority: Pair your frequency settings with NetPriority to ensure that when bandwidth is limited, the engine drops updates for low-priority actors first, keeping your core gameplay fluid.

Key Takeaway: By adjusting NetUpdateFrequency, you balance network responsiveness against bandwidth constraints, ensuring only essential data consumes your limited network throughput.