net.MaxSimultaneousObjectsWithRPCs

net.MaxSimultaneousObjectsWithRPCs

#Overview

name: net.MaxSimultaneousObjectsWithRPCs

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.MaxSimultaneousObjectsWithRPCs is to set a limit on the maximum number of objects that can have unsent Remote Procedure Calls (RPCs) at the same time in Unreal Engine’s networking system.

This setting variable is primarily used by the Iris networking subsystem, which is an experimental part of Unreal Engine’s networking module. Specifically, it’s used in the attachment replication system, which handles the replication of object attachments and RPCs.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. It’s initialized with a default value of 4096.

The associated variable MaxSimultaneousObjectsWithRPCs directly interacts with net.MaxSimultaneousObjectsWithRPCs. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable sets a hard limit on the number of objects that can have pending RPCs. If this limit is reached, new RPC requests may be dropped or rejected, which could lead to unexpected behavior in networked gameplay.

Best practices when using this variable include:

  1. Monitoring network performance and adjusting this value if necessary.
  2. Being cautious about setting it too high, as it could lead to increased memory usage.
  3. Being cautious about setting it too low, as it could cause RPC requests to be dropped during intense network activity.

Regarding the associated variable MaxSimultaneousObjectsWithRPCs:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:30

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:


	static int32 MaxSimultaneousObjectsWithRPCs = 4096;
	FAutoConsoleVariableRef CVarMaxSimultaneousObjectsWithRPCs(TEXT("net.MaxSimultaneousObjectsWithRPCs"), MaxSimultaneousObjectsWithRPCs, TEXT("Maximum number of objects that can have unsent RPCs at the same time. "));
}

static const FName NetError_UnreliableQueueFull("Unreliable attachment queue full");
static const FName NetError_UnsupportedNetBlob("Unsupported NetBlob type");
static const FName NetError_TooManyObjectsWithFunctionCalls("Too many objects being targeted by RPCs at the same time.");

#Associated Variable and Callsites

This variable is associated with another variable named MaxSimultaneousObjectsWithRPCs. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:29

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:

	FAutoConsoleVariableRef CVarClientToServerUnreliableRPCQueueSize(TEXT("net.ClientToServerUnreliableRPCQueueSize"), ClientToServerUnreliableRPCQueueSize, TEXT( "Maximum number of unreliable RPCs queued for sending from the client to the server. If more RPCs are queued then older ones will be dropped."));

	static int32 MaxSimultaneousObjectsWithRPCs = 4096;
	FAutoConsoleVariableRef CVarMaxSimultaneousObjectsWithRPCs(TEXT("net.MaxSimultaneousObjectsWithRPCs"), MaxSimultaneousObjectsWithRPCs, TEXT("Maximum number of objects that can have unsent RPCs at the same time. "));
}

static const FName NetError_UnreliableQueueFull("Unreliable attachment queue full");
static const FName NetError_UnsupportedNetBlob("Unsupported NetBlob type");
static const FName NetError_TooManyObjectsWithFunctionCalls("Too many objects being targeted by RPCs at the same time.");

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:617

Scope (from outer to inner):

file
namespace    UE::Net::Private
function     FNetObjectAttachmentSendQueue* FNetObjectAttachmentsWriter::GetOrCreateQueue

Source code excerpt:

		}

		if (ObjectToQueue.Num() >= AttachmentReplicationCVars::MaxSimultaneousObjectsWithRPCs)
		{
			return nullptr;
		}

		Queue = &ObjectToQueue.Add(ObjectIndex);

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/AttachmentReplication.cpp:1085

Scope (from outer to inner):

file
namespace    UE::Net::Private
function     FNetObjectAttachmentReceiveQueue* FNetObjectAttachmentsReader::GetOrCreateQueue

Source code excerpt:

		}

		if (ObjectToQueue.Num() >= AttachmentReplicationCVars::MaxSimultaneousObjectsWithRPCs)
		{
			return nullptr;
		}

		Queue = &ObjectToQueue.Add(ObjectIndex);
		{