Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple controllers and cross-platform issue #23

Closed
oservieres opened this issue Oct 25, 2016 · 2 comments
Closed

Multiple controllers and cross-platform issue #23

oservieres opened this issue Oct 25, 2016 · 2 comments

Comments

@oservieres
Copy link

This is a non-critical question. Mostly for curiosity.

This is my configuration :

image

My final purpose : make the game work with 4 controllers on Windows, Linux and Mac. Right now, the game works fine on Windows. It may also work correctly on other platforms with only one controller : the one defined in the Input Adapter. But I guess that the 3 other controllers are not gonna work.

At first I thought that I could use 4 input Adapters, each one assigned to a specific player, but it's a singleton.

So I'm quite stuck here.

@daemon3000
Copy link
Owner

My advice is to not use the Input Adapter at all, it's obsolete. Initially it was meant to solve the following issues:

  1. Abstract away the fact that the XBox 360 controller has different buttons codes on each OS.
  2. Allow you use use the DPAD and triggers as buttons instead of axes.

For point 1 it's much better to have a menu in your game where each player can rebind their buttons. Configure the game for the Windows XBox 360 drivers and let users on Mac and Linux rebind the buttons and axes. The added bonus with this solution is that the player can use any gamepad they want not just the XBox 360 one.

For point 2 you now have the Analog Button axis type which can convert any stick/trigger to button input.

If you don't want to allow the players to rebind the buttons you can also do it this way:

  • Make three XBox 360 configurations, one for each OS, and set them up to receive input from Joystick 1 for player One.
  • Write a script that runs at the start of the game and does the following:
    • For each of the other three players, clone player One's configurations and change the axis properties so it receives input from Joystick 2, Joystick 3 and Joystick 4. Look at the CloneControllerConfiguration.cs script to get an idea on how to do it.
    • Check what platform you run on and assign the corresponding configuration to each player.

@oservieres
Copy link
Author

Thank you very much for all these information ! I had the same kind of idea than you : declaring all the configurations possible for each player/platform and assigning the appropriate ones to the input manager based on the current platform.
But I didn't know that I could clone configuration. That may save a lot of time !

Thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants