demo.FastForwardLevelsPausePlayback
demo.FastForwardLevelsPausePlayback
#Overview
name: demo.FastForwardLevelsPausePlayback
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, pause channels and playback while fast forward levels task is running.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of demo.FastForwardLevelsPausePlayback is to control whether the replay system should pause channels and playback while the fast forward levels task is running.
This setting variable is primarily used in the Unreal Engine’s replay and demo system, which is part of the networking subsystem. It’s specifically utilized in the DemoNetDriver, which is responsible for recording and playing back game sessions.
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 CVarFastForwardLevelsPausePlayback directly interacts with demo.FastForwardLevelsPausePlayback. They share the same value and are used interchangeably in the code.
Developers must be aware that when this variable is set to a non-zero value:
- It will pause channels while waiting for a new stream location to load during fast-forward operations.
- It affects how the system determines if data is available for processing during replay playback.
- It influences whether playback should be paused during the fast forward levels task.
Best practices when using this variable include:
- Consider the impact on performance and user experience when enabling this feature, as it may introduce pauses in playback.
- Use it in conjunction with other replay system settings to fine-tune the behavior of fast-forwarding and playback.
- Test thoroughly with different values to ensure desired behavior in various scenarios.
Regarding the associated variable CVarFastForwardLevelsPausePlayback:
- It’s an auto console variable of type int32.
- It’s used in the same contexts as demo.FastForwardLevelsPausePlayback, primarily in the FFastForwardLevelsTask class and UDemoNetDriver::TickDemoPlayback function.
- Its value is checked using the GetValueOnAnyThread() method, which suggests it can be accessed from multiple threads.
- When implementing features that interact with fast-forwarding in replays, developers should check this variable’s value to determine if playback should be paused during the operation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:87
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDemoMaximumRepPrioritizeTime(TEXT("demo.MaximumRepPrioritizePercent"), 0.7, TEXT("Maximum percent of time that may be spent prioritizing actors, regardless of throttling."));
static TAutoConsoleVariable<int32> CVarFastForwardLevelsPausePlayback(TEXT("demo.FastForwardLevelsPausePlayback"), 0, TEXT("If true, pause channels and playback while fast forward levels task is running."));
namespace ReplayTaskNames
{
static FName SkipTimeInSecondsTask(TEXT("SkipTimeInSecondsTask"));
static FName JumpToLiveReplayTask(TEXT("JumpToLiveReplayTask"));
static FName GotoTimeInSecondsTask(TEXT("GotoTimeInSecondsTask"));
#Associated Variable and Callsites
This variable is associated with another variable named CVarFastForwardLevelsPausePlayback
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:87
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDemoMaximumRepPrioritizeTime(TEXT("demo.MaximumRepPrioritizePercent"), 0.7, TEXT("Maximum percent of time that may be spent prioritizing actors, regardless of throttling."));
static TAutoConsoleVariable<int32> CVarFastForwardLevelsPausePlayback(TEXT("demo.FastForwardLevelsPausePlayback"), 0, TEXT("If true, pause channels and playback while fast forward levels task is running."));
namespace ReplayTaskNames
{
static FName SkipTimeInSecondsTask(TEXT("SkipTimeInSecondsTask"));
static FName JumpToLiveReplayTask(TEXT("JumpToLiveReplayTask"));
static FName GotoTimeInSecondsTask(TEXT("GotoTimeInSecondsTask"));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:642
Scope (from outer to inner):
file
class class FFastForwardLevelsTask : public FQueuedReplayTask
function virtual void StartTask
Source code excerpt:
Driver->GetReplayStreamer()->GotoTimeInMS(GotoTime, FGotoCallback::CreateSP(this, &FFastForwardLevelsTask::CheckpointReady), CheckpointType);
if (CVarFastForwardLevelsPausePlayback.GetValueOnAnyThread() != 0)
{
// Pause channels while we wait (so the world is paused while we wait for the new stream location to load)
Driver->PauseChannels(true);
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:664
Scope (from outer to inner):
file
class class FFastForwardLevelsTask : public FQueuedReplayTask
function virtual bool Tick
Source code excerpt:
// if this task is not pausing the rest of the replay stream, make sure there is data available for the current time or we could miss packets
const float LastProcessedPacketTime = FPendingTaskHelper::GetLastProcessedPacketTime(Driver.Get());
const uint32 AvailableDataEndTime = (CVarFastForwardLevelsPausePlayback.GetValueOnAnyThread() != 0) ? GotoTime : LastProcessedPacketTime * 1000;
if (!GotoResult->WasSuccessful())
{
return true;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:692
Scope (from outer to inner):
file
class class FFastForwardLevelsTask : public FQueuedReplayTask
function virtual bool ShouldPausePlayback
Source code excerpt:
virtual bool ShouldPausePlayback() const override
{
return (CVarFastForwardLevelsPausePlayback.GetValueOnAnyThread() != 0);
}
void CheckpointReady(const FGotoResult& Result)
{
check(!GotoResult.IsSet());
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:2913
Scope (from outer to inner):
file
function void UDemoNetDriver::TickDemoPlayback
Source code excerpt:
bool bProcessAvailableData = (PlaybackPackets.Num() > 0) || GetReplayStreamer()->IsDataAvailable();
if (CVarFastForwardLevelsPausePlayback.GetValueOnAnyThread() == 0)
{
const uint32 DemoCurrentTimeInMS = GetDemoCurrentTimeInMS();
bProcessAvailableData = bProcessAvailableData || GetReplayStreamer()->IsDataAvailableForTimeRange(DemoCurrentTimeInMS, DemoCurrentTimeInMS);
}
// Make sure there is data available to read