MovementTimeDiscrepancyResolutionRate

MovementTimeDiscrepancyResolutionRate

#Overview

name: MovementTimeDiscrepancyResolutionRate

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 MovementTimeDiscrepancyResolutionRate is to control the rate at which time discrepancies between the client and server are resolved in networked gameplay, specifically for character movement.

This setting variable is primarily used by the Unreal Engine’s networking and character movement systems. It is referenced in the GameNetworkManager and CharacterMovementComponent, which are core parts of Unreal Engine’s multiplayer and movement functionalities.

The value of this variable is set in the AGameNetworkManager constructor with a default value of 1.0f. It can be modified through configuration files or at runtime.

MovementTimeDiscrepancyResolutionRate interacts with other variables related to network time synchronization, such as MovementTimeDiscrepancyMaxTimeMargin, MovementTimeDiscrepancyMinTimeMargin, and MovementTimeDiscrepancyDriftAllowance.

Developers must be aware that this variable affects how quickly the game corrects time discrepancies between client and server. A higher value will result in faster corrections, while a lower value will make the corrections more gradual.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your game’s networking requirements.
  2. Testing different values to find the right balance between responsive corrections and smooth gameplay.
  3. Considering the impact on player experience, especially in fast-paced games where timing is crucial.
  4. Using it in conjunction with other network-related settings for optimal performance.
  5. Monitoring its effects on both client and server performance during gameplay testing.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	 */
	UPROPERTY(GlobalConfig)
	float MovementTimeDiscrepancyResolutionRate;

	/** 
	 * Accepted drift in clocks between client and server as a percent per second allowed. 
	 *
	 * 0.0 is "no forgiveness" and all logic would run on raw values, no tampering on the server side.
	 * 0.02 would be a 2% per second difference "forgiven" - if the time discrepancy in a given second was less than 2%,

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

Scope (from outer to inner):

file
function     void UCharacterMovementComponent::ProcessClientTimeStampForTimeDiscrepancy

Source code excerpt:


			// Calculate current move DeltaTime and PayBack time based on resolution rate
			const float ResolutionRate = FMath::Clamp(GameNetworkManager->MovementTimeDiscrepancyResolutionRate, 0.f, 1.f);
			float TimeToPayBack = FMath::Min(ServerBoundDeltaTime * ResolutionRate, ServerData.TimeDiscrepancy); // Make sure we only pay back the time we need to
			float DeltaTimeAfterPayback = ServerBoundDeltaTime - TimeToPayBack;

			// Adjust deltas so current move DeltaTime adheres to minimum tick time
			DeltaTimeAfterPayback = FMath::Max(DeltaTimeAfterPayback, UCharacterMovementComponent::MIN_TICK_TIME);
			TimeToPayBack = ServerBoundDeltaTime - DeltaTimeAfterPayback;

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

Scope (from outer to inner):

file
function     AGameNetworkManager::AGameNetworkManager

Source code excerpt:

	MovementTimeDiscrepancyMaxTimeMargin = 0.25f;
	MovementTimeDiscrepancyMinTimeMargin = -0.25f;
	MovementTimeDiscrepancyResolutionRate = 1.0f;
	MovementTimeDiscrepancyDriftAllowance = 0.0f;
	bMovementTimeDiscrepancyForceCorrectionsDuringResolution = false;
	bUseDistanceBasedRelevancy = true;
}

void AGameNetworkManager::EnableStandbyCheatDetection(bool bIsEnabled)