demo.MaximumRepPrioritizePercent

demo.MaximumRepPrioritizePercent

#Overview

name: demo.MaximumRepPrioritizePercent

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of demo.MaximumRepPrioritizePercent is to set the maximum percentage of time that can be spent prioritizing actors during demo recording in Unreal Engine 5, regardless of throttling.

This setting variable is primarily used by the demo recording system, which is part of Unreal Engine’s networking and replication subsystem. It is specifically utilized in the DemoNetDriver module, which handles the recording and playback of game demos.

The value of this variable is set as a console variable (CVar) in the Engine’s source code. It is initialized with a default value of 0.7 (70%) in the DemoNetDriver.cpp file.

This variable interacts closely with two other variables:

  1. demo.MinimumRepPrioritizePercent (CVarDemoMinimumRepPrioritizeTime)
  2. demo.DecreaseRepPrioritizeThreshold (CVarDemoDecreaseRepPrioritizeThreshold)

These variables work together to control the time allocation for actor prioritization during demo recording.

Developers must be aware that this variable affects the performance and quality of demo recordings. Setting it too high might impact overall game performance, while setting it too low could result in less accurate actor prioritization in the recorded demo.

Best practices when using this variable include:

  1. Keeping it balanced with the MinimumRepPrioritizePercent
  2. Monitoring its impact on game performance during demo recording
  3. Adjusting it based on the specific needs of the game and the desired quality of demo recordings

The associated variable CVarDemoMaximumRepPrioritizeTime serves the same purpose and shares the same value as demo.MaximumRepPrioritizePercent. It is used internally in the C++ code to access and modify the value set by the console variable. This variable is used in several key functions within the DemoNetDriver, including InitDefaults, InitBase, and AdjustConsiderTime.

When working with CVarDemoMaximumRepPrioritizeTime, developers should:

  1. Use GetValueOnGameThread() or GetValueOnAnyThread() to access its current value
  2. Be aware that changes to this variable will directly affect the demo recording process
  3. Consider the interaction between this variable and other related variables when fine-tuning demo recording performance

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:85

Scope: file

Source code excerpt:

static TAutoConsoleVariable<float> CVarDemoDecreaseRepPrioritizeThreshold(TEXT("demo.DecreaseRepPrioritizeThreshold"), 0.7, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be increased."));
static TAutoConsoleVariable<float> CVarDemoMinimumRepPrioritizeTime(TEXT("demo.MinimumRepPrioritizePercent"), 0.3, TEXT("Minimum percent of time that must be spent prioritizing actors, regardless of throttling."));
static TAutoConsoleVariable<float> CVarDemoMaximumRepPrioritizeTime(TEXT("demo.MaximumRepPrioritizePercent"), 0.7, TEXT("Maximum percent of time that may be spent prioritizing actors, regardless of throttling."));

static TAutoConsoleVariable<int32> CVarFastForwardLevelsPausePlayback(TEXT("demo.FastForwardLevelsPausePlayback"), 0, TEXT("If true, pause channels and playback while fast forward levels task is running."));

namespace ReplayTaskNames
{
	static FName SkipTimeInSecondsTask(TEXT("SkipTimeInSecondsTask"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:85

Scope: file

Source code excerpt:

static TAutoConsoleVariable<float> CVarDemoDecreaseRepPrioritizeThreshold(TEXT("demo.DecreaseRepPrioritizeThreshold"), 0.7, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be increased."));
static TAutoConsoleVariable<float> CVarDemoMinimumRepPrioritizeTime(TEXT("demo.MinimumRepPrioritizePercent"), 0.3, TEXT("Minimum percent of time that must be spent prioritizing actors, regardless of throttling."));
static TAutoConsoleVariable<float> CVarDemoMaximumRepPrioritizeTime(TEXT("demo.MaximumRepPrioritizePercent"), 0.7, TEXT("Maximum percent of time that may be spent prioritizing actors, regardless of throttling."));

static TAutoConsoleVariable<int32> CVarFastForwardLevelsPausePlayback(TEXT("demo.FastForwardLevelsPausePlayback"), 0, TEXT("If true, pause channels and playback while fast forward levels task is running."));

namespace ReplayTaskNames
{
	static FName SkipTimeInSecondsTask(TEXT("SkipTimeInSecondsTask"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:737

Scope (from outer to inner):

file
function     void UDemoNetDriver::InitDefaults

Source code excerpt:

	}

	RecordBuildConsiderAndPrioritizeTimeSlice = CVarDemoMaximumRepPrioritizeTime.GetValueOnGameThread();
	RecordDestructionInfoReplicationTimeSlice = DemoNetDriverRecordingPrivate::CVarDemoMaximumRecDestructionInfoTime.GetValueOnAnyThread();
}

UDemoNetDriver::UDemoNetDriver(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:866

Scope (from outer to inner):

file
function     bool UDemoNetDriver::InitBase

Source code excerpt:

		}

		RecordBuildConsiderAndPrioritizeTimeSlice = CVarDemoMaximumRepPrioritizeTime.GetValueOnAnyThread();
		RecordDestructionInfoReplicationTimeSlice = DemoNetDriverRecordingPrivate::CVarDemoMaximumRecDestructionInfoTime.GetValueOnAnyThread();

		if (RelevantTimeout == 0.0f)
		{
			RelevantTimeout = 5.0f;
		}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:5525

Scope (from outer to inner):

file
function     void UDemoNetDriver::AdjustConsiderTime

Source code excerpt:


		float MinRepTime = CVarDemoMinimumRepPrioritizeTime.GetValueOnAnyThread();
		float MaxRepTime = CVarDemoMaximumRepPrioritizeTime.GetValueOnAnyThread();
		ConditionallySwap(MinRepTime, MaxRepTime);
		MinRepTime = FMath::Clamp<float>(MinRepTime, 0.1, 1.0);
		MaxRepTime = FMath::Clamp<float>(MaxRepTime, 0.1, 1.0);

		if (ReplicatedPercent > IncreaseThreshold)
		{