bForceStableNullId

bForceStableNullId

#Overview

name: bForceStableNullId

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bForceStableNullId is to control whether a stable, consistent user ID should be generated for the Null Online Subsystem in Unreal Engine 5. This setting is primarily used for testing and development purposes within the online services framework.

The Unreal Engine subsystems that rely on this setting variable are the Online Subsystem Null and Online Services Null. These are part of the online services framework in Unreal Engine, which provides a consistent interface for online functionality across different platforms and services.

The value of this variable can be set in multiple ways:

  1. Through the engine configuration file (GEngineIni)
  2. Via command line parameter (-StableNullID)
  3. Programmatically during runtime

This variable interacts with other settings such as bAddUserNumToNullId, which determines whether to append a user number to the generated ID.

Developers must be aware that this variable is primarily used for testing and development purposes. It should not be relied upon for production environments where real online services are used. The stable ID generated when this flag is set to true is not guaranteed to be unique across different machines or play sessions.

Best practices when using this variable include:

  1. Use it only in development and testing scenarios
  2. Be consistent in its usage across your development team to ensure reproducible behavior
  3. Be aware of its impact on your online services testing, as it may mask issues related to dynamic ID generation
  4. Consider using it in conjunction with other Null Online Subsystem settings for comprehensive testing
  5. Document its usage clearly in your project to avoid confusion among team members

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2318, section: [OnlineSubsystemNull]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Online/OnlineServicesNull/Source/Private/Online/AuthNull.cpp:17

Scope (from outer to inner):

file
namespace    UE::Online

Source code excerpt:

{
	bool bAddUserNumToNullId = false;
	bool bForceStableNullId = false;
};

namespace Meta {

BEGIN_ONLINE_STRUCT_META(FAuthNullConfig)
	ONLINE_STRUCT_FIELD(FAuthNullConfig, bAddUserNumToNullId),
	ONLINE_STRUCT_FIELD(FAuthNullConfig, bForceStableNullId)
END_ONLINE_STRUCT_META()

/* Meta*/ }

namespace {

#Loc: <Workspace>/Engine/Plugins/Online/OnlineServicesNull/Source/Private/Online/AuthNull.cpp:45

Scope (from outer to inner):

file
namespace    UE::Online
namespace    anonymous
function     FString GenerateRandomUserId

Source code excerpt:

	}

	bool bUseStableNullId = Config.bForceStableNullId;
	FString UserSuffix;

	if (Config.bAddUserNumToNullId)
	{
		UserSuffix = FString::Printf(TEXT("-%d"), PlatformUserId.GetInternalId());
	}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineIdentityNull.cpp:55

Scope (from outer to inner):

file
function     FString FOnlineIdentityNull::GenerateRandomUserId

Source code excerpt:

	}

	bool bUseStableNullId = FOnlineSubsystemNull::bForceStableNullId;
	FString UserSuffix;

	if (FOnlineSubsystemNull::bAddUserNumToNullId)
	{
		UserSuffix = FString::Printf(TEXT("-%d"), LocalUserNum);
	}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineSubsystemNull.cpp:244

Scope: file

Source code excerpt:

	ECVF_Default | ECVF_Cheat);

bool FOnlineSubsystemNull::bForceStableNullId = false;
FAutoConsoleVariableRef CVarForceStableNullId(
	TEXT("OSSNull.ForceStableNullId"),
	FOnlineSubsystemNull::bForceStableNullId,
	TEXT("True if it should use a system-stable null Id for login, same as -StableNullID on command line"),
	ECVF_Default | ECVF_Cheat);

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineSubsystemNull.cpp:282

Scope (from outer to inner):

file
function     bool FOnlineSubsystemNull::Init

Source code excerpt:

			GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bRequireLoginCredentials"), bRequireLoginCredentials, GEngineIni);
			GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bAddUserNumToNullId"), bAddUserNumToNullId, GEngineIni);
			GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bForceStableNullId"), bForceStableNullId, GEngineIni);
			GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bForceOfflineMode"), bForceOfflineMode, GEngineIni);
			GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bOnlineRequiresSecondLogin"), bOnlineRequiresSecondLogin, GEngineIni);

			if (FParse::Param(FCommandLine::Get(), TEXT("StableNullID")))
			{
				bForceStableNullId = true;
			}
#endif
		}

		// Create the online async task thread
		OnlineAsyncTaskThreadRunnable = new FOnlineAsyncTaskManagerNull(this);

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Public/OnlineSubsystemNull.h:120

Scope (from outer to inner):

file
class        class FOnlineSubsystemNull : public FOnlineSubsystemImpl

Source code excerpt:


	/** True if it should use a system-stable null Id for login, same as -StableNullID on command line */
	static bool bForceStableNullId;

	/** True if it should fail faked network queries and act like an offline system */
	static bool bForceOfflineMode;

	/** True if the first login only counts as local login, a second is required for online access */
	static bool bOnlineRequiresSecondLogin;