ServerForcedUpdateHitchThreshold

ServerForcedUpdateHitchThreshold

#Overview

name: ServerForcedUpdateHitchThreshold

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 ServerForcedUpdateHitchThreshold is to define a time threshold for detecting server hitches in the context of forced client movement updates. It is used to determine when to ignore these updates due to server performance issues.

This setting variable is primarily used in the game networking system of Unreal Engine, specifically within the GameNetworkManager and PlayerController classes. It’s part of the Engine module and is utilized in managing network-related gameplay aspects.

The value of this variable is set in the AGameNetworkManager constructor in GameNetworkManager.cpp, with a default value of 0.150 seconds. It can also be modified through the game configuration files, as indicated by the UPROPERTY(GlobalConfig) attribute in the GameNetworkManager class declaration.

ServerForcedUpdateHitchThreshold interacts closely with ServerForcedUpdateHitchCooldown. These two variables work together to manage the detection and handling of server hitches in relation to forced client movement updates.

Developers should be aware that this variable directly affects the responsiveness and smoothness of client movement in networked gameplay. Setting it too low might result in frequent ignoring of updates, while setting it too high might allow for choppy movement during server performance issues.

Best practices when using this variable include:

  1. Carefully tuning its value based on the specific needs of the game and the expected network conditions.
  2. Testing thoroughly with various network conditions to ensure optimal player experience.
  3. Considering the relationship between this variable and other network-related settings, such as MaxMoveDeltaTime and MAXCLIENTUPDATEINTERVAL.
  4. Monitoring its impact on gameplay and adjusting as necessary during development and after release.
  5. Documenting any changes made to this variable for future reference and troubleshooting.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

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

	/** MaxMoveDeltaTime is the default maximum time delta of CharacterMovement ServerMoves. Should be less than or equal to MAXCLIENTUPDATEINTERVAL, otherwise server will interfere by forcing position updates. */

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

Scope (from outer to inner):

file
function     AGameNetworkManager::AGameNetworkManager

Source code excerpt:

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

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

Scope (from outer to inner):

file
function     void APlayerController::TickActor

Source code excerpt:

						
						const float CurrentRealTime = World->GetRealTimeSeconds();
						const bool bHitch = (CurrentRealTime - LastMovementUpdateTime) > GameNetworkManager->ServerForcedUpdateHitchThreshold && (LastMovementUpdateTime != 0);
						LastMovementHitch = bHitch ? CurrentRealTime : LastMovementHitch;
						const bool bRecentHitch = bHitch || (CurrentRealTime - LastMovementHitch < GameNetworkManager->ServerForcedUpdateHitchCooldown);
						LastMovementUpdateTime = CurrentRealTime;

						// Trigger forced update if allowed
						const float PawnTimeMinForcedUpdateInterval = (DeltaSeconds + 0.06f) * GetPawn()->CustomTimeDilation;