net.OptimizedRemapping
net.OptimizedRemapping
#Overview
name: net.OptimizedRemapping
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Uses optimized path to remap unmapped network guids
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.OptimizedRemapping is to enable an optimized path for remapping unmapped network GUIDs (Globally Unique Identifiers) in Unreal Engine’s networking system. This setting is primarily used in the network replication system to improve performance when dealing with object references across the network.
This setting variable is mainly relied upon by the Unreal Engine’s networking subsystem, specifically within the NetDriver module. It’s used in the process of updating unmapped objects during network replication.
The value of this variable is set using a console variable (CVar) system. It’s defined as a static TAutoConsoleVariable with a default value of 1 (enabled). Developers can change this value at runtime using console commands or configuration files.
The associated variable CVarOptimizedRemapping directly interacts with net.OptimizedRemapping. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the performance and behavior of network GUID remapping. When enabled (set to 1), it uses an optimized path for remapping, which could potentially improve performance in networked games with many object references.
Best practices when using this variable include:
- Leave it enabled (default value of 1) unless specific issues are encountered.
- If network replication issues occur, particularly with object references, consider disabling this optimization to see if it resolves the problem.
- Profile your game’s networking performance with this setting both enabled and disabled to determine the optimal configuration for your specific use case.
Regarding the associated variable CVarOptimizedRemapping:
The purpose of CVarOptimizedRemapping is identical to net.OptimizedRemapping, as they are essentially the same variable. It’s used to control whether the optimized path for remapping unmapped network GUIDs is used.
This variable is used directly in the UNetDriver::UpdateUnmappedObjects function, which is part of the core networking system in Unreal Engine. When the variable is true (non-zero), it enables the optimized remapping logic within this function.
The value of CVarOptimizedRemapping is set when it’s defined as a static TAutoConsoleVariable, with a default value of 1. It can be changed at runtime using console commands.
As mentioned earlier, this variable interacts directly with net.OptimizedRemapping, as they are two representations of the same setting.
Developers should be aware that this variable directly affects the behavior of the UpdateUnmappedObjects function, which is crucial for network replication of object references.
Best practices for using CVarOptimizedRemapping are the same as those for net.OptimizedRemapping, as they are effectively the same variable. Developers should monitor networking performance and object replication behavior when modifying this setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:921
Scope: file
Source code excerpt:
}
static TAutoConsoleVariable<int32> CVarOptimizedRemapping( TEXT( "net.OptimizedRemapping" ), 1, TEXT( "Uses optimized path to remap unmapped network guids" ) );
static TAutoConsoleVariable<int32> CVarMaxClientGuidRemaps( TEXT( "net.MaxClientGuidRemaps" ), 100, TEXT( "Max client resolves of unmapped network guids per tick" ) );
namespace UE
{
namespace Net
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarOptimizedRemapping
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:921
Scope: file
Source code excerpt:
}
static TAutoConsoleVariable<int32> CVarOptimizedRemapping( TEXT( "net.OptimizedRemapping" ), 1, TEXT( "Uses optimized path to remap unmapped network guids" ) );
static TAutoConsoleVariable<int32> CVarMaxClientGuidRemaps( TEXT( "net.MaxClientGuidRemaps" ), 100, TEXT( "Max client resolves of unmapped network guids per tick" ) );
namespace UE
{
namespace Net
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:1053
Scope (from outer to inner):
file
function void UNetDriver::UpdateUnmappedObjects
Source code excerpt:
SCOPE_CYCLE_COUNTER(STAT_NetUpdateUnmappedObjectsTime);
if (CVarOptimizedRemapping.GetValueOnAnyThread() && GuidCache.IsValid())
{
// Go over recently imported network guids, and see if there are any replicators that need to map them
TSet<FNetworkGUID>& ImportedNetGuidsRef = GuidCache->ImportedNetGuids;
TMap<FNetworkGUID, TSet<FNetworkGUID>>& PendingOuterNetGuidsRef = GuidCache->PendingOuterNetGuids;
GetMetrics()->SetInt(UE::Net::Metric::ImportedNetGuids, ImportedNetGuidsRef.Num());