demo.MaximumRecDestructionInfoTime

demo.MaximumRecDestructionInfoTime

#Overview

name: demo.MaximumRecDestructionInfoTime

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of demo.MaximumRecDestructionInfoTime is to control the maximum percentage of a frame that can be used for replicating destruction information during demo recording in Unreal Engine 5.

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

The value of this variable is set through a console variable (CVar) system. It’s defined as a static TAutoConsoleVariable with a default value of 0.2 (20% of a frame).

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

Developers must be aware that this variable affects the performance and resource allocation during demo recording. Setting it too high might impact frame rates, while setting it too low might result in incomplete or delayed destruction info replication.

Best practices when using this variable include:

  1. Monitoring performance impacts when adjusting the value.
  2. Balancing it with other demo recording settings for optimal performance.
  3. Testing thoroughly with different values in various gameplay scenarios.

Regarding CVarDemoMaximumRecDestructionInfoTime:

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    DemoNetDriverRecordingPrivate

Source code excerpt:

	static TAutoConsoleVariable<int32> CVarDemoLateDestructionInfoPrioritize(TEXT("demo.LateDestructionInfoPrioritize"), 0, TEXT("If true, process destruction infos at the end of the prioritization phase."));
	static TAutoConsoleVariable<float> CVarDemoViewTargetPriorityScale(TEXT("demo.ViewTargetPriorityScale"), 3.0, TEXT("Scale view target priority by this value when prioritization is enabled."));
	static TAutoConsoleVariable<float> CVarDemoMaximumRecDestructionInfoTime(TEXT("demo.MaximumRecDestructionInfoTime"), 0.2, TEXT("Maximum percentage of frame to use replicating destruction infos, if per frame limit is enabled."));
	
	static FAutoConsoleCommandWithWorldAndArgs DemoMaxDesiredRecordTimeMS(
		TEXT("Demo.MaxDesiredRecordTimeMS"),
		TEXT("Set max desired record time in MS on demo driver of the current world."),
		FConsoleCommandWithWorldAndArgsDelegate::CreateStatic(
			[](const TArray<FString>& Params, UWorld* World)

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    DemoNetDriverRecordingPrivate

Source code excerpt:

	static TAutoConsoleVariable<int32> CVarDemoLateDestructionInfoPrioritize(TEXT("demo.LateDestructionInfoPrioritize"), 0, TEXT("If true, process destruction infos at the end of the prioritization phase."));
	static TAutoConsoleVariable<float> CVarDemoViewTargetPriorityScale(TEXT("demo.ViewTargetPriorityScale"), 3.0, TEXT("Scale view target priority by this value when prioritization is enabled."));
	static TAutoConsoleVariable<float> CVarDemoMaximumRecDestructionInfoTime(TEXT("demo.MaximumRecDestructionInfoTime"), 0.2, TEXT("Maximum percentage of frame to use replicating destruction infos, if per frame limit is enabled."));
	
	static FAutoConsoleCommandWithWorldAndArgs DemoMaxDesiredRecordTimeMS(
		TEXT("Demo.MaxDesiredRecordTimeMS"),
		TEXT("Set max desired record time in MS on demo driver of the current world."),
		FConsoleCommandWithWorldAndArgsDelegate::CreateStatic(
			[](const TArray<FString>& Params, UWorld* World)

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

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)
{
	InitDefaults();

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

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;
		}