EscalateQuotaRPCsPerPeriod

EscalateQuotaRPCsPerPeriod

#Overview

name: EscalateQuotaRPCsPerPeriod

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of EscalateQuotaRPCsPerPeriod is to set a threshold for the number of Remote Procedure Calls (RPCs) allowed within a specific time period before triggering the next stage of Denial of Service (DoS) detection in Unreal Engine 5.

This setting variable is primarily used by the Unreal Engine’s networking subsystem, specifically within the DoS detection module. It is part of the RPC DoS detection mechanism, which aims to prevent potential abuse of the networking system.

The value of this variable is likely set through configuration files or programmatically within the engine’s initialization process. It is defined as a config property in the FRPCDoSStateConfig struct, indicating that it can be set in configuration files.

EscalateQuotaRPCsPerPeriod interacts with several other variables, including:

Developers should be aware that:

  1. Setting this variable to -1 effectively disables the RPC count-based escalation.
  2. The value should be carefully tuned based on the expected legitimate RPC usage in the game to avoid false positives.
  3. It works in conjunction with time-based quotas, so both should be considered when configuring DoS detection.

Best practices when using this variable include:

  1. Set a reasonable value based on profiling of normal game behavior.
  2. Use in combination with EscalateTimeQuotaMSPerPeriod for more robust DoS detection.
  3. Test thoroughly with various network conditions to ensure it doesn’t interfere with normal gameplay.
  4. Monitor and adjust based on real-world data after deployment.
  5. Consider different values for different game modes or player counts if necessary.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:1735, section: [RPCDoSDetection.Hitch]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1743, section: [RPCDoSDetection.Burst]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1754, section: [RPCDoSDetection.PersistentBurst]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1767, section: [RPCDoSDetection.DoS]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1783, section: [RPCDoSDetection.ExpensiveDoS]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:124

Scope (from outer to inner):

file
function     void FRPCDoSState::ApplyImpliedValues

Source code excerpt:

void FRPCDoSState::ApplyImpliedValues()
{
	EscalateQuotaTimePeriod = (EscalateQuotaRPCsPerPeriod != -1 || EscalateTimeQuotaMSPerPeriod != -1) ? EscalateQuotaTimePeriod : -1;
	RPCRepeatLimitTimePeriod = (RPCRepeatLimitPerPeriod != -1 || RPCRepeatLimitMSPerPeriod != -1) ? RPCRepeatLimitTimePeriod : -1;

	bTrackRecentRPCs = bTrackRecentRPCs || (RPCRepeatLimitPerPeriod != -1 && RPCRepeatLimitTimePeriod != -1);
	EscalateTimeQuotaSecsPerFrame = (EscalateTimeQuotaMSPerFrame != -1 ? (EscalateTimeQuotaMSPerFrame / 1000.0) : 0.0);
	EscalateTimeQuotaSecsPerPeriod = (EscalateTimeQuotaMSPerPeriod != -1 ? (EscalateTimeQuotaMSPerPeriod / 1000.0) : 0.0);
	RPCRepeatLimitSecsPerPeriod = (RPCRepeatLimitMSPerPeriod != -1 ? (RPCRepeatLimitMSPerPeriod / 1000.0) : 0.0);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:143

Scope (from outer to inner):

file
function     bool FRPCDoSState::HasHitQuota_Count

Source code excerpt:

#endif

	if (EscalateQuotaRPCsPerPeriod > 0 && !bReturnVal)
	{
		const FRPCDoSCounters& PeriodCounter = PerPeriodHistory[EscalateQuotaTimePeriod - 1];

		bReturnVal = PeriodCounter.RPCCounter + InFrameCounter.RPCCounter >= EscalateQuotaRPCsPerPeriod;

#if RPC_QUOTA_DEBUG
		UE_CLOG(bReturnVal, LogNet, Log, TEXT("HasHitQuota_Count: Hit Period Quota: RPCsPerPeriodCounter: %i, Limit: %i"),
				(PeriodCounter.RPCCounter + InFrameCounter.RPCCounter), EscalateQuotaRPCsPerPeriod);
#endif
	}

	return bReturnVal;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:286

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ValidateConfig

Source code excerpt:


	ValidateTimePeriod(EscalateQuotaTimePeriod, TEXT("EscalateQuotaTimePeriod"),
						(EscalateQuotaRPCsPerPeriod > 0 || EscalateTimeQuotaMSPerPeriod > 0));

	ValidateTimePeriod(RPCRepeatLimitTimePeriod, TEXT("RPCRepeatLimitTimePeriod"),
						(RPCRepeatLimitPerPeriod > 0 || RPCRepeatLimitMSPerPeriod > 0));

	if (AutoEscalateTime > 0 && AutoEscalateTime < CooloffTime)
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:315

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ApplyState

Source code excerpt:

	Target.EscalateQuotaRPCsPerFrame		= EscalateQuotaRPCsPerFrame;
	Target.EscalateTimeQuotaMSPerFrame		= EscalateTimeQuotaMSPerFrame;
	Target.EscalateQuotaRPCsPerPeriod		= EscalateQuotaRPCsPerPeriod;
	Target.EscalateTimeQuotaMSPerPeriod		= EscalateTimeQuotaMSPerPeriod;
	Target.EscalateQuotaTimePeriod			= EscalateQuotaTimePeriod;
	Target.RPCRepeatLimitPerPeriod			= RPCRepeatLimitPerPeriod;
	Target.RPCRepeatLimitMSPerPeriod		= RPCRepeatLimitMSPerPeriod;
	Target.RPCRepeatLimitTimePeriod			= RPCRepeatLimitTimePeriod;
	Target.CooloffTime						= CooloffTime;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:200

Scope: file

Source code excerpt:

	/** The number of RPC's per EscalateQuotaPeriod before the next stage of DoS detection is triggered */
	UPROPERTY(config)
	int16 EscalateQuotaRPCsPerPeriod	= -1;

	/** The amount of time spent executing RPC's per EscalateQuotaPeriod, before the next stage of DoS detection is triggered */
	UPROPERTY(config)
	int16 EscalateTimeQuotaMSPerPeriod	= -1;

	/** The time period to use for determining RPC count and time escalation quotas (Max: 16) */