net.NetPingTypes
net.NetPingTypes
#Overview
name: net.NetPingTypes
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
A comma-delimited list of EPingType pings to enable, and (optionally) the EPingAverageType averaging to apply to the ping (e.g: \
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.NetPingTypes is to configure the types of network pings and their associated averaging methods in Unreal Engine’s networking system. This setting variable allows developers to specify which ping types should be enabled and how their values should be averaged.
-
The net.NetPingTypes variable is primarily used by the networking subsystem of Unreal Engine, specifically in the NetPing module.
-
The value of this variable is set through a console variable (CVar) system, which allows it to be modified at runtime or through configuration files.
-
This variable interacts with the EPingType and EPingAverageType enums, which define the available ping types and averaging methods, respectively.
-
Developers must be aware that this variable accepts a comma-delimited list of ping types and their associated averaging methods. The format is “PingType=AverageType”, such as “RoundTrip=None,RoundTripExclFrame=PlayerStateAvg,ICMP=MovingAverage”.
-
Best practices when using this variable include:
- Carefully selecting the appropriate ping types for your game’s networking requirements.
- Choosing suitable averaging methods for each ping type to balance responsiveness and stability.
- Regularly testing and monitoring the impact of different configurations on network performance.
Regarding the associated variable CVarNetPingTypes:
-
CVarNetPingTypes is the actual console variable object that stores and manages the net.NetPingTypes setting.
-
It is defined as a TAutoConsoleVariable
, which means it can be modified at runtime and persists its value. -
The variable is initialized with an empty string as the default value.
-
It is used in the FNetPing::Init() function to configure the enabled ping types and their averaging methods.
-
Developers should be aware that changes to this variable will take effect when the FNetPing::Init() function is called, which typically happens during engine initialization or when the networking system is reset.
-
Best practices for using CVarNetPingTypes include:
- Modifying it through the appropriate console commands or configuration files.
- Ensuring that the string format is correct and contains valid EPingType and EPingAverageType values.
- Considering the performance implications of enabling multiple ping types or complex averaging methods.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/NetPing.cpp:36
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
static TAutoConsoleVariable<FString> CVarNetPingTypes(
TEXT("net.NetPingTypes"), TEXT(""),
TEXT("A comma-delimited list of EPingType pings to enable, and (optionally) the EPingAverageType averaging to apply to the ping ")
TEXT("(e.g: \"RoundTrip=None,RoundTripExclFrame=PlayerStateAvg,ICMP=MovingAverage\")."));
static int32 GNetPingICMPInterval = 5.0;
static FAutoConsoleVariableRef CVarNetPingICMPInterval(
#Associated Variable and Callsites
This variable is associated with another variable named CVarNetPingTypes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/NetPing.cpp:35
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
TEXT("(Valid values: 0 = Off, 1 = Enabled for client, 2 = Enabled for server and client, 3 = Enabled for server only)"));
static TAutoConsoleVariable<FString> CVarNetPingTypes(
TEXT("net.NetPingTypes"), TEXT(""),
TEXT("A comma-delimited list of EPingType pings to enable, and (optionally) the EPingAverageType averaging to apply to the ping ")
TEXT("(e.g: \"RoundTrip=None,RoundTripExclFrame=PlayerStateAvg,ICMP=MovingAverage\")."));
static int32 GNetPingICMPInterval = 5.0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/NetPing.cpp:336
Scope (from outer to inner):
file
namespace UE::Net
function void FNetPing::Init
Source code excerpt:
static EPingAverageType LastPingAverageTypes[static_cast<uint32>(EPingType::Count)] = { EPingAverageType::None };
FString PingTypesCVar = CVarNetPingTypes.GetValueOnAnyThread();
if (UNLIKELY(LastPingTypesCVar != PingTypesCVar))
{
LastPingTypesCVar = PingTypesCVar;
TArray<FString> PingTypeList;