ServerForcedUpdateHitchCooldown
ServerForcedUpdateHitchCooldown
#Overview
name: ServerForcedUpdateHitchCooldown
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 ServerForcedUpdateHitchCooldown is to manage server-client movement synchronization in the presence of network hitches. It specifically defines a cooldown period during which forced client movement updates are ignored after a server hitch is detected.
This setting variable is primarily used by the networking and movement systems within Unreal Engine. Based on the callsites, it’s part of the GameNetworkManager class, which is responsible for managing network-related game settings.
The value of ServerForcedUpdateHitchCooldown is set in the AGameNetworkManager constructor in GameNetworkManager.cpp, with a default value of 0.100 seconds. It can also be configured globally through the engine’s configuration system, as indicated by the UPROPERTY(GlobalConfig) decorator in the class declaration.
ServerForcedUpdateHitchCooldown interacts closely with ServerForcedUpdateHitchThreshold, which determines when a hitch is considered to have occurred. Together, these variables control how the engine responds to network hitches in terms of movement updates.
Developers must be aware that this variable affects the responsiveness and smoothness of character movement in networked games. Setting it too low might result in jerky movement during network instability, while setting it too high could lead to temporary desynchronization between server and client.
Best practices when using this variable include:
- Carefully tuning it in conjunction with ServerForcedUpdateHitchThreshold to find the right balance between smooth movement and accurate synchronization.
- Testing the settings under various network conditions to ensure optimal performance.
- Considering the game’s specific requirements and gameplay style when adjusting this value.
- Monitoring client-side prediction and server reconciliation behavior when modifying this setting.
- Documenting any changes made to this value and the rationale behind them for future reference and fine-tuning.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:30, section: [/Script/Engine.GameNetworkManager]
- INI Section:
/Script/Engine.GameNetworkManager
- Raw value:
0.100f
- Is Array:
False
#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:139
Scope (from outer to inner):
file
class class AGameNetworkManager : public AInfo
Source code excerpt:
/** 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. */
UPROPERTY(GlobalConfig)
float MaxMoveDeltaTime;
/** MaxClientSmoothingDeltaTime is the maximum delta time between server updates that clients are allowed to smooth between for position interpolation. This was previously (2 * MaxMoveDeltaTime). */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:30
Scope (from outer to inner):
file
function AGameNetworkManager::AGameNetworkManager
Source code excerpt:
MaxClientForcedUpdateDuration=1.0f;
ServerForcedUpdateHitchThreshold = 0.150f;
ServerForcedUpdateHitchCooldown = 0.100f;
MaxMoveDeltaTime = 0.125f;
MaxClientSmoothingDeltaTime = 0.50f;
ClientNetSendMoveDeltaTime = 0.0166f;
ClientNetSendMoveDeltaTimeThrottled = 0.0222f;
ClientNetSendMoveDeltaTimeStationary = 0.0166f;
ClientNetSendMoveThrottleAtNetSpeed = 10000;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:5124
Scope (from outer to inner):
file
function void APlayerController::TickActor
Source code excerpt:
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;
const float PawnTimeForcedUpdateInterval = FMath::Max<float>(PawnTimeMinForcedUpdateInterval, ForcedUpdateInterval * GetPawn()->GetActorTimeDilation());