net.EnableCongestionControl
net.EnableCongestionControl
#Overview
name: net.EnableCongestionControl
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables congestion control module.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.EnableCongestionControl is to enable or disable the congestion control module in Unreal Engine’s networking system. This setting is primarily used for managing network traffic and optimizing performance in networked games or applications.
This setting variable is primarily used in the Engine module, specifically within the networking subsystem. It’s referenced in the NetConnection and IpConnection classes, which are core components of Unreal Engine’s networking infrastructure.
The value of this variable is set through a console variable (CVarNetEnableCongestionControl) with a default value of 0, meaning it’s disabled by default. Developers can change this value at runtime or through configuration files.
The associated variable CVarNetEnableCongestionControl directly interacts with net.EnableCongestionControl. They share the same value and purpose.
Developers must be aware that enabling this variable (setting it to a value greater than 0) will activate the congestion control module. This can impact network performance and behavior, potentially affecting gameplay in multiplayer games.
Best practices when using this variable include:
- Testing thoroughly with both enabled and disabled states to understand its impact on your specific game or application.
- Consider enabling it for games with high network traffic or where network optimization is crucial.
- Monitor network performance metrics when changing this setting to ensure it’s beneficial for your use case.
Regarding the associated variable CVarNetEnableCongestionControl:
- It’s declared as a TAutoConsoleVariable, allowing for runtime modification.
- It’s used in the UIpConnection::InitBase function to determine whether to initialize the NetworkCongestionControl.
- The variable is declared as ENGINE_API, making it accessible across the engine.
When working with CVarNetEnableCongestionControl, developers should:
- Use GetValueOnAnyThread() when accessing its value for thread-safety.
- Be aware that changes to this variable will affect all connections, not just individual ones.
- Consider exposing this setting to advanced users or including it in performance profiling tools for your game.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetConnection.cpp:98
Scope: file
Source code excerpt:
#endif
TAutoConsoleVariable<int32> CVarNetEnableCongestionControl(TEXT("net.EnableCongestionControl"), 0,
TEXT("Enables congestion control module."));
static TAutoConsoleVariable<int32> CVarLogUnhandledFaults(TEXT("net.LogUnhandledFaults"), 1,
TEXT("Whether or not to warn about unhandled net faults (could be deliberate, depending on implementation). 0 = off, 1 = log once, 2 = log always."));
static int32 GNetCloseTimingDebug = 0;
#Associated Variable and Callsites
This variable is associated with another variable named CVarNetEnableCongestionControl
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpConnection.cpp:126
Scope (from outer to inner):
file
function void UIpConnection::InitBase
Source code excerpt:
}
if (CVarNetEnableCongestionControl.GetValueOnAnyThread() > 0)
{
NetworkCongestionControl.Emplace(CurrentNetSpeed, uint32(FNetPacketNotify::SequenceHistoryT::Size));
}
}
void UIpConnection::InitLocalConnection(UNetDriver* InDriver, class FSocket* InSocket, const FURL& InURL, EConnectionState InState, int32 InMaxPacket, int32 InPacketOverhead)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/NetConnection.h:72
Scope: file
Source code excerpt:
}
extern ENGINE_API TAutoConsoleVariable<int32> CVarNetEnableCongestionControl;
/*-----------------------------------------------------------------------------
Types.
-----------------------------------------------------------------------------*/
enum { RELIABLE_BUFFER = 512 }; // Power of 2 >= 1.
enum { MAX_PACKETID = FNetPacketNotify::SequenceNumberT::SeqNumberCount }; // Power of 2 >= 1, covering guaranteed loss/misorder time.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetConnection.cpp:98
Scope: file
Source code excerpt:
#endif
TAutoConsoleVariable<int32> CVarNetEnableCongestionControl(TEXT("net.EnableCongestionControl"), 0,
TEXT("Enables congestion control module."));
static TAutoConsoleVariable<int32> CVarLogUnhandledFaults(TEXT("net.LogUnhandledFaults"), 1,
TEXT("Whether or not to warn about unhandled net faults (could be deliberate, depending on implementation). 0 = off, 1 = log once, 2 = log always."));
static int32 GNetCloseTimingDebug = 0;