DefaultPlatformService

DefaultPlatformService

#Overview

name: DefaultPlatformService

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

It is referenced in 12 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DefaultPlatformService is to specify the default online subsystem to be used by the game. It is a crucial setting for the Unreal Engine’s online functionality, determining which online service provider will be used for various networking features.

This variable is primarily used by the Online Subsystem module, which is a core part of Unreal Engine’s networking infrastructure. It’s also referenced in other modules such as OnlineSubsystemEOS (Epic Online Services) and the Engine module.

The value of DefaultPlatformService is typically set in the DefaultEngine.ini configuration file under the [OnlineSubsystem] section. It can be read using GConfig->GetString() function calls in various parts of the engine.

DefaultPlatformService interacts with other variables such as NativePlatformService, which specifies the online service associated with the native platform. It’s also used in conjunction with InstanceNames to manage different instances of online subsystems.

Developers should be aware that:

  1. Changing this variable affects the entire game’s online functionality.
  2. It should be set to a valid online subsystem module name (e.g., “Steam”, “EOS”, “NULL”).
  3. The specified subsystem must be properly set up and configured for the game to function correctly online.

Best practices when using this variable include:

  1. Ensure the chosen online subsystem is appropriate for your game’s needs and target platforms.
  2. Test thoroughly when changing the default online subsystem, as it can have wide-ranging effects on the game’s networking features.
  3. Consider platform-specific requirements when setting this variable, as some platforms may require specific online subsystems.
  4. Use it in conjunction with the NativePlatformService setting for more fine-grained control over online functionality on different platforms.
  5. Be aware of its usage in your code, especially when dealing with online features, to ensure compatibility and proper functionality across different online subsystems.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:51, section: [LocalNotification]

Location: <Workspace>/Engine/Config/Android/BaseAndroidEngine.ini:2, section: [OnlineSubsystem]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:63, section: [LocalNotification]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:73, section: [OnlineSubsystem]

Location: <Workspace>/Projects/Lyra/Config/Android/Custom/EOS/AndroidEngine.ini:2, section: [OnlineSubsystem]

Location: <Workspace>/Projects/Lyra/Config/Custom/EOS/DefaultEngine.ini:2, section: [OnlineSubsystem]

Location: <Workspace>/Projects/Lyra/Config/Custom/Steam/DefaultEngine.ini:2, section: [OnlineSubsystem]

Location: <Workspace>/Projects/Lyra/Config/Custom/SteamEOS/DefaultEngine.ini:2, section: [OnlineSubsystem]

Location: <Workspace>/Projects/Lyra/Config/Windows/Custom/EOS/WindowsEngine.ini:2, section: [OnlineSubsystem]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Private/OnlineSubsystemModule.cpp:164

Scope (from outer to inner):

file
function     bool FOnlineSubsystemModule::TryLoadSubsystemAndSetDefault

Source code excerpt:

			{
				UE_LOG_ONLINE(Log, TEXT("TryLoadSubsystemAndSetDefault: Loaded subsystem for type [%s]"), *SubsystemNameString);
				DefaultPlatformService = SubsystemName;
				bLoaded = true;
			}
			else
			{
				//UE_LOG_ONLINE(Warning, TEXT("TryLoadSubsystemAndSetDefault: GetOnlineSubsystem([%s]) failed"), *SubsystemNameString);
			}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Private/OnlineSubsystemModule.cpp:188

Scope (from outer to inner):

file
function     void FOnlineSubsystemModule::LoadDefaultSubsystem

Source code excerpt:

