TotalNetBandwidth

TotalNetBandwidth

#Overview

name: TotalNetBandwidth

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TotalNetBandwidth is to define the total available bandwidth (in bytes per second) for a listen server, which is then dynamically split across network connections. This setting variable is crucial for managing network resources in multiplayer game environments.

TotalNetBandwidth is primarily used by the Unreal Engine’s networking subsystem, specifically within the GameFramework module. It is referenced in the GameNetworkManager class, which is responsible for managing network-related aspects of the game.

The value of this variable is set through global configuration, as indicated by the UPROPERTY(globalconfig) decorator in the GameNetworkManager class definition. It can also be edited in the GameNetworkManagerSettings class, which suggests that it can be configured through the project settings in the Unreal Editor.

TotalNetBandwidth interacts with two other variables: MinDynamicBandwidth and MaxDynamicBandwidth. These variables define the minimum and maximum bandwidth that can be allocated to a single connection after splitting TotalNetBandwidth among all connections.

Developers must be aware that this variable directly impacts the network performance of their multiplayer game. Setting it too low may result in poor network quality for players, while setting it too high might not utilize available bandwidth efficiently or could potentially overestimate the server’s capabilities.

Best practices when using this variable include:

  1. Carefully consider the actual bandwidth capabilities of your server infrastructure when setting this value.
  2. Test thoroughly with various player counts to ensure optimal distribution of bandwidth.
  3. Monitor network performance in real-world scenarios and adjust as necessary.
  4. Consider the relationship between TotalNetBandwidth, MinDynamicBandwidth, and MaxDynamicBandwidth to ensure a balanced network resource allocation.
  5. Be prepared to adjust this value based on player feedback and observed network performance metrics.

#Setting Variables

#References In INI files

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

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

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	/** Total available bandwidth (in bytes/sec) for listen server, split dynamically across net connections */
	UPROPERTY(globalconfig)
	int32 TotalNetBandwidth;

	/** Minimum bandwidth set per connection after splitting TotalNetBandwidth */
	UPROPERTY(globalconfig)
	int32 MinDynamicBandwidth;

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

	//======================================================================================================================
	// Standby cheat detection
	

#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:27

Scope (from outer to inner):

file
class        class UGameNetworkManagerSettings : public UObject

Source code excerpt:

	/** 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. */
	UPROPERTY(config, EditAnywhere, Category=StandbyCheats)
	int32 BadPingThreshold;

	/** Used to determine if checking for standby cheats should occur. */