net.DelayUnmappedRPCs
net.DelayUnmappedRPCs
#Overview
name: net.DelayUnmappedRPCs
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true delay received RPCs with unmapped object references until they are received or loaded, if false RPCs will execute immediately with null parameters. This can be used with net.AllowAsyncLoading to avoid null asset parameters during async loads.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.DelayUnmappedRPCs is to control the behavior of received Remote Procedure Calls (RPCs) with unmapped object references in Unreal Engine’s networking system.
This setting variable is primarily used in the networking and replication subsystems of Unreal Engine. Based on the callsites, it’s utilized in the Engine module and the Experimental Iris Core module, which are essential parts of Unreal Engine’s networking infrastructure.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, but can be changed at runtime through the console or configuration files.
The associated variable CVarDelayUnmappedRPCs directly interacts with net.DelayUnmappedRPCs. They share the same value and purpose.
Developers must be aware that:
- When set to true (value > 0), it delays the execution of received RPCs with unmapped object references until those references are received or loaded.
- When set to false (value = 0), RPCs will execute immediately with null parameters for unmapped references.
- This setting is particularly useful when used in conjunction with net.AllowAsyncLoading to avoid null asset parameters during asynchronous loading.
Best practices when using this variable include:
- Consider enabling it (setting to 1) if your game relies heavily on asset streaming or has complex object dependencies.
- Be cautious when enabling it, as it may introduce delays in RPC execution, which could affect gameplay responsiveness.
- Test thoroughly with both enabled and disabled states to ensure your game behaves correctly in both scenarios.
- Use in combination with net.AllowAsyncLoading for optimal handling of asset loading in networked environments.
Regarding the associated variable CVarDelayUnmappedRPCs:
The purpose of CVarDelayUnmappedRPCs is identical to net.DelayUnmappedRPCs, as it’s the actual console variable implementation.
It’s used in the Engine module, specifically in the networking and replication systems.
The value is set through the console variable system, initialized with a default of 0.
It directly controls the behavior defined by net.DelayUnmappedRPCs.
Developers should be aware that this is the actual variable being checked in the code, so any runtime changes will be reflected through this variable.
Best practices for CVarDelayUnmappedRPCs are the same as for net.DelayUnmappedRPCs, as they are essentially the same setting.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:151, section: [ConsoleVariables]
- INI Section:
ConsoleVariables
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:39
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDelayUnmappedRPCs(
TEXT("net.DelayUnmappedRPCs"),
0,
TEXT("If true delay received RPCs with unmapped object references until they are received or loaded, ")
TEXT("if false RPCs will execute immediately with null parameters. ")
TEXT("This can be used with net.AllowAsyncLoading to avoid null asset parameters during async loads."),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/ReplicationReader.cpp:213
Scope (from outer to inner):
file
namespace UE::Net::Private
function FReplicationReader::FReplicationReader
Source code excerpt:
, NetBlobHandlerManager(nullptr)
, NetObjectBlobType(InvalidNetBlobType)
, DelayAttachmentsWithUnresolvedReferences(IConsoleManager::Get().FindConsoleVariable(TEXT("net.DelayUnmappedRPCs"), false /* bTrackFrequentCalls */))
{
}
FReplicationReader::~FReplicationReader()
{
Deinit();
#Associated Variable and Callsites
This variable is associated with another variable named CVarDelayUnmappedRPCs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:38
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarDelayUnmappedRPCs(
TEXT("net.DelayUnmappedRPCs"),
0,
TEXT("If true delay received RPCs with unmapped object references until they are received or loaded, ")
TEXT("if false RPCs will execute immediately with null parameters. ")
TEXT("This can be used with net.AllowAsyncLoading to avoid null asset parameters during async loads."),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:968
Scope (from outer to inner):
file
function bool FObjectReplicator::ReceivedBunch
Source code excerpt:
const bool bIsServer = ConnectionNetDriver->IsServer();
const bool bCanDelayRPCs = (CVarDelayUnmappedRPCs.GetValueOnGameThread() > 0) && !bIsServer;
const uint32 DriverReplicationFrame = ConnectionNetDriver->ReplicationFrame;
const FClassNetCache* const ClassCache = ConnectionNetDriver->NetCache->GetClassNetCache(ObjectClass);
if (!ClassCache)
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/ReplicationReader.cpp:2270
Scope (from outer to inner):
file
namespace UE::Net::Private
function void FReplicationReader::ResolveAndDispatchAttachments
Source code excerpt:
/**
* This code path handles all cases where the initial state has already been applied. An object can have multiple entries in ObjectsPendingResolve.
* Reliable attachments will be dispatched if they can be resolved or if CVarDelayUnmappedRPCs is <= 0. Unreliable but ordered attachments will always be dispatched.
*/
bool bHasUnresolvedReferences = false;
const ENetObjectAttachmentType AttachmentType = (IsObjectIndexForOOBAttachment(InternalIndex) ? ENetObjectAttachmentType::OutOfBand : ENetObjectAttachmentType::Normal);
if (FNetObjectAttachmentReceiveQueue* AttachmentQueue = Attachments.GetQueue(AttachmentType, InternalIndex))
{
if (bDispatchReliableAttachments)
{
while (const TRefCountPtr<FNetBlob>* Attachment = AttachmentQueue->PeekReliable())
{