ClientNetSendMoveThrottleOverPlayerCount
ClientNetSendMoveThrottleOverPlayerCount
#Overview
name: ClientNetSendMoveThrottleOverPlayerCount
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ClientNetSendMoveThrottleOverPlayerCount is to control the network traffic optimization for character movement in multiplayer games. It sets a threshold for the number of players in a game, above which the game will switch to using a throttled network send rate for client movement updates.
This setting variable is primarily used by the Unreal Engine’s networking and movement systems, specifically within the GameFramework module. It is closely tied to the CharacterMovementComponent and the GameNetworkManager.
The value of this variable is set in the GameNetworkManager constructor (GameNetworkManager.cpp) with a default value of 10. It can be modified through the engine’s configuration system, as indicated by the UPROPERTY(GlobalConfig) decorator in the GameNetworkManager class definition.
ClientNetSendMoveThrottleOverPlayerCount interacts with several other variables, including:
- ClientNetSendMoveDeltaTime
- ClientNetSendMoveDeltaTimeThrottled
- ClientNetSendMoveThrottleAtNetSpeed
Developers must be aware that this variable directly impacts the frequency of movement updates sent from clients to the server in multiplayer games. When the number of players exceeds this threshold, the engine switches to using the throttled delta time (ClientNetSendMoveDeltaTimeThrottled) instead of the regular delta time (ClientNetSendMoveDeltaTime) for movement updates.
Best practices when using this variable include:
- Carefully tuning its value based on your game’s specific requirements and the expected number of players.
- Testing thoroughly with various player counts to ensure smooth gameplay and acceptable network performance.
- Considering the trade-off between network bandwidth usage and movement update frequency.
- Adjusting related variables (like ClientNetSendMoveDeltaTimeThrottled) in tandem to achieve the desired balance between responsiveness and network efficiency.
- Monitoring server performance and client experiences when approaching and exceeding this player count threshold.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:37, section: [/Script/Engine.GameNetworkManager]
- INI Section:
/Script/Engine.GameNetworkManager
- Raw value:
10
- 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:151
Scope (from outer to inner):
file
class class AGameNetworkManager : public AInfo
Source code excerpt:
/**
* 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)
float ClientNetSendMoveDeltaTime;
/** ClientNetSendMoveDeltaTimeThrottled is used in place of ClientNetSendMoveDeltaTime when player count is high or net speed is low. See ClientNetSendMoveDeltaTime for more info. */
UPROPERTY(GlobalConfig)
float ClientNetSendMoveDeltaTimeThrottled;
/** ClientNetSendMoveDeltaTimeStationary is used when players are determined to not be moving or changing their view. See ClientNetSendMoveDeltaTime for more info. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/GameNetworkManager.h:170
Scope (from outer to inner):
file
class class AGameNetworkManager : public AInfo
Source code excerpt:
/** When player count is greater than this amount, ClientNetSendMoveDeltaTimeThrottled is used instead of ClientNetSendMoveDeltaTime. */
UPROPERTY(GlobalConfig)
int32 ClientNetSendMoveThrottleOverPlayerCount;
/** Minimum delay between the server sending error corrections to a client, in seconds. */
UPROPERTY(GlobalConfig)
float ClientErrorUpdateRateLimit;
/** Minimum delay between calls to ServerUpdateCamera, in seconds. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:12432
Scope (from outer to inner):
file
function float UCharacterMovementComponent::GetClientNetSendDeltaTime
Source code excerpt:
{
// send moves more frequently in small games where server isn't likely to be saturated
if ((Player->CurrentNetSpeed > GameNetworkManager->ClientNetSendMoveThrottleAtNetSpeed) && (GameState != nullptr) && (GameState->PlayerArray.Num() <= GameNetworkManager->ClientNetSendMoveThrottleOverPlayerCount))
{
NetMoveDelta = GameNetworkManager->ClientNetSendMoveDeltaTime;
}
else
{
NetMoveDelta = FMath::Max(GameNetworkManager->ClientNetSendMoveDeltaTimeThrottled, 2 * GameNetworkManager->MoveRepSize / Player->CurrentNetSpeed);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:37
Scope (from outer to inner):
file
function AGameNetworkManager::AGameNetworkManager
Source code excerpt:
ClientNetSendMoveDeltaTimeStationary = 0.0166f;
ClientNetSendMoveThrottleAtNetSpeed = 10000;
ClientNetSendMoveThrottleOverPlayerCount = 10;
ClientAuthorativePosition = false;
ClientErrorUpdateRateLimit = 0.0f;
ClientNetCamUpdateDeltaTime = 0.0166f;
ClientNetCamUpdatePositionLimit = 1000.0f;
bMovementTimeDiscrepancyDetection = false;
bMovementTimeDiscrepancyResolution = false;