demo.CheckpointUploadDelayInSeconds
demo.CheckpointUploadDelayInSeconds
#Overview
name: demo.CheckpointUploadDelayInSeconds
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of demo.CheckpointUploadDelayInSeconds is to control the delay between checkpoint saves in Unreal Engine’s demo recording system. This setting is primarily used for the replay and demo functionality within the engine.
The Unreal Engine subsystem that relies on this setting variable is the demo recording system, which is part of the networking module. This can be seen from the file location where the variable is defined and used: Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp.
The value of this variable is set as a console variable with a default value of 30.0 seconds. It can be modified at runtime through console commands or programmatically.
This variable interacts with other demo-related variables, particularly in the context of checkpoint saving and replay functionality. It’s closely associated with CVarCheckpointUploadDelayInSeconds, which appears to be the same variable.
Developers must be aware that this variable affects the frequency of checkpoint saves during demo recording. A lower value will result in more frequent checkpoints, which can be beneficial for more granular replay control but may impact performance.
Best practices when using this variable include:
- Adjusting the value based on the specific needs of the game, balancing between replay granularity and performance.
- Considering the impact on network traffic and storage requirements when changing this value.
- Testing thoroughly with different values to ensure optimal performance and replay functionality.
Regarding the associated variable CVarCheckpointUploadDelayInSeconds, it is the same variable as demo.CheckpointUploadDelayInSeconds. They are used interchangeably in the code, with CVarCheckpointUploadDelayInSeconds being the C++ variable name and demo.CheckpointUploadDelayInSeconds being the console variable name. The usage, purpose, and considerations are the same as described above.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:56
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarUseAdaptiveReplayUpdateFrequency( TEXT( "demo.UseAdaptiveReplayUpdateFrequency" ), 1, TEXT( "If 1, NetUpdateFrequency will be calculated based on how often actors actually write something when recording to a replay" ) );
static TAutoConsoleVariable<int32> CVarDemoAsyncLoadWorld( TEXT( "demo.AsyncLoadWorld" ), 0, TEXT( "If 1, we will use seamless server travel to load the replay world asynchronously" ) );
TAutoConsoleVariable<float> CVarCheckpointUploadDelayInSeconds( TEXT( "demo.CheckpointUploadDelayInSeconds" ), 30.0f, TEXT( "" ) );
static TAutoConsoleVariable<int32> CVarDemoLoadCheckpointGarbageCollect( TEXT( "demo.LoadCheckpointGarbageCollect" ), 1, TEXT("If nonzero, CollectGarbage will be called during LoadCheckpoint after the old actors and connection are cleaned up." ) );
TAutoConsoleVariable<float> CVarCheckpointSaveMaxMSPerFrameOverride( TEXT( "demo.CheckpointSaveMaxMSPerFrameOverride" ), -1.0f, TEXT( "If >= 0, this value will override the CheckpointSaveMaxMSPerFrame member variable, which is the maximum time allowed each frame to spend on saving a checkpoint. If 0, it will save the checkpoint in a single frame, regardless of how long it takes." ) );
TAutoConsoleVariable<int32> CVarDemoClientRecordAsyncEndOfFrame( TEXT( "demo.ClientRecordAsyncEndOfFrame" ), 0, TEXT( "If true, TickFlush will be called on a thread in parallel with Slate." ) );
static TAutoConsoleVariable<int32> CVarForceDisableAsyncPackageMapLoading( TEXT( "demo.ForceDisableAsyncPackageMapLoading" ), 0, TEXT( "If true, async package map loading of network assets will be disabled." ) );
TAutoConsoleVariable<int32> CVarDemoUseNetRelevancy( TEXT( "demo.UseNetRelevancy" ), 0, TEXT( "If 1, will enable relevancy checks and distance culling, using all connected clients as reference." ) );
static TAutoConsoleVariable<float> CVarDemoCullDistanceOverride( TEXT( "demo.CullDistanceOverride" ), 0.0f, TEXT( "If > 0, will represent distance from any viewer where actors will stop being recorded." ) );
#Associated Variable and Callsites
This variable is associated with another variable named CVarCheckpointUploadDelayInSeconds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:56
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarUseAdaptiveReplayUpdateFrequency( TEXT( "demo.UseAdaptiveReplayUpdateFrequency" ), 1, TEXT( "If 1, NetUpdateFrequency will be calculated based on how often actors actually write something when recording to a replay" ) );
static TAutoConsoleVariable<int32> CVarDemoAsyncLoadWorld( TEXT( "demo.AsyncLoadWorld" ), 0, TEXT( "If 1, we will use seamless server travel to load the replay world asynchronously" ) );
TAutoConsoleVariable<float> CVarCheckpointUploadDelayInSeconds( TEXT( "demo.CheckpointUploadDelayInSeconds" ), 30.0f, TEXT( "" ) );
static TAutoConsoleVariable<int32> CVarDemoLoadCheckpointGarbageCollect( TEXT( "demo.LoadCheckpointGarbageCollect" ), 1, TEXT("If nonzero, CollectGarbage will be called during LoadCheckpoint after the old actors and connection are cleaned up." ) );
TAutoConsoleVariable<float> CVarCheckpointSaveMaxMSPerFrameOverride( TEXT( "demo.CheckpointSaveMaxMSPerFrameOverride" ), -1.0f, TEXT( "If >= 0, this value will override the CheckpointSaveMaxMSPerFrame member variable, which is the maximum time allowed each frame to spend on saving a checkpoint. If 0, it will save the checkpoint in a single frame, regardless of how long it takes." ) );
TAutoConsoleVariable<int32> CVarDemoClientRecordAsyncEndOfFrame( TEXT( "demo.ClientRecordAsyncEndOfFrame" ), 0, TEXT( "If true, TickFlush will be called on a thread in parallel with Slate." ) );
static TAutoConsoleVariable<int32> CVarForceDisableAsyncPackageMapLoading( TEXT( "demo.ForceDisableAsyncPackageMapLoading" ), 0, TEXT( "If true, async package map loading of network assets will be disabled." ) );
TAutoConsoleVariable<int32> CVarDemoUseNetRelevancy( TEXT( "demo.UseNetRelevancy" ), 0, TEXT( "If 1, will enable relevancy checks and distance culling, using all connected clients as reference." ) );
static TAutoConsoleVariable<float> CVarDemoCullDistanceOverride( TEXT( "demo.CullDistanceOverride" ), 0.0f, TEXT( "If > 0, will represent distance from any viewer where actors will stop being recorded." ) );
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:1258
Scope (from outer to inner):
file
function bool UDemoNetDriver::ContinueListen
Source code excerpt:
// Force a checkpoint to be created in the next tick - We need a checkpoint right after traveling so that scrubbing
// from a different level will have essentially an "empty" checkpoint to work from.
SetLastCheckpointTime(-1 * CVarCheckpointUploadDelayInSeconds.GetValueOnGameThread());
return true;
}
return false;
}
bool UDemoNetDriver::IsRecording() const
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplayHelper.cpp:24
Scope: file
Source code excerpt:
extern TAutoConsoleVariable<int32> CVarWithGameSpecificFrameData;
extern TAutoConsoleVariable<int32> CVarEnableCheckpoints;
extern TAutoConsoleVariable<float> CVarCheckpointUploadDelayInSeconds;
extern TAutoConsoleVariable<float> CVarCheckpointSaveMaxMSPerFrameOverride;
extern TAutoConsoleVariable<int32> CVarDemoUseNetRelevancy;
extern TAutoConsoleVariable<int32> CVarDemoClientRecordAsyncEndOfFrame;
extern TAutoConsoleVariable<float> CVarDemoRecordHz;
extern TAutoConsoleVariable<float> CVarDemoMinRecordHz;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplayHelper.cpp:2109
Scope (from outer to inner):
file
function bool FReplayHelper::ShouldSaveCheckpoint
Source code excerpt:
bool FReplayHelper::ShouldSaveCheckpoint() const
{
const double CHECKPOINT_DELAY = CVarCheckpointUploadDelayInSeconds.GetValueOnAnyThread();
return (bPendingCheckpointRequest || ((DemoCurrentTime - LastCheckpointTime) > CHECKPOINT_DELAY));
}
float FReplayHelper::GetCheckpointSaveMaxMSPerFrame() const
{