bGameSupportsMultipleActiveControllers

bGameSupportsMultipleActiveControllers

#Overview

name: bGameSupportsMultipleActiveControllers

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 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bGameSupportsMultipleActiveControllers is to determine whether the game can handle multiple active game controllers simultaneously on iOS devices.

This setting variable is primarily used in the iOS-specific input handling system of Unreal Engine. It is part of the ApplicationCore module and is specifically utilized in the iOS input interface.

The value of this variable is set in the IOSRuntimeSettings class, which is part of the IOSRuntimeSettings module. It can be configured through the project settings in the Unreal Engine editor.

This variable interacts with other iOS-specific input handling variables and mechanisms, such as controller connection and disconnection events.

Developers must be aware that:

  1. This setting affects how the game responds to multiple connected controllers, including the Siri Remote on Apple TV.
  2. When set to false, the engine will only consider one controller as active at a time.
  3. It influences how controller connection and disconnection events are handled.

Best practices when using this variable include:

  1. Set it to true if your game is designed to support local multiplayer with multiple controllers.
  2. Consider the implications on your game’s input handling and UI when enabling or disabling this feature.
  3. Test thoroughly with multiple controllers connected to ensure proper functionality when enabled.
  4. Be aware of the potential impact on performance and complexity of input handling when supporting multiple controllers.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2988, section: [/Script/IOSRuntimeSettings.IOSRuntimeSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Apple/AppleControllerInterface.cpp:228

Scope: file

Source code excerpt:

        {
			// Player index of unset(-1) would indicate that it has become unset even though it is now trying to disconnect
			// This can occur on iOS when bGameSupportsMultipleActiveControllers is false
			UE_LOG(LogAppleController, Log, TEXT("Controller for playerIndex %d, controller Index %d removed"), UserController.PlayerIndex, ControllerIndex);
            
            IPlatformInputDeviceMapper& DeviceMapper = IPlatformInputDeviceMapper::Get();
            FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(UserController.PlayerIndex);
            FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
            DeviceMapper.RemapControllerIdToPlatformUserAndDevice(UserController.PlayerIndex, OUT UserId, OUT DeviceId);

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSInputInterface.cpp:100

Scope (from outer to inner):

file
function     FIOSInputInterface::FIOSInputInterface

Source code excerpt:

	: FAppleControllerInterface( InMessageHandler )
	, bAllowRemoteRotation(false)
	, bGameSupportsMultipleActiveControllers(false)
    , LastHapticValue(0.0f)
    , MouseDeltaX(0)
    , MouseDeltaY(0)
    , ScrollDeltaY(0)
    , bHaveMouse(false)
{

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSInputInterface.cpp:116

Scope (from outer to inner):

file
function     FIOSInputInterface::FIOSInputInterface

Source code excerpt:

    GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bDisableMotionData"), bPauseMotion, GEngineIni);
    
    GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bGameSupportsMultipleActiveControllers"), bGameSupportsMultipleActiveControllers, GEngineIni);
    GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bAllowRemoteRotation"), bAllowRemoteRotation, GEngineIni);
    GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bAllowControllers"), bAllowControllers, GEngineIni);
    GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bControllersBlockDeviceFeedback"), bControllersBlockDeviceFeedback, GEngineIni);
    
    
    NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter];

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSInputInterface.cpp:155

Scope (from outer to inner):

file
function     FIOSInputInterface::FIOSInputInterface

Source code excerpt:

        HandleKeyboardConnection( GCKeyboard.coalescedKeyboard );
    }
    if (!bGameSupportsMultipleActiveControllers)
    {
        [notificationCenter addObserverForName:GCControllerDidBecomeCurrentNotification object:nil queue:currentQueue usingBlock:^(NSNotification* Notification)
         {
            SignalEvent(EAppleControllerEventType::BecomeCurrent, Notification.object);
        }];
    }

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Public/IOS/IOSInputInterface.h:139

Scope (from outer to inner):

file
class        class FIOSInputInterface : public FAppleControllerInterface, FSelfRegisteringExec

Source code excerpt:


	// can the game handle multiple gamepads at the same time (siri remote is a gamepad) ?
	bool bGameSupportsMultipleActiveControllers;

	// bluetooth connected controllers will block force feedback.
	bool bControllersBlockDeviceFeedback;
	
	/** Is motion paused or not? */
	bool bPauseMotion;

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:344

Scope (from outer to inner):

file
class        class UIOSRuntimeSettings : public UObject

Source code excerpt:

    // If checked, the game will be able to handle multiple gamepads at the same time (the Siri Remote is a gamepad)
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Input, meta = (DisplayName = "Multiple gamepads support"))
	bool bGameSupportsMultipleActiveControllers;

	// If checked, the Siri Remote can be rotated to landscape view
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Input, meta = (DisplayName = "Allow AppleTV Remote landscape mode"))
	bool bAllowRemoteRotation;
		
	// If checked, Bluetooth connected controllers will send input

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:52

Scope (from outer to inner):

file
function     UIOSRuntimeSettings::UIOSRuntimeSettings

Source code excerpt:

	AdditionalLinkerFlags = TEXT("");
	AdditionalShippingLinkerFlags = TEXT("");
    bGameSupportsMultipleActiveControllers = false;
	bAllowRemoteRotation = true;
	bDisableMotionData = false;
    bEnableRemoteNotificationsSupport = false;
    bEnableBackgroundFetch = false;
	bSupportsMetal = true;
	bSupportsMetalMRT = false;