net.PushModelSkipUndirtiedFastArrays

net.PushModelSkipUndirtiedFastArrays

#Overview

name: net.PushModelSkipUndirtiedFastArrays

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.PushModelSkipUndirtiedFastArrays is to optimize network replication in Unreal Engine by controlling whether fast arrays should be included when skipping objects that are not dirty during the push model replication process.

This setting variable is primarily used in the networking and replication system of Unreal Engine. Based on the callsites, it’s evident that this variable is utilized in the Engine module, specifically in the data replication subsystem.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized as a global boolean variable GbPushModelSkipUndirtiedFastArrays and linked to the console variable “net.PushModelSkipUndirtiedFastArrays” using FAutoConsoleVariableRef.

This variable interacts closely with another variable, GbPushModelSkipUndirtiedReplicators. They work together to determine if the non-dirty optimization can be used in the FObjectReplicator::InitWithObject function.

Developers must be aware that enabling this variable will affect the replication behavior of fast arrays. When set to true, it will include fast arrays in the optimization that skips replicating objects that aren’t dirty. This can potentially improve network performance but may also introduce risks if not properly managed.

Best practices when using this variable include:

  1. Thoroughly testing the impact on your game’s networking performance and behavior before enabling it in production.
  2. Monitoring the effects on network traffic and ensuring that all necessary data is still being replicated correctly.
  3. Using it in conjunction with other networking optimizations and settings for best results.
  4. Being cautious when enabling it for games that heavily rely on frequent updates of fast array data.

Regarding the associated variable GbPushModelSkipUndirtiedFastArrays:

This is the actual boolean variable that stores the state of the “net.PushModelSkipUndirtiedFastArrays” setting. It’s initialized to false by default and is used directly in the engine code to control the behavior described above.

The purpose of GbPushModelSkipUndirtiedFastArrays is to provide a quick, runtime-accessible flag for the engine to check when determining whether to apply the fast array optimization during replication.

This variable is set by the console variable system and is used in the Engine module’s data replication system.

Developers should be aware that changing this variable at runtime will immediately affect the replication behavior of fast arrays across the entire game.

Best practices for using GbPushModelSkipUndirtiedFastArrays include:

  1. Avoid modifying it directly in code; instead, use the console variable to change its value.
  2. Consider exposing it as a configurable option in your game’s network settings if you want to allow runtime tuning.
  3. Profile your game’s networking performance with this flag both enabled and disabled to understand its impact on your specific use case.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

bool GbPushModelSkipUndirtiedFastArrays = false;
FAutoConsoleVariableRef CVarPushModelSkipUndirtiedFastArrays(
	TEXT("net.PushModelSkipUndirtiedFastArrays"),
	GbPushModelSkipUndirtiedFastArrays,
	TEXT("When true, include fast arrays when skipping objects that we can safely see aren't dirty."));

extern int32 GNumSkippedObjectEmptyUpdates;

class FNetSerializeCB : public INetSerializeCB

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT("When true, skip replicating any objects that we can safely see aren't dirty."));

bool GbPushModelSkipUndirtiedFastArrays = false;
FAutoConsoleVariableRef CVarPushModelSkipUndirtiedFastArrays(
	TEXT("net.PushModelSkipUndirtiedFastArrays"),
	GbPushModelSkipUndirtiedFastArrays,
	TEXT("When true, include fast arrays when skipping objects that we can safely see aren't dirty."));

extern int32 GNumSkippedObjectEmptyUpdates;

class FNetSerializeCB : public INetSerializeCB
{

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

Scope (from outer to inner):

file
function     void FObjectReplicator::InitWithObject

Source code excerpt:

	}

	if (GbPushModelSkipUndirtiedFastArrays)
	{
		bCanUseNonDirtyOptimization =
			GbPushModelSkipUndirtiedReplicators &&
			(RepLayout->IsEmpty() || EnumHasAnyFlags(RepLayout->GetFlags(), ERepLayoutFlags::FullPushSupport));
	}
	else