GRUPPO DI STEAM
More Than 4 Local Multiplayer 5pluslocal
GRUPPO DI STEAM
More Than 4 Local Multiplayer 5pluslocal
10
IN GIOCO
141
ONLINE
Creato:
27 gennaio 2016
Lingua
Inglese
Tutte le discussioni > Discussioni generali > Dettagli della discussione
 Questa discussione è stata messa in evidenza. Probabilmente è importante.
Instructions to developers to support more than 4 gamepads
Point developers to this thread to encourage them to add support for more than 4 gamepads or help them fix issues with the 4 player XInput limitation on Windows.

XInput limits number of controllers to 4 on Windows
XInput
* Max 4 controllers.
* Standardized controller layout.

Alternative controller APIs:
DirectInput
* Oldest and hard to use. Use an input framework so you don't have to deal with DirectInput directly.
* Any number of controllers.
* Controller layout not standardized.
* XBox360 and XBox One controllers don't have rumble and both triggers are on the same axis so you can't detect if both are pressed at the same time, this is because of the XBox controller driver implementation.

Raw Input
* Use an input framework so you don't have to deal with Raw Input directly, especially if you want to support a wide range of controllers.
* Any number of controllers.
* Controller layout not standardized.
* XBox360 and XBox One controllers don't have rumble and both triggers are on the same axis so you can't detect if both are pressed at the same time.

Windows.Gaming.Input
* Use an input framework if you want to support several underlying APIs in order to support non XBox controllers or other older Windows OS or more conveniently also support Mac/Linux.
* Used for the Universal Windows Platform (Windows 10, XboxOne, etc.)
* Supports more than 8 controllers on Windows 10.
* Standardized controller layout.
* XBox controllers have rumble and triggers on separate axes.
* Can control the extra 2 rumble motors on XBox One controllers.
* Not sure if only XBox Controllers are supported.

Input Frameworks:
Input frameworks are often used in order to support a wide range of controllers, add configurable controller layouts and support hot plugging.
They often support several input APIs but most by default don't support more than 4 XBox controllers. Why is that? Because there is no easy way for the frameworks to know which of the XBox controllers have been enumerated via XInput so they often just filter away all of XBox controllers so they aren't enumerated by the other APIs which would result in ghost controllers.
(Thanks to some innovation in SDL2 this will hopefully change so other input frameworks follow suit and be able to combine the underlying APIs in a better way.)

SDL2 old (version < 2.014 )
Before calling SDL_init add this line of code:
SDL_SetHint(SDL_HINT_XINPUT_ENABLED,"0");
(Alternatively set the environment variable: SDL_XINPUT_ENABLED=0)
In this mode all XBox controllers will be accessed via DirectInput. See limitations under DirectInput section.
In order for XInput devices to work in this mode you may need to update your gamecontrollerdb.txt file. Latest files can be found here: https://github.com/gabomdq/SDL_GameControllerDB

SDL2 version >= 2.0.14:
* Any number of controllers.
* More than 4 XBox controllers.
* XBox controllers have rumble and triggers on separate axes.
If it's not working make sure the hints SDL_HINT_JOYSTICK_RAWINPUT and SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT are set.

SteamInput API (not the same as the SteamInput feature)
* At least 16 controllers, possibly limitless?
* Up to 16 XBox controllers when the user has activated XBox Extended Feature Support in Steam.
* XBox controllers have rumble and triggers on separate axes.
* Dependency to the Steam Client? (Not sure if there is a standalone thing so the SteamInput can be used without Steam.)
* If this is the only or primary API for accessing the controllers make it so that SteamInput is enabled by default for your game.
The game needs to call the SteamInput API to access the controllers in order to make use of this.
If controllers are configured to use the SteamInput feature in Steam, but a game doesn't use the Steam Input API, the number of SteamInput configured controllers is capped to 4. This is because the SteamInput feature presents the controllers as emulated XBox controllers to the XInput API and filters out the controllers for other APIs to avoid ghosting.

