MaxClientForcedUpdateDuration

MaxClientForcedUpdateDuration

#Overview

name: MaxClientForcedUpdateDuration

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MaxClientForcedUpdateDuration is to limit the maximum time duration over which the server will force updates to clients after the MAXCLIENTUPDATEINTERVAL has been initially exceeded. This setting is part of Unreal Engine’s networking system, specifically related to client-server synchronization and movement replication.

This setting variable is primarily used in the GameFramework module, particularly within the GameNetworkManager and PlayerController classes. These components are crucial for managing network-related aspects of gameplay, including client movement and server-client synchronization.

The value of MaxClientForcedUpdateDuration is set in two places:

  1. It’s defined as a UPROPERTY with the GlobalConfig specifier in the AGameNetworkManager class, allowing it to be configured in the project settings.
  2. It’s initialized with a default value of 1.0f in the AGameNetworkManager constructor.

MaxClientForcedUpdateDuration interacts closely with other network-related variables, particularly MAXCLIENTUPDATEINTERVAL. While MAXCLIENTUPDATEINTERVAL determines how often client updates are forced, MaxClientForcedUpdateDuration caps the total duration of this forced update period.

Developers should be aware that this variable directly impacts the balance between network performance and game responsiveness. Setting it too high might lead to excessive network traffic, while setting it too low could result in less accurate client-server synchronization during periods of network instability.

Best practices when using this variable include:

  1. Carefully tuning it in conjunction with other network-related settings to achieve optimal performance for your specific game requirements.
  2. Testing thoroughly with various network conditions to ensure it provides a good balance between responsiveness and network efficiency.
  3. Considering the nature of your game’s movement and interaction systems when adjusting this value.
  4. Monitoring its impact on both server and client performance during development and testing phases.
  5. Being cautious about setting it higher than the default 1.0f value without thorough testing, as evidenced by the clamping to 5.0f in the PlayerController::TickActor function.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:28, 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:129

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	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. */
	UPROPERTY(GlobalConfig)
	float ServerForcedUpdateHitchThreshold;

	/** Ignore forced client movement updates when server hitch was detected within this amount of time in the past. */

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

Scope (from outer to inner):

file
function     AGameNetworkManager::AGameNetworkManager

Source code excerpt:

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

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

Scope (from outer to inner):

file
function     void APlayerController::TickActor

Source code excerpt:

						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)
						{
							if (ServerData->ServerTimeStamp > ServerData->ServerTimeLastForcedUpdate)