demo.SkipTime
demo.SkipTime
#Overview
name: demo.SkipTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Skip fixed amount of network replay time (in seconds)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of demo.SkipTime is to allow skipping a fixed amount of network replay time during demo playback in Unreal Engine 5.
-
This setting variable is primarily used by the demo playback system, which is part of Unreal Engine’s networking and replication subsystem.
-
The value of this variable is set through the console variable system, as indicated by its declaration as a TAutoConsoleVariable. It can be modified at runtime through console commands or programmatically.
-
The associated variable CVarDemoSkipTime directly interacts with demo.SkipTime. They share the same value and purpose.
-
Developers must be aware that this variable is meant for temporary use. Once the skip is performed, the value is automatically reset to 0.
-
Best practices when using this variable:
- Use it for debugging or testing purposes, not for production gameplay.
- Be cautious when skipping time, as it may affect gameplay state or cause synchronization issues.
- Always check if the skip was successful and handle any potential errors.
Regarding the associated variable CVarDemoSkipTime:
-
It serves the same purpose as demo.SkipTime, allowing for skipping network replay time.
-
This variable is used directly in the UDemoNetDriver::TickDemoPlayback function to perform the actual time skip.
-
The value is checked every tick during demo playback. If it’s non-zero, the playback time is adjusted using the GotoTimeInSeconds function.
-
After the time skip is performed, the variable is automatically reset to 0 to prevent continuous skipping.
-
Developers should be aware that modifying CVarDemoSkipTime directly will have the same effect as changing demo.SkipTime through the console.
-
Best practices for CVarDemoSkipTime are the same as for demo.SkipTime, with the addition of being cautious about thread safety when accessing or modifying the value, as it’s accessed using GetValueOnGameThread().
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:48
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarDemoMinRecordHz(TEXT("demo.MinRecordHz"), 0, TEXT("Minimum number of demo frames recorded per second (use with care)"));
static TAutoConsoleVariable<float> CVarDemoTimeDilation( TEXT( "demo.TimeDilation" ), -1.0f, TEXT( "Override time dilation during demo playback (-1 = don't override)" ) );
static TAutoConsoleVariable<float> CVarDemoSkipTime( TEXT( "demo.SkipTime" ), 0, TEXT( "Skip fixed amount of network replay time (in seconds)" ) );
TAutoConsoleVariable<int32> CVarEnableCheckpoints( TEXT( "demo.EnableCheckpoints" ), 1, TEXT( "Whether or not checkpoints save on the server" ) );
static TAutoConsoleVariable<float> CVarGotoTimeInSeconds( TEXT( "demo.GotoTimeInSeconds" ), -1, TEXT( "For testing only, jump to a particular time" ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardDestroyTearOffActors( TEXT( "demo.FastForwardDestroyTearOffActors" ), 1, TEXT( "If true, the driver will destroy any torn-off actors immediately while fast-forwarding a replay." ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardSkipRepNotifies( TEXT( "demo.FastForwardSkipRepNotifies" ), 1, TEXT( "If true, the driver will optimize fast-forwarding by deferring calls to RepNotify functions until the fast-forward is complete. " ) );
static TAutoConsoleVariable<int32> CVarDemoQueueCheckpointChannels( TEXT( "demo.QueueCheckpointChannels" ), 1, TEXT( "If true, the driver will put all channels created during checkpoint loading into queuing mode, to amortize the cost of spawning new actors across multiple frames." ) );
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" ) );
#Associated Variable and Callsites
This variable is associated with another variable named CVarDemoSkipTime
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:48
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarDemoMinRecordHz(TEXT("demo.MinRecordHz"), 0, TEXT("Minimum number of demo frames recorded per second (use with care)"));
static TAutoConsoleVariable<float> CVarDemoTimeDilation( TEXT( "demo.TimeDilation" ), -1.0f, TEXT( "Override time dilation during demo playback (-1 = don't override)" ) );
static TAutoConsoleVariable<float> CVarDemoSkipTime( TEXT( "demo.SkipTime" ), 0, TEXT( "Skip fixed amount of network replay time (in seconds)" ) );
TAutoConsoleVariable<int32> CVarEnableCheckpoints( TEXT( "demo.EnableCheckpoints" ), 1, TEXT( "Whether or not checkpoints save on the server" ) );
static TAutoConsoleVariable<float> CVarGotoTimeInSeconds( TEXT( "demo.GotoTimeInSeconds" ), -1, TEXT( "For testing only, jump to a particular time" ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardDestroyTearOffActors( TEXT( "demo.FastForwardDestroyTearOffActors" ), 1, TEXT( "If true, the driver will destroy any torn-off actors immediately while fast-forwarding a replay." ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardSkipRepNotifies( TEXT( "demo.FastForwardSkipRepNotifies" ), 1, TEXT( "If true, the driver will optimize fast-forwarding by deferring calls to RepNotify functions until the fast-forward is complete. " ) );
static TAutoConsoleVariable<int32> CVarDemoQueueCheckpointChannels( TEXT( "demo.QueueCheckpointChannels" ), 1, TEXT( "If true, the driver will put all channels created during checkpoint loading into queuing mode, to amortize the cost of spawning new actors across multiple frames." ) );
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" ) );
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:2804
Scope (from outer to inner):
file
function void UDemoNetDriver::TickDemoPlayback
Source code excerpt:
}
if (FMath::Abs(CVarDemoSkipTime.GetValueOnGameThread()) > 0.0f)
{
// Just overwrite existing value, cvar wins in this case
GotoTimeInSeconds(GetDemoCurrentTime() + CVarDemoSkipTime.GetValueOnGameThread());
CVarDemoSkipTime.AsVariable()->Set(TEXT("0"), ECVF_SetByConsole);
}
// Before we update tasks or move the demo time forward, see if there are any new sublevels that
// need to be fast forwarded.
PrepFastForwardLevels();