net.InstantReplayProcessQueuedBunchesMillisecondLimit

net.InstantReplayProcessQueuedBunchesMillisecondLimit

#Overview

name: net.InstantReplayProcessQueuedBunchesMillisecondLimit

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.InstantReplayProcessQueuedBunchesMillisecondLimit is to set a time threshold for processing queued network bunches during instant replays in Unreal Engine’s networking system.

This setting variable is primarily used by the networking subsystem of Unreal Engine, specifically in the data channel processing module. It is implemented in the Engine module, as evidenced by its location in the DataChannel.cpp file.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 8 milliseconds, but can be changed at runtime through console commands or configuration files.

This variable interacts closely with another variable, CVarNetProcessQueuedBunchesMillisecondLimit, which serves a similar purpose but for normal gameplay (non-instant replay scenarios). Both variables are used to determine the time limit for processing queued network bunches in a single frame.

Developers must be aware that this variable affects the performance and responsiveness of the networking system during instant replays. If set too low, it might cause delays in processing network data, while setting it too high might lead to frame rate drops.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your game and target hardware.
  2. Testing thoroughly with various network conditions and replay scenarios.
  3. Monitoring its impact on frame rates and network responsiveness.
  4. Considering setting it to 0 for unlimited processing time if network fidelity is critical and frame rate impact is acceptable.

Regarding the associated variable CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit:

This is the actual console variable object that controls the net.InstantReplayProcessQueuedBunchesMillisecondLimit setting. It is defined as a static TAutoConsoleVariable, which means it’s an integer value that can be changed at runtime through the console.

The purpose of this variable is the same as net.InstantReplayProcessQueuedBunchesMillisecondLimit - to control the time threshold for processing queued bunches during instant replays.

This variable is used directly in the UActorChannel::ProcessQueuedBunches() function to determine the time limit for processing queued bunches. It’s important to note that this value is only used when the game is in an instant replay state (determined by checking if the DuplicateLevelID is not INDEX_NONE).

Developers should be aware that changing this variable will directly affect the behavior of the ProcessQueuedBunches function, potentially impacting network performance and replay fidelity.

Best practices for using this variable include:

  1. Using it in conjunction with profiling tools to find the optimal balance between network responsiveness and frame rate.
  2. Considering different values for different platforms or performance levels.
  3. Documenting any changes made to this variable, as it can have significant impacts on gameplay during replays.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:79

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit(
	TEXT("net.InstantReplayProcessQueuedBunchesMillisecondLimit"),
	8,
	TEXT("Time threshold for processing queued bunches during instant replays. If it takes longer than this in a single frame, wait until the next frame to continue processing queued bunches. For unlimited time, set to 0."));

int32 GCVarNetPartialBunchReliableThreshold = 8;
FAutoConsoleVariableRef CVarNetPartialBunchReliableThreshold(
	TEXT("net.PartialBunchReliableThreshold"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:78

Scope: file

Source code excerpt:

	TEXT("Time threshold for processing queued bunches. If it takes longer than this in a single frame, wait until the next frame to continue processing queued bunches. For unlimited time, set to 0."));

static TAutoConsoleVariable<int32> CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit(
	TEXT("net.InstantReplayProcessQueuedBunchesMillisecondLimit"),
	8,
	TEXT("Time threshold for processing queued bunches during instant replays. If it takes longer than this in a single frame, wait until the next frame to continue processing queued bunches. For unlimited time, set to 0."));

int32 GCVarNetPartialBunchReliableThreshold = 8;
FAutoConsoleVariableRef CVarNetPartialBunchReliableThreshold(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:2830

Scope (from outer to inner):

file
function     bool UActorChannel::ProcessQueuedBunches

Source code excerpt:

	const int BunchTimeLimit = Connection->Driver->GetDuplicateLevelID() == INDEX_NONE ?
		CVarNetProcessQueuedBunchesMillisecondLimit.GetValueOnGameThread() :
		CVarNetInstantReplayProcessQueuedBunchesMillisecondLimit.GetValueOnGameThread();

	const bool bHasTimeToProcess = BunchTimeLimit == 0 || Connection->Driver->ProcessQueuedBunchesCurrentFrameMilliseconds < BunchTimeLimit;

	// If we don't have any time, then don't bother doing anything (including warning) as that may make things worse.
	if (bHasTimeToProcess)
	{