demo.LateDestructionInfoPrioritize

demo.LateDestructionInfoPrioritize

#Overview

name: demo.LateDestructionInfoPrioritize

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.LateDestructionInfoPrioritize is to control the timing of processing destruction infos during the prioritization phase of demo recording in Unreal Engine 5. This setting variable is part of the demo recording system, which is responsible for capturing and replaying gameplay sessions.

This setting variable is primarily used in the UDemoNetDriver subsystem, which is part of the Engine module. The UDemoNetDriver is responsible for managing network communication and recording/replaying demos in Unreal Engine.

The value of this variable is set as a console variable (CVar) with an initial value of 0. It can be changed at runtime through console commands or programmatically.

The associated variable CVarDemoLateDestructionInfoPrioritize directly interacts with demo.LateDestructionInfoPrioritize. They share the same value and purpose.

Developers must be aware that:

  1. This variable is a boolean flag (0 or 1).
  2. When set to 1 (true), it changes the order of processing destruction infos during the prioritization phase of demo recording.
  3. It can affect the performance and behavior of demo recording, especially in scenes with many object destructions.

Best practices when using this variable include:

  1. Use it in conjunction with other demo recording settings to fine-tune the recording process.
  2. Test thoroughly with different values (0 and 1) to understand its impact on your specific game scenario.
  3. Monitor performance metrics when enabling this feature, especially in complex scenes with many destructions.

Regarding the associated variable CVarDemoLateDestructionInfoPrioritize:

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    DemoNetDriverRecordingPrivate

Source code excerpt:

	static TAutoConsoleVariable<int32> CVarDemoForcePersistentLevelPriority(TEXT("demo.ForcePersistentLevelPriority"), 0, TEXT("If true, force persistent level to record first when prioritizing and using streaming level fixes."));
	static TAutoConsoleVariable<int32> CVarDemoDestructionInfoPriority(TEXT("demo.DestructionInfoPriority"), MAX_int32, TEXT("Replay net priority assigned to destruction infos during recording."));
	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."),

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    DemoNetDriverRecordingPrivate

Source code excerpt:

	static TAutoConsoleVariable<int32> CVarDemoForcePersistentLevelPriority(TEXT("demo.ForcePersistentLevelPriority"), 0, TEXT("If true, force persistent level to record first when prioritizing and using streaming level fixes."));
	static TAutoConsoleVariable<int32> CVarDemoDestructionInfoPriority(TEXT("demo.DestructionInfoPriority"), MAX_int32, TEXT("Replay net priority assigned to destruction infos during recording."));
	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."),

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

Scope (from outer to inner):

file
function     void UDemoNetDriver::TickDemoRecordFrame

Source code excerpt:


	const bool bDoCheckDormancyEarly = CVarDemoLateActorDormancyCheck.GetValueOnAnyThread() == 0;
	const bool bLateDestructionInfos = DemoNetDriverRecordingPrivate::CVarDemoLateDestructionInfoPrioritize.GetValueOnAnyThread() != 0;
	const bool bDoPrioritizeActors = bPrioritizeActors;
	const bool bDoFindActorChannelEarly = bDoPrioritizeActors || bDoCheckDormancyEarly;

	int32 ActorsPrioritized = 0;
	int32 DestructionInfosPrioritized = 0;