ReWired (Unity plugin)
To make an informed choice read the "Windows Input Source" section in Rewired Editor Settings[guavaman.com] documentation.
Also read the sections above about SDL2 and the limitations of DirectInput/RawInput for XBox controllers above.

Option1: Make Re-wired use SDL2.

Option2: Make Re-wired use Windows.Gaming.Input. Works with more than 4 XBox gamepads but doesn't work with gamepads that aren't supported by Windows.Gaming.Input.

Option3: Use RawInput or DirectInput and disable XInput. It should also be possible to add a toggle in-game to disable XInput from within your game's settings.

According to the documentation there is a note about being able to disable XInput in the Input Manager. Also ReInput.ConfigHelper has a property called useXInput which should allow you to toggle XInput on or off. Looks like switching via this property can be done at runtime since rewired resets automatically when the property is set.
Ref: http://guavaman.com/projects/rewired/docs/api-reference/html/T_Rewired_ReInput_ConfigHelper.htm

(It's on my bucket list to test ReWired myself someday and maybe even create sample applications.)

InControl (Unity plugin)
Use the Native Input Module[www.gallantgames.com] and disable XInput

XNA Framework
If your game is really old and developed using XNA you can use:
Nuclex Framework[nuclexframework.codeplex.com] You can modify the source a bit to support any number of gamepads.

(Please correct any erroneous info in this description by replying to this thread.)
Ultima modifica da supersmo; 6 feb, ore 7:52
< >
Visualizzazione di 1-15 commenti su 19
good initiative! I'll keep tuned
Awesome idea! I really hope more devs could think about adding 4+ players support to their games, there are never enough multiplayer games for 8 players and that could be an incentive to buy the game!
Thanks :-)
Some of the instructions in there have already helped: Swordy, Colliders (should be fixed in next patch) and Dog Fight. Hopefully more devs will find this info usefull.
Ultima modifica da supersmo; 23 apr 2017, ore 13:34
I am using Rewired in Unity to make an asymmetric up to 6 player splitscreen with 1 VR player shooting game. Does Rewired automatically support the Steam Input API?
Haven’t used ReWired myself but it doesn’t look like it when I read the documentation.
I want to learn more about Steam Input API and how I can support it, any useful resources you know of?
Since Steam Input API is based on C++ and Unity uses C#, an API bridge is needed to reach Steam's API. An example of this API bridge is Facepunch.Steamworks: https://github.com/Facepunch/Facepunch.Steamworks
thanks for the link Sharingan! The more people research about this, the more we can help other developers to add 4+ multiplayer support for their games :)
Wow, I wish I knew about this thread before starting HopSquash!. Here's hoping I can update it. It uses Unity now, and they use XInput on Windows, but SDL on Linux and Mac, so actually Unity games support more Xbox gamepads on Linux and Mac than Windows! I think I can use external libraries for the Windows build to fix this. Definitely I'll build in support for more than 4 XBox gamepads in my future games.
Ultima modifica da Domarius; 12 gen 2021, ore 19:55
This was a bit dated so I've now updated it.
New info:
Steam Input API
Newer SDL2
I created my game using Rewired Input with SDL2, but I have the same issue as with Xinput regarding the triggers, which function as an axis. Does anyone have a solution to use more than 4 Xbox controllers with Rewired Input, ensuring proper support for all buttons ?
I don’t have Rewired but out of curiosity does it help to create these environment variables:
SDL_HINT_JOYSTICK_RAWINPUT=1
and SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT=1

And then start the game?

What version of SDL2 is bundled with Rewired?
Rewired Input is compatible with SDL2, but it does not provide a version. I added the .dll file from the latest version of SDL.

I don't know how create these environment variables, how to do that ?
< >
Visualizzazione di 1-15 commenti su 19
Per pagina: 1530 50

Tutte le discussioni > Discussioni generali > Dettagli della discussione