net.PushModelSkipUndirtiedReplication

net.PushModelSkipUndirtiedReplication

#Overview

name: net.PushModelSkipUndirtiedReplication

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.PushModelSkipUndirtiedReplication is to optimize network replication by skipping the replication of objects that are known to be clean (not dirty).

This setting variable is primarily used in the networking and replication subsystem of Unreal Engine 5. It’s specifically related to the Push Model replication system, which is an optimization technique for network replication.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as a boolean value, initialized to false, and can be changed at runtime through the console or configuration files.

The associated variable GbPushModelSkipUndirtiedReplicators directly interacts with this console variable. They share the same value, with the console variable controlling the global boolean flag.

Developers must be aware that enabling this variable can significantly impact replication behavior. When set to true, it will skip replication for objects that are determined to be clean, which can reduce network traffic but might also lead to missed updates if not used carefully.

Best practices when using this variable include:

  1. Thoroughly testing the game’s networking behavior with this option both enabled and disabled.
  2. Ensuring that all replicated objects correctly mark themselves as dirty when they change.
  3. Monitoring network performance and object state consistency when this option is enabled.

Regarding the associated variable GbPushModelSkipUndirtiedReplicators:

This is the actual boolean flag used in the engine code to control the behavior. It’s used in the FObjectReplicator::InitWithObject function to determine if the non-dirty optimization can be used for a particular object.

The purpose of GbPushModelSkipUndirtiedReplicators is to provide a runtime-accessible flag for the engine’s replication system to check whether it should skip replicating clean objects.

This variable is used in the Engine module, specifically in the data replication system.

Its value is set by the console variable net.PushModelSkipUndirtiedReplication.

It interacts directly with the RepLayout and RepState systems, influencing how object replication is handled.

Developers should be aware that this flag’s effect depends on the replication layout of objects and the current replication state. It’s not a universal optimization that applies to all objects equally.

Best practices include ensuring that objects using this optimization correctly implement dirty state tracking and thoroughly testing replication behavior with various network conditions when this optimization is enabled.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:71

Scope: file

Source code excerpt:

bool GbPushModelSkipUndirtiedReplicators = false;
FAutoConsoleVariableRef CVarPushModelSkipUndirtiedReplicators(
	TEXT("net.PushModelSkipUndirtiedReplication"),
	GbPushModelSkipUndirtiedReplicators,
	TEXT("When true, skip replicating any objects that we can safely see aren't dirty."));

bool GbPushModelSkipUndirtiedFastArrays = false;
FAutoConsoleVariableRef CVarPushModelSkipUndirtiedFastArrays(
	TEXT("net.PushModelSkipUndirtiedFastArrays"),

#Associated Variable and Callsites

This variable is associated with another variable named GbPushModelSkipUndirtiedReplicators. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:69

Scope: file

Source code excerpt:

);

bool GbPushModelSkipUndirtiedReplicators = false;
FAutoConsoleVariableRef CVarPushModelSkipUndirtiedReplicators(
	TEXT("net.PushModelSkipUndirtiedReplication"),
	GbPushModelSkipUndirtiedReplicators,
	TEXT("When true, skip replicating any objects that we can safely see aren't dirty."));

bool GbPushModelSkipUndirtiedFastArrays = false;
FAutoConsoleVariableRef CVarPushModelSkipUndirtiedFastArrays(
	TEXT("net.PushModelSkipUndirtiedFastArrays"),
	GbPushModelSkipUndirtiedFastArrays,

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:556

Scope (from outer to inner):

file
function     void FObjectReplicator::InitWithObject

Source code excerpt:

	{
		bCanUseNonDirtyOptimization =
			GbPushModelSkipUndirtiedReplicators &&
			(RepLayout->IsEmpty() || EnumHasAnyFlags(RepLayout->GetFlags(), ERepLayoutFlags::FullPushSupport));
	}
	else
	{
		bCanUseNonDirtyOptimization =
			GbPushModelSkipUndirtiedReplicators &&
			(RepLayout->IsEmpty() || EnumHasAnyFlags(RepLayout->GetFlags(), ERepLayoutFlags::FullPushProperties)) &&
			RepState->GetSendingRepState() &&
			RepState->GetSendingRepState()->RecentCustomDeltaState.Num() == 0;
	}
}