bUseSteamNetworking
bUseSteamNetworking
#Overview
name: bUseSteamNetworking
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bUseSteamNetworking is to control whether the Steam networking features should be used as the default socket subsystem in an Unreal Engine project that utilizes the Online Subsystem Steam plugin.
This setting variable is primarily relied upon by the Online Subsystem Steam plugin and the Steam Sockets plugin. It affects the networking functionality of the game when Steam is being used as the online subsystem.
The value of this variable is typically set in the project’s configuration file, specifically in the [OnlineSubsystemSteam] section of the engine.ini file. If not explicitly set, it defaults to true.
The bUseSteamNetworking variable interacts with other configuration settings, such as bAllowP2PPacketRelay, which controls whether P2P packet relay is allowed.
Developers must be aware that this variable significantly impacts the networking behavior of their game when using Steam. If set to false, the game will not use Steam’s networking features as the default socket subsystem, which could affect multiplayer functionality and performance.
Best practices when using this variable include:
- Explicitly setting it in the configuration file to ensure consistent behavior across different development environments.
- Testing the game thoroughly with both true and false settings to understand the implications on networking performance and functionality.
- Considering the target platform and audience when deciding whether to use Steam networking or not.
- Ensuring that the necessary Steam SDK is properly set up and initialized when using Steam networking.
- Being aware of potential platform-specific limitations or requirements when using Steam networking.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/Custom/Steam/DefaultEngine.ini:3, section: [OnlineSubsystem]
- INI Section:
OnlineSubsystem
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp:174
Scope (from outer to inner):
file
function void GetServerKeyValuePairsFromSessionInfo
Source code excerpt:
GConfig->GetBool(TEXT("OnlineSubsystemSteam"), TEXT("bAllowP2PPacketRelay"), bUseRelays, GEngineIni);
// If this config specifically does not exist, then set it to true
if (!GConfig->GetBool(TEXT("OnlineSubsystemSteam"), TEXT("bUseSteamNetworking"), bIsDefaultSubsystem, GEngineIni))
{
bIsDefaultSubsystem = true;
}
// Using Steam sockets. This checks if the SteamSockets plugin is enabled
if (!SteamSubsystem->IsUsingSteamNetworking())
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/SocketSubsystemSteam.cpp:662
Scope: file
Source code excerpt:
*
* If the project does not want to use SteamNetworking features, add
* bUseSteamNetworking=false to your OnlineSubsystemSteam configuration
*
* @return if SteamNetworking should be the default socketsubsystem.
*/
bool FSocketSubsystemSteam::ShouldOverrideDefaultSubsystem() const
{
bool bOverrideSetting;
if (GConfig && GConfig->GetBool(TEXT("OnlineSubsystemSteam"), TEXT("bUseSteamNetworking"), bOverrideSetting, GEngineIni))
{
return bOverrideSetting;
}
return true;
}
/**
* Chance for the socket subsystem to get some time
*
* @param DeltaTime time since last tick
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/SocketSubsystemSteam.h:218
Scope (from outer to inner):
file
class class FSocketSubsystemSteam : public ISocketSubsystem, public FTSTickerObjectBase, public FSelfRegisteringExec
Source code excerpt:
*
* If the project does not want to use SteamNetworking features, add
* bUseSteamNetworking=false to your OnlineSubsystemSteam configuration
*
* @return if SteamNetworking should be the default socketsubsystem.
*/
bool ShouldOverrideDefaultSubsystem() const;
/**
* Dumps the Steam P2P networking information for a given session state
*
* @param SessionInfo struct from Steam call to GetP2PSessionState
*/
void DumpSteamP2PSessionInfo(P2PSessionState_t& SessionInfo);
/**
* Dumps all connection information for each user connection over SteamNet.
*/
void DumpAllOpenSteamSessions();
#Loc: <Workspace>/Engine/Plugins/Runtime/Steam/SteamSockets/Source/SteamSockets/Private/SteamSocketsModule.cpp:31
Scope (from outer to inner):
file
function void FSteamSocketsModule::StartupModule
Source code excerpt:
if (GConfig)
{
GConfig->GetBool(TEXT("OnlineSubsystemSteam"), TEXT("bUseSteamNetworking"), bOverrideSocketSubsystem, GEngineIni);
}
// Create and register our singleton factory with the main online subsystem for easy access
FSteamSocketsSubsystem* SocketSubsystem = FSteamSocketsSubsystem::Create();
FString Error;
if (SocketSubsystem->Init(Error))