CLIENTADJUSTUPDATECOST

CLIENTADJUSTUPDATECOST

#Overview

name: CLIENTADJUSTUPDATECOST

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 CLIENTADJUSTUPDATECOST is to control the frequency of client adjustment updates in networked gameplay. It is used to balance network performance and game synchronization.

This setting variable is primarily used by the Unreal Engine’s networking and gameplay systems, specifically within the GameFramework module. It is utilized by the GameNetworkManager class, which is responsible for managing network-related aspects of the game.

The value of CLIENTADJUSTUPDATECOST is set in the GameNetworkManager constructor with a default value of 180.0f. However, it is declared as a UPROPERTY with the GlobalConfig flag, which means it can be overridden in configuration files, allowing for easy adjustment without recompiling the code.

CLIENTADJUSTUPDATECOST interacts with other networking-related variables, such as MAXCLIENTUPDATEINTERVAL and the player’s CurrentNetSpeed. It is used in conjunction with these variables to determine whether a client update should be processed or not.

Developers must be aware that this variable directly affects the frequency of client adjustment updates. A higher value will reduce the frequency of updates, which can help reduce network traffic but may lead to less accurate client-server synchronization. Conversely, a lower value will increase update frequency, potentially improving synchronization at the cost of increased network usage.

Best practices when using this variable include:

  1. Carefully balancing the value to achieve optimal network performance and game synchronization.
  2. Testing thoroughly with various network conditions to ensure the chosen value works well across different scenarios.
  3. Considering the nature of the game and its specific networking requirements when adjusting this value.
  4. Using configuration files to fine-tune this value without needing to recompile the game code.
  5. Monitoring client-server discrepancies and adjusting the value if synchronization issues arise during gameplay.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	other updates sent to the client.  Increase this value to reduce client adjustment update frequency, or if the amount of data sent in the clientadjustment() call increases */
	UPROPERTY(GlobalConfig)
	float CLIENTADJUSTUPDATECOST;

	/** 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. */

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

Scope (from outer to inner):

file
function     AGameNetworkManager::AGameNetworkManager

Source code excerpt:

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

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

Scope (from outer to inner):

file
function     bool AGameNetworkManager::WithinUpdateDelayBounds

Source code excerpt:

		return true;
	}
	else if (TimeSinceUpdate < GetDefault<AGameNetworkManager>(GetClass())->CLIENTADJUSTUPDATECOST/PC->Player->CurrentNetSpeed)
	{
		return true;
	}
	return false;
}