MaxClientSmoothingDeltaTime
MaxClientSmoothingDeltaTime
#Overview
name: MaxClientSmoothingDeltaTime
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 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaxClientSmoothingDeltaTime is to control the maximum time delta between server updates that clients are allowed to interpolate for position smoothing in character movement. This setting is primarily used in the character movement system of Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the character movement component, which is part of the Engine module. It’s specifically used in the network prediction and smoothing logic for client-side character movement.
The value of this variable is set in multiple places:
- In the AGameNetworkManager constructor, it’s initialized with a default value of 0.50f.
- In the FNetworkPredictionData_Client_Character constructor, it’s set to the maximum of the GameNetworkManager’s MaxClientSmoothingDeltaTime and twice the MaxMoveDeltaTime.
This variable interacts with several other variables, including:
- MaxMoveDeltaTime
- SmoothingServerTimeStamp
- SmoothingClientTimeStamp
- SmoothNetUpdateTime
Developers must be aware that this variable directly affects the smoothness of character movement on the client-side, especially in networked gameplay. A larger value allows for smoother interpolation but might introduce more latency in position updates, while a smaller value reduces latency but might result in more jerky movement.
Best practices when using this variable include:
- Carefully balancing it with other network-related settings to achieve smooth gameplay without introducing too much latency.
- Testing thoroughly with various network conditions to ensure it performs well across different scenarios.
- Considering adjusting this value based on the specific needs of your game, such as the pace of gameplay or the importance of precise positioning.
- Monitoring its impact on both visual smoothness and gameplay responsiveness during playtesting.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:32, section: [/Script/Engine.GameNetworkManager]
- INI Section:
/Script/Engine.GameNetworkManager
- Raw value:
0.50f
- 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/CharacterMovementComponent.h:3095
Scope (from outer to inner):
file
class class FNetworkPredictionData_Client_Character : public FNetworkPredictionData_Client, protected FNoncopyable
Source code excerpt:
/** Max time delta between server updates over which client smoothing is allowed to interpolate. */
float MaxClientSmoothingDeltaTime;
/** Used to track the timestamp of the last server move. */
double SmoothingServerTimeStamp;
/** Used to track the client time as we try to match the server.*/
double SmoothingClientTimeStamp;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/GameNetworkManager.h:145
Scope (from outer to inner):
file
class class AGameNetworkManager : public AInfo
Source code excerpt:
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). */
UPROPERTY(GlobalConfig)
float MaxClientSmoothingDeltaTime;
/**
* ClientNetSendMoveDeltaTime is the default minimum time delta of CharacterMovement client moves to the server. When updates occur more frequently, they may be combined to save bandwidth.
* This value is not used when player count is over ClientNetSendMoveThrottleOverPlayerCount or player net speed is <= ClientNetSendMoveThrottleAtNetSpeed (see ClientNetSendMoveDeltaTimeThrottled).
*/
UPROPERTY(GlobalConfig)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:7909
Scope (from outer to inner):
file
function void UCharacterMovementComponent::SmoothCorrection
Source code excerpt:
// Don't let the client fall too far behind or run ahead of new server time.
const double ServerDeltaTime = ClientData->SmoothingServerTimeStamp - OldServerTimeStamp;
const double MaxOffset = ClientData->MaxClientSmoothingDeltaTime;
const double MinOffset = FMath::Min(double(ClientData->SmoothNetUpdateTime), MaxOffset);
// MaxDelta is the farthest behind we're allowed to be after receiving a new server time.
const double MaxDelta = FMath::Clamp(ServerDeltaTime * 1.25, MinOffset, MaxOffset);
ClientData->SmoothingClientTimeStamp = FMath::Clamp(ClientData->SmoothingClientTimeStamp, ClientData->SmoothingServerTimeStamp - MaxDelta, ClientData->SmoothingServerTimeStamp);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:11815
Scope (from outer to inner):
file
function FNetworkPredictionData_Client_Character::FNetworkPredictionData_Client_Character
Source code excerpt:
, LastCorrectionDelta(0.f)
, LastCorrectionTime(0.f)
, MaxClientSmoothingDeltaTime(0.5f)
, SmoothingServerTimeStamp(0.f)
, SmoothingClientTimeStamp(0.f)
, MaxSmoothNetUpdateDist(0.f)
, NoSmoothNetUpdateDist(0.f)
, SmoothNetUpdateTime(0.f)
, SmoothNetUpdateRotationTime(0.f)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:11839
Scope (from outer to inner):
file
function FNetworkPredictionData_Client_Character::FNetworkPredictionData_Client_Character
Source code excerpt:
{
MaxMoveDeltaTime = GameNetworkManager->MaxMoveDeltaTime;
MaxClientSmoothingDeltaTime = FMath::Max(GameNetworkManager->MaxClientSmoothingDeltaTime, MaxMoveDeltaTime * 2.0f);
}
if (ClientMovement.GetOwnerRole() == ROLE_AutonomousProxy)
{
SavedMoves.Reserve(MaxSavedMoveCount);
FreeMoves.Reserve(MaxFreeMoveCount);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:32
Scope (from outer to inner):
file
function AGameNetworkManager::AGameNetworkManager
Source code excerpt:
ServerForcedUpdateHitchCooldown = 0.100f;
MaxMoveDeltaTime = 0.125f;
MaxClientSmoothingDeltaTime = 0.50f;
ClientNetSendMoveDeltaTime = 0.0166f;
ClientNetSendMoveDeltaTimeThrottled = 0.0222f;
ClientNetSendMoveDeltaTimeStationary = 0.0166f;
ClientNetSendMoveThrottleAtNetSpeed = 10000;
ClientNetSendMoveThrottleOverPlayerCount = 10;
ClientAuthorativePosition = false;