MaxDynamicBandwidth

MaxDynamicBandwidth

#Overview

name: MaxDynamicBandwidth

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MaxDynamicBandwidth is to set the maximum bandwidth limit for individual network connections in Unreal Engine’s networking system. It is used to control and optimize network traffic for multiplayer games.

This setting variable is primarily used by the GameNetworkManager subsystem within Unreal Engine’s networking module. It’s referenced in both the GameNetworkManager class and the GameNetworkManagerSettings class, indicating its importance in managing network resources.

The value of this variable is typically set in the project’s configuration files, as indicated by the UPROPERTY(globalconfig) decorator in the GameNetworkManager class. It can also be modified through the GameNetworkManagerSettings class, which allows for runtime adjustments.

MaxDynamicBandwidth interacts with other networking variables, notably:

  1. MinDynamicBandwidth: Used as the lower bound when calculating network speeds.
  2. TotalNetBandwidth: Used to calculate the bandwidth allocation for each player.
  3. AdjustedNetSpeed: Set to the value of MaxDynamicBandwidth during initialization.

Developers should be aware that this variable plays a crucial role in balancing network performance across multiple players. It acts as an upper limit for individual connection bandwidth, preventing any single connection from monopolizing network resources.

Best practices when using this variable include:

  1. Setting a value that balances between good performance for individual players and fair distribution of resources in multiplayer scenarios.
  2. Considering the game’s specific networking requirements and adjusting this value accordingly during development and testing.
  3. Using it in conjunction with MinDynamicBandwidth and TotalNetBandwidth to create a flexible and efficient networking setup.
  4. Monitoring its impact on network performance and adjusting as necessary based on real-world usage data.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:21, section: [/Script/Engine.GameNetworkManager]

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:31, 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:68

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	/** Maximum bandwidth set per connection after splitting TotalNetBandwidth */
	UPROPERTY(globalconfig)
	int32 MaxDynamicBandwidth;

	//======================================================================================================================
	// Standby cheat detection
	
	/** Used to determine if checking for standby cheats should occur */
	UPROPERTY(config)

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

Scope (from outer to inner):

file
function     void AGameNetworkManager::PostInitializeComponents

Source code excerpt:

{
	Super::PostInitializeComponents();
	AdjustedNetSpeed = MaxDynamicBandwidth;
}

void AGameNetworkManager::UpdateNetSpeedsTimer()
{
	UpdateNetSpeeds(false);
}

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

Scope (from outer to inner):

file
function     int32 AGameNetworkManager::CalculatedNetSpeed

Source code excerpt:

	}

	return FMath::Clamp(TotalNetBandwidth/NumPlayers, MinDynamicBandwidth, MaxDynamicBandwidth);
}

void AGameNetworkManager::StandbyCheatDetected(EStandbyType StandbyType) {}

bool AGameNetworkManager::WithinUpdateDelayBounds(APlayerController* PC, float LastUpdateTime) const
{

#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Classes/GameNetworkManagerSettings.h:23

Scope (from outer to inner):

file
class        class UGameNetworkManagerSettings : public UObject

Source code excerpt:

	/** Maximum bandwidth dynamically set per connection. */
	UPROPERTY(globalconfig, EditAnywhere, Category=Bandwidth)
	int32 MaxDynamicBandwidth;

	/** Total available bandwidth for listen server, split dynamically across net connections. */
	UPROPERTY(globalconfig, EditAnywhere, Category=Bandwidth)
	int32 TotalNetBandwidth;

	/** The point we determine the server is either delaying packets or has bad upstream. */