net.DiscardTornOffActorRPCs
net.DiscardTornOffActorRPCs
#Overview
name: net.DiscardTornOffActorRPCs
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If enabled, discard RPCs if the actor has been torn off.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.DiscardTornOffActorRPCs is to control whether Remote Procedure Calls (RPCs) should be discarded for actors that have been torn off in the networking system of Unreal Engine 5.
This setting variable is primarily used in the networking subsystem of Unreal Engine, specifically in the actor replication and RPC handling components. Based on the callsites, it’s used in the Engine module, particularly in the NetDriver and DataChannel components.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console. By default, it is set to true.
The associated variable bDiscardTornOffActorRPCs directly interacts with net.DiscardTornOffActorRPCs. They share the same value and are used interchangeably in the code.
Developers must be aware that when this variable is set to true (which is the default), RPCs for torn-off actors will be discarded. This can have significant implications for networked gameplay, especially in scenarios where torn-off actors might still need to process certain RPCs.
Best practices when using this variable include:
- Carefully consider the implications of changing its value, as it affects network behavior.
- If you need to process RPCs for torn-off actors in specific cases, you may need to set this to false, but be cautious about potential performance impacts.
- Use this in conjunction with other networking settings to fine-tune your game’s network performance and behavior.
Regarding the associated variable bDiscardTornOffActorRPCs:
The purpose of bDiscardTornOffActorRPCs is the same as net.DiscardTornOffActorRPCs - to control the discarding of RPCs for torn-off actors.
This variable is used directly in the Engine module’s networking code, specifically in the ProcessBunch function of UActorChannel and in the ProcessRemoteFunction of UNetDriver.
The value of this variable is set by the console variable net.DiscardTornOffActorRPCs.
It directly interacts with net.DiscardTornOffActorRPCs, sharing the same value.
Developers should be aware that this variable is used in critical network processing functions. Changing its value will directly affect how the engine handles RPCs for torn-off actors.
Best practices for using this variable include:
- Treat it as read-only in most cases, as its value is controlled by the console variable.
- When debugging network issues related to torn-off actors, examine the state of this variable.
- If you need to modify this behavior, consider changing the console variable instead of directly manipulating this variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:339
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
bool bDiscardTornOffActorRPCs = true;
FAutoConsoleVariableRef CVarNetDiscardTornOffActorRPCs(
TEXT("net.DiscardTornOffActorRPCs"),
bDiscardTornOffActorRPCs,
TEXT("If enabled, discard RPCs if the actor has been torn off."),
ECVF_Default);
}
#if UE_BUILD_SHIPPING
#Associated Variable and Callsites
This variable is associated with another variable named bDiscardTornOffActorRPCs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:113
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
{
extern int32 FilterGuidRemapping;
extern bool bDiscardTornOffActorRPCs;
static float QueuedBunchTimeoutSeconds = 30.0f;
static FAutoConsoleVariableRef CVarQueuedBunchTimeoutSeconds(
TEXT("net.QueuedBunchTimeoutSeconds"),
QueuedBunchTimeoutSeconds,
TEXT("Time in seconds to wait for queued bunches on a channel to flush before logging a warning."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:3154
Scope (from outer to inner):
file
function void UActorChannel::ProcessBunch
Source code excerpt:
else
{
if (UE::Net::bDiscardTornOffActorRPCs && NewChannelActor->GetTearOff())
{
UE_LOG(LogNet, Warning, TEXT("UActorChannel::ProcessBunch: SerializeNewActor received an open bunch for a torn off actor. Actor: %s, Channel: %i"), *GetFullNameSafe(NewChannelActor), ChIndex);
Broken = 1;
if (!Connection->IsInternalAck()
#if !UE_BUILD_SHIPPING
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:337
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
}
bool bDiscardTornOffActorRPCs = true;
FAutoConsoleVariableRef CVarNetDiscardTornOffActorRPCs(
TEXT("net.DiscardTornOffActorRPCs"),
bDiscardTornOffActorRPCs,
TEXT("If enabled, discard RPCs if the actor has been torn off."),
ECVF_Default);
}
#if UE_BUILD_SHIPPING
#define DEBUG_REMOTEFUNCTION(Format, ...)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:7429
Scope: file
Source code excerpt:
}
if (UE::Net::bDiscardTornOffActorRPCs && Actor->GetTearOff())
{
UE_LOG(LogNet, Warning, TEXT("UNetDriver::ProcessRemoteFunction: Remote function %s called from actor %s while actor is torn off. Function will not be processed."), *Function->GetName(), *Actor->GetName());
return;
}
#if !UE_BUILD_SHIPPING