Net.IsPushModelEnabled
Net.IsPushModelEnabled
#Overview
name: Net.IsPushModelEnabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether or not Push Model is enabled. This networking mode allows game code to notify the networking system of changes, rather than scraping.
It is referenced in 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Net.IsPushModelEnabled is to control whether the Push Model networking mode is enabled in Unreal Engine. This networking mode allows game code to notify the networking system of changes, rather than relying on property scraping.
This setting variable is primarily used in the networking and replication systems of Unreal Engine. Based on the callsites, it affects the following subsystems and modules:
- Net Core module (PushModel.cpp)
- Engine module (RepLayout.cpp)
- Iris Core module (experimental replication system)
The value of this variable is set through a console variable (CVar) named “Net.IsPushModelEnabled”. It is initialized as false by default but can be changed at runtime.
The main variable that interacts with Net.IsPushModelEnabled is bIsPushModelEnabled. They share the same value, and bIsPushModelEnabled is used throughout the codebase to check if Push Model is enabled.
Developers must be aware of the following when using this variable:
- Enabling Push Model changes how property replication works, potentially affecting network performance and behavior.
- It impacts the initialization of replication layouts (FRepLayout) for networked objects.
- It interacts with other Push Model-related settings, such as “Net.MakeBpPropertiesPushModel”.
Best practices when using this variable include:
- Test thoroughly with both enabled and disabled states to ensure your game performs well in both scenarios.
- Consider the impact on network traffic and optimize your game code accordingly when using Push Model.
- Use in conjunction with other Push Model-related settings for fine-tuned control over networked properties.
Regarding the associated variable bIsPushModelEnabled:
The purpose of bIsPushModelEnabled is to provide a convenient way to check if Push Model is enabled throughout the engine code. It directly reflects the value of Net.IsPushModelEnabled.
This variable is used in various parts of the engine, including:
- Replication layout initialization (RepLayout.cpp)
- Push Model-related checks in the Iris experimental replication system
The value of bIsPushModelEnabled is set by the console variable Net.IsPushModelEnabled.
Developers should be aware that bIsPushModelEnabled is the primary way to check if Push Model is enabled in C++ code. It’s used in conditional compilation (#if WITH_PUSH_MODEL) and runtime checks.
Best practices for using bIsPushModelEnabled include:
- Use the IsPushModelEnabled() function or the IS_PUSH_MODEL_ENABLED() macro instead of directly accessing the variable when possible.
- Be aware of the performance implications of frequent checks against this variable in performance-critical code paths.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Net/Core/Private/Net/Core/PushModel/PushModel.cpp:433
Scope (from outer to inner):
file
namespace UEPushModelPrivate
Source code excerpt:
bool bIsPushModelEnabled = false;
FAutoConsoleVariableRef CVarIsPushModelEnabled(
TEXT("Net.IsPushModelEnabled"),
bIsPushModelEnabled,
TEXT("Whether or not Push Model is enabled. This networking mode allows game code to notify the networking system of changes, rather than scraping.")
);
bool bMakeBpPropertiesPushModel = true;
FAutoConsoleVariableRef CVarMakeBpPropertiesPushModel(
#Associated Variable and Callsites
This variable is associated with another variable named bIsPushModelEnabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RepLayout.cpp:6039
Scope (from outer to inner):
file
function void FRepLayout::InitFromClass
Source code excerpt:
SCOPE_CYCLE_COUNTER(STAT_RepLayout_InitFromObjectClass);
const bool bIsPushModelEnabled = IS_PUSH_MODEL_ENABLED();
const bool bIsObjectActor = InObjectClass->IsChildOf(AActor::StaticClass());
if (bIsObjectActor)
{
Flags |= ERepLayoutFlags::IsActor;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RepLayout.cpp:6239
Scope (from outer to inner):
file
function void FRepLayout::InitFromClass
Source code excerpt:
++NumberOfLifetimeProperties;
#if WITH_PUSH_MODEL
if (bIsPushModelEnabled && LifetimeProps[i].bIsPushBased)
{
++NumberOfLifetimePushModelProperties;
PushModelProperties[ParentIndex] = true;
}
#endif
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RepLayout.cpp:6312
Scope: file
Source code excerpt:
++NumberOfFastArrayProperties;
#if WITH_PUSH_MODEL
if (bIsPushModelEnabled && LifetimeProps[i].bIsPushBased)
{
++NumberOfFastArrayPushModelProperties;
PushModelProperties[ParentIndex] = true;
}
#endif
bAddedFastArray = true;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RepLayout.cpp:6358
Scope (from outer to inner):
file
function void FRepLayout::InitFromClass
Source code excerpt:
#if WITH_PUSH_MODEL
if (bIsPushModelEnabled && ((NumberOfLifetimePushModelProperties > 0) || (NumberOfFastArrayPushModelProperties > 0)))
{
const bool bFullPushProperties = (NumberOfLifetimeProperties == NumberOfLifetimePushModelProperties);
if (bFullPushProperties)
{
Flags |= ERepLayoutFlags::FullPushProperties;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/LegacyPushModel.h:19
Scope (from outer to inner):
file
namespace UE::Net::Private
function inline bool IsIrisPushModelEnabled
Source code excerpt:
extern IRISCORE_API bool bIsIrisPushModelForceEnabled;
extern IRISCORE_API int IrisPushModelMode;
inline bool IsIrisPushModelEnabled(bool bIsPushModelEnabled = IS_PUSH_MODEL_ENABLED()) { return (bIsIrisPushModelForceEnabled | (IrisPushModelMode > 0)) & bIsPushModelEnabled; }
class FNetPushObjectHandle
{
public:
FNetPushObjectHandle(FNetHandle InNetHandle);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/LegacyPushModel.h:93
Scope (from outer to inner):
file
namespace UE::Net::Private
function inline constexpr bool IsIrisPushModelEnabled
Source code excerpt:
{
inline constexpr bool IsIrisPushModelEnabled(bool /* bIsPushModelEnabled */ = false) { return false; }
}
#define UE_NET_IRIS_SET_PUSH_ID(...)
#define UE_NET_IRIS_CLEAR_PUSH_ID(...)
#Loc: <Workspace>/Engine/Source/Runtime/Net/Core/Private/Net/Core/PushModel/PushModel.cpp:431
Scope (from outer to inner):
file
namespace UEPushModelPrivate
Source code excerpt:
static FPushModelObjectManager_CustomId PushObjectManager;
bool bIsPushModelEnabled = false;
FAutoConsoleVariableRef CVarIsPushModelEnabled(
TEXT("Net.IsPushModelEnabled"),
bIsPushModelEnabled,
TEXT("Whether or not Push Model is enabled. This networking mode allows game code to notify the networking system of changes, rather than scraping.")
);
bool bMakeBpPropertiesPushModel = true;
FAutoConsoleVariableRef CVarMakeBpPropertiesPushModel(
TEXT("Net.MakeBpPropertiesPushModel"),
#Loc: <Workspace>/Engine/Source/Runtime/Net/Core/Public/Net/Core/PushModel/PushModel.h:333
Scope (from outer to inner):
file
namespace UEPushModelPrivate
Source code excerpt:
};
extern NETCORE_API bool bIsPushModelEnabled;
extern NETCORE_API bool bMakeBpPropertiesPushModel;
/** @return Whether or not PushModel is currently enabled. See "net.IsPushModelEnabled." */
static const bool IsPushModelEnabled()
{
return bIsPushModelEnabled;
}
/** @return Whether or not Blueprint Properties will use Push Model. See "net.MakeBpPropertiesPushModel." */
static const bool MakeBpPropertiesPushModel()
{
return bMakeBpPropertiesPushModel;