In this lesson, you will learn how to leverage Net Dormancy states to minimize the overhead of maintaining actor channels for objects that aren't actively interacting with the player.
The Concept of Actor Channels
In a large-scale networked world, every AActor that is relevant to a client consumes a "channel" on the NetDriver. Channels are finite resources; if your world is filled with thousands of ambient objects—like destructible props or interactable foliage—the server will struggle to manage the bandwidth and processing required to keep these objects in sync. To optimize this, we don't need to replicate state for objects that haven't changed. This is where Net Dormancy comes in.
Managing State with Net Dormancy
Net Dormancy allows you to tell the server: "This object is static; don't waste bandwidth checking it until something changes." By setting an actor to DORM_Initial or DORM_DormantAll, you effectively close its active update cycle on the network.
When an actor is dormant, it stops sending property updates. If a local interaction occurs (e.g., a player shoots a dormant crate), you must "flush" the dormancy to wake the actor up.
Implementation Example
You typically configure this in the constructor or upon initialization:
// Set the actor to be dormant by default
NetDormancy = DORM_DormantAll;
To wake the actor up when a state change occurs, use ForceNetUpdate():
void AMyInteractableActor::OnRep_Health()
{
// If we were dormant, the server will now
// re-evaluate and begin replicating again.
ForceNetUpdate();
}
By pushing ambient, distant, or static objects into a dormant state, you drastically reduce the number of active channels the server must iterate through each frame. This frees up the NetDriver to prioritize critical gameplay data like character movement and combat events, which are essential for maintaining a smooth, high-fidelity experience in large, open-world environments.
Key Takeaway: Use Net Dormancy to offload static or inactive actors from the replication pipeline, preserving your limited network channels for the high-priority data that defines the immediate player experience.