{
	FString InterfaceString;
	GConfig->GetString(TEXT("OnlineSubsystem"), TEXT("DefaultPlatformService"), InterfaceString, GEngineIni);

	bool bHasLoadedModule = false;
	if (InterfaceString.Len() > 0)
	{
		bHasLoadedModule = TryLoadSubsystemAndSetDefault(FName(*InterfaceString));
	}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Private/OnlineSubsystemModule.cpp:211

Scope (from outer to inner):

file
function     void FOnlineSubsystemModule::ReloadDefaultSubsystem

Source code excerpt:

void FOnlineSubsystemModule::ReloadDefaultSubsystem()
{
	DestroyOnlineSubsystem(DefaultPlatformService);
	// Clear our InstanceNames cache so we can re-establish it in case the DefaultPlatformService
	InstanceNames.Empty();
	LoadDefaultSubsystem();
}

void FOnlineSubsystemModule::PreUnloadOnlineSubsystem()
{

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Private/OnlineSubsystemModule.cpp:293

Scope (from outer to inner):

file
function     FName FOnlineSubsystemModule::ParseOnlineSubsystemName

Source code excerpt:

	else
	{
		SubsystemName = DefaultPlatformService;
		InstanceName = FOnlineSubsystemImpl::DefaultInstanceName;

		if (!FullName.IsNone())
		{
			FString FullNameStr = FullName.ToString();

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Public/OnlineSubsystemModule.h:20

Scope (from outer to inner):

file
class        class FOnlineSubsystemModule : public IModuleInterface

Source code excerpt:

	 * Specified in DefaultEngine.ini 
	 *	[OnlineSubsystem] 
	 *	DefaultPlatformService 
	 */
	FName DefaultPlatformService;

	/**
	 * Name of the online service associated with the native platform
	 * Specified in Base<Platform>Engine.ini
	 *	[OnlineSubsystem]
	 *	NativePlatformService
	 */
	FName NativePlatformService;

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Public/OnlineSubsystemModule.h:110

Scope (from outer to inner):

file
class        class FOnlineSubsystemModule : public IModuleInterface
function     FOnlineSubsystemModule

Source code excerpt:


	FOnlineSubsystemModule() :
		DefaultPlatformService(NAME_None)
	{}
	virtual ~FOnlineSubsystemModule() {}

	/** 
	 * Main entry point for accessing an online subsystem by name
	 * Will load the appropriate module if the subsystem isn't currently loaded

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineSubsystemEOS.cpp:257

Scope (from outer to inner):

file
function     bool FOnlineSubsystemEOS::Init

Source code excerpt:

	// Determine if we are the default and if we're the platform OSS
	FString DefaultOSS;
	GConfig->GetString(TEXT("OnlineSubsystem"), TEXT("DefaultPlatformService"), DefaultOSS, GEngineIni);
	FString PlatformOSS;
	GConfig->GetString(TEXT("OnlineSubsystem"), TEXT("NativePlatformService"), PlatformOSS, GEngineIni);
	bIsDefaultOSS = DefaultOSS == TEXT("EOS");
	bIsPlatformOSS = PlatformOSS == TEXT("EOS");
	bWasLaunchedByEGS = FParse::Param(FCommandLine::Get(), TEXT("EpicPortal"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/GameInstance.h:610

Scope: file

Source code excerpt:

	 * This will be used as the value of the PlayerOnlinePlatformName parameter in
	 * the NMT_Login message when this client connects to a server.
	 * Normally this will be the same as the DefaultPlatformService config value,
	 * but games may override it if they need non-default behavior (for example,
	 * if they are using multiple online subsystems at the same time).
	 */
	ENGINE_API virtual FName GetOnlinePlatformName() const;

	/**
	 * Helper function for traveling to a session that has already been joined via the online platform
	 * Grabs the URL from the session info and travels
	 *
	 * @param ControllerId controller initiating the request
	 * @param InSessionName name of session to travel to
	 *
	 * @return true if able or attempting to travel, false otherwise

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Kismet/BlueprintPlatformLibrary.cpp:74

Scope (from outer to inner):

file
function     UBlueprintPlatformLibrary::UBlueprintPlatformLibrary

Source code excerpt:

	{
		FString ModuleName;
		GConfig->GetString(TEXT("LocalNotification"), TEXT("DefaultPlatformService"), ModuleName, GEngineIni);

		if (ModuleName.Len() > 0)
		{
			// load the module by name from the .ini
			if (ILocalNotificationModule* Module = FModuleManager::LoadModulePtr<ILocalNotificationModule>(*ModuleName))
			{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/OnlineEngineInterface.h:61

Scope (from outer to inner):

file
class        class UOnlineEngineInterface : public UObject

Source code excerpt:

	/** Destroy a given online subsystem */
	virtual void DestroyOnlineSubsystem(FName OnlineIdentifier) {}
	/** Returns the name of the default online subsystem, generally the DefaultPlatformService config value. */
	virtual FName GetDefaultOnlineSubsystemName() const { return NAME_None; }
	/** Returns whether the unique net id is compatible */
	UE_DEPRECATED(5.0, "Use IsCompatibleUniqueNetId with FUniqueNetIdWrapper")
	virtual bool IsCompatibleUniqueNetId(const FUniqueNetId& InUniqueNetId) const { return IsCompatibleUniqueNetId(FUniqueNetIdWrapper(InUniqueNetId)); }
	/** Returns whether the unique net id is compatible */
	virtual bool IsCompatibleUniqueNetId(const FUniqueNetIdWrapper& InUniqueNetId) const { return (InUniqueNetId.IsV1() && InUniqueNetId.GetType() == GetDefaultOnlineSubsystemName()); }

#Loc: <Workspace>/Engine/Source/Runtime/Launch/Private/IOS/LaunchIOS.cpp:438

Scope (from outer to inner):

file
function     void FAppEntry::Init

Source code excerpt:

		// Get the module name from the .ini file
		FString ModuleName;
		GConfig->GetString(TEXT("LocalNotification"), TEXT("DefaultPlatformService"), ModuleName, GEngineIni);

		if (ModuleName.Len() > 0)
		{			
			// load the module by name retrieved from the .ini
			ILocalNotificationModule* module = FModuleManager::LoadModulePtr<ILocalNotificationModule>(*ModuleName);

#Loc: <Workspace>/Engine/Source/Runtime/Online/BackgroundHTTP/Private/BackgroundHttpNotificationObject.cpp:32

Scope (from outer to inner):

file
function     FBackgroundHttpNotificationObject::FBackgroundHttpNotificationObject

Source code excerpt:

	{
		FString ModuleName;
		GConfig->GetString(TEXT("LocalNotification"), TEXT("DefaultPlatformService"), ModuleName, GEngineIni);

		if (ModuleName.Len() > 0)
		{
			// load the module by name from the .ini
			if (ILocalNotificationModule* Module = FModuleManager::LoadModulePtr<ILocalNotificationModule>(*ModuleName))
			{