demo.LateActorDormancyCheck
demo.LateActorDormancyCheck
#Overview
name: demo.LateActorDormancyCheck
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, check if an actor should become dormant as late as possible- when serializing it to the demo archive.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of demo.LateActorDormancyCheck is to control when the actor dormancy check occurs during demo recording in Unreal Engine 5. Specifically, it determines whether the check should be performed as late as possible, just before serializing the actor to the demo archive.
This setting variable is primarily used by the demo recording system, which is part of Unreal Engine’s networking and replay functionality. It’s referenced in the UDemoNetDriver class, which is responsible for managing demo recording and playback.
The value of this variable is set as a console variable (CVar) with a default value of 1 (true). It can be changed at runtime through the console or configuration files.
The associated variable CVarDemoLateActorDormancyCheck interacts directly with demo.LateActorDormancyCheck, as they are essentially the same variable. The CVarDemoLateActorDormancyCheck is the C++ representation of the console variable.
Developers should be aware that:
- When set to 1 (true), the actor dormancy check is performed just before serializing the actor to the demo archive, which may be more accurate but potentially less performant.
- When set to 0 (false), the dormancy check is performed earlier in the recording process, which might be more efficient but potentially less accurate.
Best practices when using this variable include:
- Consider the trade-off between accuracy and performance when deciding whether to enable or disable late dormancy checking.
- Test the impact of both settings on your specific game to determine which provides the best balance of performance and replay accuracy.
- Be aware that changing this setting may affect the behavior of recorded demos, so ensure consistency across development and production environments.
Regarding the associated variable CVarDemoLateActorDormancyCheck:
This is the C++ representation of the demo.LateActorDormancyCheck console variable. It’s used in the engine code to actually implement the behavior controlled by the setting. The purpose and considerations are the same as those for demo.LateActorDormancyCheck.
The value of CVarDemoLateActorDormancyCheck is typically accessed using the GetValueOnAnyThread() method, as seen in the provided code excerpt. This allows the engine to efficiently check the current setting without risking thread-safety issues.
Developers should be aware that modifying the value of CVarDemoLateActorDormancyCheck directly in C++ code is not recommended. Instead, they should use the console variable system to change the value, ensuring consistency across the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:66
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLoopDemo(TEXT("demo.Loop"), 0, TEXT("<1> : play replay from beginning once it reaches the end / <0> : stop replay at the end"));
static TAutoConsoleVariable<int32> CVarDemoFastForwardIgnoreRPCs( TEXT( "demo.FastForwardIgnoreRPCs" ), 1, TEXT( "If true, RPCs will be discarded during playback fast forward." ) );
static TAutoConsoleVariable<int32> CVarDemoLateActorDormancyCheck(TEXT("demo.LateActorDormancyCheck"), 1, TEXT("If true, check if an actor should become dormant as late as possible- when serializing it to the demo archive."));
static TAutoConsoleVariable<int32> CVarDemoJumpToEndOfLiveReplay(TEXT("demo.JumpToEndOfLiveReplay"), 1, TEXT("If true, fast forward to a few seconds before the end when starting playback, if the replay is still being recorded."));
static TAutoConsoleVariable<int32> CVarDemoInternalPauseChannels(TEXT("demo.InternalPauseChannels"), 1, TEXT("If true, run standard logic for PauseChannels rather than letting the game handle it via FOnPauseChannelsDelegate."));
static int32 GDemoLoopCount = 0;
static FAutoConsoleVariableRef CVarDemoLoopCount( TEXT( "demo.LoopCount" ), GDemoLoopCount, TEXT( "If > 1, will play the replay that many times before stopping." ) );
#Associated Variable and Callsites
This variable is associated with another variable named CVarDemoLateActorDormancyCheck
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:66
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLoopDemo(TEXT("demo.Loop"), 0, TEXT("<1> : play replay from beginning once it reaches the end / <0> : stop replay at the end"));
static TAutoConsoleVariable<int32> CVarDemoFastForwardIgnoreRPCs( TEXT( "demo.FastForwardIgnoreRPCs" ), 1, TEXT( "If true, RPCs will be discarded during playback fast forward." ) );
static TAutoConsoleVariable<int32> CVarDemoLateActorDormancyCheck(TEXT("demo.LateActorDormancyCheck"), 1, TEXT("If true, check if an actor should become dormant as late as possible- when serializing it to the demo archive."));
static TAutoConsoleVariable<int32> CVarDemoJumpToEndOfLiveReplay(TEXT("demo.JumpToEndOfLiveReplay"), 1, TEXT("If true, fast forward to a few seconds before the end when starting playback, if the replay is still being recorded."));
static TAutoConsoleVariable<int32> CVarDemoInternalPauseChannels(TEXT("demo.InternalPauseChannels"), 1, TEXT("If true, run standard logic for PauseChannels rather than letting the game handle it via FOnPauseChannelsDelegate."));
static int32 GDemoLoopCount = 0;
static FAutoConsoleVariableRef CVarDemoLoopCount( TEXT( "demo.LoopCount" ), GDemoLoopCount, TEXT( "If > 1, will play the replay that many times before stopping." ) );
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:1893
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;