net.ClientToServerUnreliableRPCQueueSize

net.ClientToServerUnreliableRPCQueueSize

#Overview

name: net.ClientToServerUnreliableRPCQueueSize

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.ClientToServerUnreliableRPCQueueSize is to control the maximum number of unreliable Remote Procedure Calls (RPCs) that can be queued for sending from the client to the server in Unreal Engine’s networking system.

This setting variable is primarily used by the Iris replication system, which is part of Unreal Engine’s experimental networking subsystem. It’s specifically utilized in the attachment replication module, which handles the replication of object attachments in networked games.

The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 16 in the source code.

The associated variable ClientToServerUnreliableRPCQueueSize directly interacts with net.ClientToServerUnreliableRPCQueueSize, as they share the same value. This internal variable is used within the C++ code to actually control the queue size.

Developers must be aware that this variable specifically affects unreliable RPCs from client to server. If more RPCs are queued than this limit allows, older RPCs will be dropped. This can lead to potential loss of information if not managed properly.

Best practices when using this variable include:

  1. Carefully consider the default value (16) and adjust it based on your game’s specific networking requirements.
  2. Monitor network performance and adjust this value if you notice issues with unreliable RPCs not being processed.
  3. Be cautious about setting this value too high, as it could lead to increased memory usage and potential network congestion.
  4. Use in conjunction with other networking CVars to fine-tune your game’s network performance.

The associated variable ClientToServerUnreliableRPCQueueSize is an internal representation of the net.ClientToServerUnreliableRPCQueueSize CVar. It’s used directly in the C++ code to set the unreliable queue capacity for out-of-band object attachments. This variable is crucial for controlling the flow of unreliable RPCs from client to server, helping to manage network traffic and prevent overload of the server with client requests.

#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:27

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:


	static int32 ClientToServerUnreliableRPCQueueSize = 16;
	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");

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:

	FAutoConsoleVariableRef CVarReliableRPCQueueSize(TEXT("net.ReliableRPCQueueSize"), ReliableRPCQueueSize, TEXT("Maximum number of reliable RPCs queued per object. This is in addition to the 256 that are in the send window. This is to support very large RPCs that are split into smaller pieces."));

	static int32 ClientToServerUnreliableRPCQueueSize = 16;
	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");

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

Scope (from outer to inner):

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

Source code excerpt:

		if (Type == ENetObjectAttachmentType::OutOfBand)
		{
			QueuePtr->SetUnreliableQueueCapacity(AttachmentReplicationCVars::ClientToServerUnreliableRPCQueueSize);
		}

		return QueuePtr.Get();
	}
	else
	{

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

Scope (from outer to inner):

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

Source code excerpt:

		if (Type == ENetObjectAttachmentType::OutOfBand)
		{
			Queue->SetUnreliableQueueCapacity(AttachmentReplicationCVars::ClientToServerUnreliableRPCQueueSize);
		}

		return Queue;
	}
	else
	{