demo.MinimumRepPrioritizePercent

demo.MinimumRepPrioritizePercent

#Overview

name: demo.MinimumRepPrioritizePercent

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 demo.MinimumRepPrioritizePercent is to set the minimum percentage of time that must be spent prioritizing actors during demo replay, regardless of any throttling mechanisms in place. This setting is part of the demo playback and network replication system in Unreal Engine 5.

This setting variable is primarily used in the Unreal Engine’s demo system, which is responsible for recording and replaying gameplay. It’s specifically utilized in the DemoNetDriver module, which handles network-related functionality for demo playback.

The value of this variable is set as a console variable (CVar) in the Unreal Engine’s configuration system. It’s initialized with a default value of 0.3 (30%) in the source code.

The associated variable CVarDemoMinimumRepPrioritizeTime interacts directly with demo.MinimumRepPrioritizePercent. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the performance and behavior of demo playback. Setting it too low might result in insufficient time for actor prioritization, potentially affecting the quality of the replay. Conversely, setting it too high could unnecessarily consume processing time.

Best practices when using this variable include:

  1. Keeping it within a reasonable range (e.g., 0.1 to 1.0, as seen in the code).
  2. Balancing it with the maximum prioritization time (demo.MaximumRepPrioritizePercent) to ensure optimal performance.
  3. Testing thoroughly with different values to find the best balance for your specific game’s needs.

Regarding the associated variable CVarDemoMinimumRepPrioritizeTime:

The purpose of CVarDemoMinimumRepPrioritizeTime is identical to demo.MinimumRepPrioritizePercent. It’s used internally in the C++ code to access the value set by the console variable.

This variable is used in the UDemoNetDriver class, specifically in the AdjustConsiderTime function. It’s retrieved using the GetValueOnAnyThread() method, indicating that it can be accessed from multiple threads.

The value of this variable is set indirectly through the demo.MinimumRepPrioritizePercent console variable.

Developers should be aware that this variable is used in calculations that determine the actual time spent on actor prioritization. It’s clamped between 0.1 and 1.0 to ensure it stays within a reasonable range.

Best practices for this variable are the same as for demo.MinimumRepPrioritizePercent, as they represent the same value in different contexts within the code.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

static TAutoConsoleVariable<float> CVarDemoIncreaseRepPrioritizeThreshold(TEXT("demo.IncreaseRepPrioritizeThreshold"), 0.9, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be decreased."));
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
{

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

static TAutoConsoleVariable<float> CVarDemoIncreaseRepPrioritizeThreshold(TEXT("demo.IncreaseRepPrioritizeThreshold"), 0.9, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be decreased."));
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
{

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

Scope (from outer to inner):

file
function     void UDemoNetDriver::AdjustConsiderTime

Source code excerpt:

		ConditionallySwap(DecreaseThreshold, IncreaseThreshold);

		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)