demo.JumpToEndOfLiveReplay
demo.JumpToEndOfLiveReplay
#Overview
name: demo.JumpToEndOfLiveReplay
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, fast forward to a few seconds before the end when starting playback, if the replay is still being recorded.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of demo.JumpToEndOfLiveReplay is to control whether the replay system should automatically fast-forward to near the end of a live replay when starting playback. This setting is part of Unreal Engine’s demo recording and playback system, which is primarily used for replay functionality in games.
This setting variable is utilized by the Unreal Engine’s networking subsystem, specifically within the demo replay module. It’s primarily referenced in the DemoNetDriver, which is responsible for managing network replay recording and playback.
The value of this variable is set as a console variable, which means it can be adjusted at runtime through the console or configuration files. By default, it’s set to 1 (true).
The associated variable CVarDemoJumpToEndOfLiveReplay directly interacts with demo.JumpToEndOfLiveReplay, as they share the same value and purpose.
Developers must be aware that enabling this variable (set to 1) will cause live replays to start near the end instead of from the beginning. This can be useful for quickly catching up to the current state of an ongoing game or event but may not be desirable in all scenarios.
Best practices when using this variable include:
- Consider the user experience: Decide if jumping to the end of a live replay aligns with your game’s replay viewing requirements.
- Test thoroughly: Ensure that jumping to the end of a replay doesn’t cause any unexpected behavior or visual glitches in your game.
- Provide user control: Consider exposing this option to users, allowing them to choose whether they want to start from the beginning or near the end of a live replay.
- Performance considerations: Be aware that fast-forwarding through a large portion of the replay might have performance implications, especially on lower-end devices.
Regarding the associated variable CVarDemoJumpToEndOfLiveReplay: This is the actual console variable that controls the behavior described above. It’s an integer variable, where a non-zero value enables the jump-to-end functionality for live replays. The variable is checked in the UDemoNetDriver::ReplayStreamingReady function to determine whether to perform the jump to the end of the replay.
Developers should note that this variable is accessed using GetValueOnGameThread(), which suggests that it should only be read from the game thread to ensure thread safety. Any modifications to this variable should be done with consideration for potential multi-threading issues.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:68
Scope: file
Source code excerpt:
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." ) );
static int32 GDemoSaveRollbackActorState = 1;
#Associated Variable and Callsites
This variable is associated with another variable named CVarDemoJumpToEndOfLiveReplay
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:68
Scope: file
Source code excerpt:
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." ) );
static int32 GDemoSaveRollbackActorState = 1;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:3243
Scope (from outer to inner):
file
function void UDemoNetDriver::ReplayStreamingReady
Source code excerpt:
}
if (CVarDemoJumpToEndOfLiveReplay.GetValueOnGameThread() != 0)
{
if (ReplayHelper.ReplayStreamer->IsLive() && ReplayHelper.ReplayStreamer->GetTotalDemoTime() > 15 * 1000)
{
// If the load time wasn't very long, jump to end now
// Otherwise, defer it until we have a more recent replay time
if (FPlatformTime::Seconds() - StartTime < 10)