net.UnreliableRPCQueueSize

net.UnreliableRPCQueueSize

#Overview

name: net.UnreliableRPCQueueSize

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.UnreliableRPCQueueSize is to control the maximum number of unreliable Remote Procedure Calls (RPCs) that can be queued per object in Unreal Engine’s networking system. This setting is crucial for managing network traffic and performance in multiplayer games.

This setting variable is primarily used in the Iris networking subsystem, which is part of Unreal Engine’s experimental networking features. Specifically, it’s used in the AttachmentReplication module, which handles replication of object attachments across the network.

The value of this variable is set in the AttachmentReplicationCVars namespace, with a default value of 10. It’s implemented as a console variable, which means it can be adjusted at runtime through the console or configuration files.

The UnreliableRPCQueueSize variable interacts closely with two other variables:

  1. ReliableRPCQueueSize, which controls the queue size for reliable RPCs.
  2. ClientToServerUnreliableRPCQueueSize, which specifically controls the queue size for unreliable RPCs sent from clients to the server.

Developers must be aware that this variable directly impacts network performance and behavior. If the queue size is too small, it may result in important RPCs being dropped when the network is congested. If it’s too large, it might lead to increased memory usage and potentially outdated information being sent.

Best practices when using this variable include:

  1. Carefully balancing it with other network settings to optimize performance.
  2. Monitoring its impact on network traffic and adjusting as necessary.
  3. Considering different values for different types of games or network conditions.
  4. Testing thoroughly with various network conditions to ensure optimal performance.

Regarding the associated variable UnreliableRPCQueueSize, it’s an internal static variable that directly corresponds to the console variable. It’s used within the AttachmentReplication system to initialize the MaxUnreliableCount in both FNetObjectAttachmentSendQueue and FNetObjectAttachmentReceiveQueue. This ensures that the queue size set by the console variable is correctly applied to both sending and receiving queues for unreliable RPCs.

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

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:

{
	static int32 UnreliableRPCQueueSize = 10;
	FAutoConsoleVariableRef CVarUnreliableRPCQueueSize(TEXT("net.UnreliableRPCQueueSize"), UnreliableRPCQueueSize, TEXT("Maximum number of unreliable RPCs queued per object. If more RPCs are queued then older ones will be dropped."));

	static int32 ReliableRPCQueueSize = 4096;
	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."));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    UE::Net::Private
namespace    AttachmentReplicationCVars

Source code excerpt:

namespace AttachmentReplicationCVars
{
	static int32 UnreliableRPCQueueSize = 10;
	FAutoConsoleVariableRef CVarUnreliableRPCQueueSize(TEXT("net.UnreliableRPCQueueSize"), UnreliableRPCQueueSize, TEXT("Maximum number of unreliable RPCs queued per object. If more RPCs are queued then older ones will be dropped."));

	static int32 ReliableRPCQueueSize = 4096;
	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."));

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

Scope (from outer to inner):

file
namespace    UE::Net::Private
function     FNetObjectAttachmentSendQueue::FNetObjectAttachmentSendQueue

Source code excerpt:

FNetObjectAttachmentSendQueue::FNetObjectAttachmentSendQueue()
: ReliableQueue(nullptr)
, MaxUnreliableCount(AttachmentReplicationCVars::UnreliableRPCQueueSize)
{
}

FNetObjectAttachmentSendQueue::~FNetObjectAttachmentSendQueue()
{
	delete ReliableQueue;

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

Scope (from outer to inner):

file
namespace    UE::Net::Private
function     FNetObjectAttachmentReceiveQueue::FNetObjectAttachmentReceiveQueue

Source code excerpt:


FNetObjectAttachmentReceiveQueue::FNetObjectAttachmentReceiveQueue()
: MaxUnreliableCount(AttachmentReplicationCVars::UnreliableRPCQueueSize)
{
}

FNetObjectAttachmentReceiveQueue::~FNetObjectAttachmentReceiveQueue()
{
	delete ReliableQueue;