Replay.UseReplayConnection
Replay.UseReplayConnection
#Overview
name: Replay.UseReplayConnection
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Replay.UseReplayConnection is to control whether the Replay system should use a dedicated replay connection for recording gameplay. This setting is primarily used in the context of the Unreal Engine’s replay system, which allows for the recording and playback of gameplay sessions.
The Unreal Engine subsystem that relies on this setting variable is the Replay Subsystem, as evidenced by its use in the ReplaySubsystem namespace and the UReplaySubsystem class.
The value of this variable is set through a console variable (CVar) named CVarUseReplayConnection. It is initialized with a default value of false, meaning that by default, the system does not use a dedicated replay connection.
The associated variable CVarUseReplayConnection directly interacts with Replay.UseReplayConnection. They share the same value and purpose, with CVarUseReplayConnection being the actual TAutoConsoleVariable instance used in the code.
Developers must be aware that this variable is specifically used in server contexts and requires the use of a replication graph. It’s checked in the RecordReplay function of the UReplaySubsystem class before creating a new UReplayNetConnection object.
Best practices when using this variable include:
- Only enable it when you specifically need a dedicated replay connection for more complex replay scenarios.
- Ensure that the server is properly set up with a replication graph before enabling this feature.
- Be mindful of the potential performance implications of using a dedicated replay connection.
Regarding the associated variable CVarUseReplayConnection:
The purpose of CVarUseReplayConnection is to provide a console-accessible way to toggle the use of a dedicated replay connection. It’s the actual implementation of the Replay.UseReplayConnection setting.
This variable is used within the Replay Subsystem of Unreal Engine, specifically in the UReplaySubsystem class.
The value of CVarUseReplayConnection is set when the console variable is initialized, with a default value of false. It can be changed at runtime through console commands.
CVarUseReplayConnection directly interacts with the Replay.UseReplayConnection setting, essentially serving as its backend.
Developers should be aware that this is a TAutoConsoleVariable
Best practices for using CVarUseReplayConnection include:
- Use it for debugging and testing purposes, as it allows for easy toggling of the replay connection feature.
- Be cautious when changing its value in production environments, as it could impact performance and networking behavior.
- Consider exposing it in development builds but possibly restricting access in shipping builds to prevent unintended changes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplaySubsystem.cpp:13
Scope (from outer to inner):
file
namespace ReplaySubsystem
Source code excerpt:
namespace ReplaySubsystem
{
TAutoConsoleVariable<bool> CVarUseReplayConnection(TEXT("Replay.UseReplayConnection"), false, TEXT(""));
};
void UReplaySubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
#Associated Variable and Callsites
This variable is associated with another variable named CVarUseReplayConnection
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplaySubsystem.cpp:13
Scope (from outer to inner):
file
namespace ReplaySubsystem
Source code excerpt:
namespace ReplaySubsystem
{
TAutoConsoleVariable<bool> CVarUseReplayConnection(TEXT("Replay.UseReplayConnection"), false, TEXT(""));
};
void UReplaySubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplaySubsystem.cpp:145
Scope (from outer to inner):
file
function void UReplaySubsystem::RecordReplay
Source code excerpt:
// must be server and using a replication graph to use a replay connection
if (NetDriver && NetDriver->IsServer() && NetDriver->GetReplicationDriver() && ReplaySubsystem::CVarUseReplayConnection.GetValueOnAnyThread())
{
StopExistingReplays(CurrentWorld, StopExistingFlags);
UReplayNetConnection* Connection = NewObject<UReplayNetConnection>();
ReplayConnection = Connection;