MAXCLIENTUPDATEINTERVAL

MAXCLIENTUPDATEINTERVAL

#Overview

name: MAXCLIENTUPDATEINTERVAL

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MAXCLIENTUPDATEINTERVAL is to define the maximum time allowed between movement updates from the client before the server forces an update. This setting is crucial for maintaining synchronization between the client and server in networked gameplay, particularly in the context of character movement and network prediction.

This setting variable is primarily used by the Engine module, specifically within the GameFramework and networking systems. It is heavily relied upon by the CharacterMovementComponent and PlayerController classes, which are core components of Unreal Engine’s player movement and control systems.

The value of MAXCLIENTUPDATEINTERVAL is set in the AGameNetworkManager constructor, with a default value of 0.25 seconds. It is declared as a UPROPERTY with the GlobalConfig specifier, which means it can be modified in the project’s configuration files.

MAXCLIENTUPDATEINTERVAL interacts closely with other network-related variables, such as MaxClientForcedUpdateDuration and MaxMoveDeltaTime. It’s important to note that MaxMoveDeltaTime should not exceed MAXCLIENTUPDATEINTERVAL to prevent server interference with large move deltas.

Developers must be aware that setting MAXCLIENTUPDATEINTERVAL to zero allows the server to disable the forced update feature entirely. Additionally, this variable plays a crucial role in determining when the server should force updates from clients, which can impact network performance and gameplay smoothness.

Best practices when using this variable include:

  1. Carefully balancing it with other network-related settings to achieve optimal performance and gameplay experience.
  2. Considering the game’s specific requirements and network conditions when adjusting this value.
  3. Testing thoroughly with various network conditions to ensure smooth gameplay across different scenarios.
  4. Monitoring server and client performance metrics to fine-tune this setting for optimal results.
  5. Documenting any changes made to this variable and their impacts on the game’s networking behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:27, section: [/Script/Engine.GameNetworkManager]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/GameNetworkManager.h:127

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	/** MAXCLIENTUPDATEINTERVAL is the maximum time between movement updates from the client before the server forces an update. */
	UPROPERTY(GlobalConfig)
	float MAXCLIENTUPDATEINTERVAL;

	/** MaxClientForcedUpdateDuration is the maximum time duration over which the server will force updates, after MAXCLIENTUPDATEINTERVAL is initially exceeded. */
	UPROPERTY(GlobalConfig)
	float MaxClientForcedUpdateDuration;
	
	/** Ignore forced client movement updates when server hitches for longer than this duration. */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:12020

Scope (from outer to inner):

file
function     FNetworkPredictionData_Server_Character::FNetworkPredictionData_Server_Character

Source code excerpt:

	{
		MaxMoveDeltaTime = GameNetworkManager->MaxMoveDeltaTime;
		if (GameNetworkManager->MaxMoveDeltaTime > GameNetworkManager->MAXCLIENTUPDATEINTERVAL)
		{
			UE_LOG(LogNetPlayerMovement, Warning, TEXT("GameNetworkManager::MaxMoveDeltaTime (%f) is greater than GameNetworkManager::MAXCLIENTUPDATEINTERVAL (%f)! Server will interfere with move deltas that large!"), GameNetworkManager->MaxMoveDeltaTime, GameNetworkManager->MAXCLIENTUPDATEINTERVAL);
		}
	}

	const UWorld* World = ServerMovement.GetWorld();
	if (World)
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:27

Scope (from outer to inner):

file
function     AGameNetworkManager::AGameNetworkManager

Source code excerpt:

	MAXNEARZEROVELOCITYSQUARED = 9.0f;
	CLIENTADJUSTUPDATECOST = 180.0f;
	MAXCLIENTUPDATEINTERVAL = 0.25f;
	MaxClientForcedUpdateDuration=1.0f;
	ServerForcedUpdateHitchThreshold = 0.150f;
	ServerForcedUpdateHitchCooldown = 0.100f;
	MaxMoveDeltaTime = 0.125f;
	MaxClientSmoothingDeltaTime = 0.50f;
	ClientNetSendMoveDeltaTime = 0.0166f;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:5086

Scope (from outer to inner):

file
function     void APlayerController::TickActor

Source code excerpt:

						// See how long we wait to force an update. Setting MAXCLIENTUPDATEINTERVAL to zero allows the server to disable this feature.
						const AGameNetworkManager* GameNetworkManager = (const AGameNetworkManager*)(AGameNetworkManager::StaticClass()->GetDefaultObject());
						const float ForcedUpdateInterval = GameNetworkManager->MAXCLIENTUPDATEINTERVAL;
						const float ForcedUpdateMaxDuration = FMath::Min(GameNetworkManager->MaxClientForcedUpdateDuration, 5.0f);

						// If currently resolving forced updates, and exceeded max duration, then wait for a valid update before enabling them again.
						ServerData->bForcedUpdateDurationExceeded = false;
						if (ServerData->bTriggeringForcedUpdates)
						{