playMaker

Author Topic: Jostick 2-3-4  (Read 2466 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Jostick 2-3-4
« on: May 07, 2015, 10:35:59 PM »
This is more of a unity thing than playmaker, but I will use playmaker to control them.

I have a 1 player game using keyboard and USB joystick.  Now I want to have 4 players, each with a USB joystick.  How does unity know which USB joystick is 1, 2, 3 and 4?  How do you define which is which?  Because windows has USB ports that are not numbered, then how do determine which is which?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Jostick 2-3-4
« Reply #1 on: May 08, 2015, 01:38:13 AM »
Hi,

 very tricky question. The solution is a proxy system that will bind a joystick to a particular player, this means tho special actions for your input source...

I worked on such a system for Incontrol ( the free version on github), but I removed it because it wasn't really ready for public use, and I need to update InControl support anyway ( since the paid version is now separated from the free version), so this could be a way to bring this back.

 The solution currently is the following:

In the Input manager, you create all the axis you need per joystick, "Vertical 1", Vertical 2", Vertical 3", Vertical 4".

 Once you have that ( it's a real pain, but necessary.. check incontrol input manager , it's already filled in, maybe you can use that as a base)

each player will be assigned a Joystick index, and they will request input by composing "Vertical_" with their joystick Id.

This solution will get you quite far, but has many potential flows. What if a joystick is unplugged for example, and so you'll have to cover these cases with a good and intuitive interface. Joystick assignment by the player himself will be tricky too without some heavy work on the interface to detect motion ( if you want auto assignment, etc etc).

If you are interested in the Incontrol version, I can bring that back, it has everything I said above, and basically, instead of querying for a joystick input, you query a player input, the binding of the player and joystick is done in the background by my system.

 Bye,

 Jean


wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Jostick 2-3-4
« Reply #2 on: May 08, 2015, 02:40:29 AM »
No, don't go through the trouble of doing that Jean.  Sounds complicated.


Now if I have keyboard input for 4 players, can unity pick up players 2-3-4 via USB port?  The players could just switch controllers then if player 4 wants to swap with player 2.   That's fine.  I have joystick 1 set up with keyboard and joystick.  It is as simple as setting up players 2-3-4 as well and then unity picks which joystick to assign them to?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Jostick 2-3-4
« Reply #3 on: May 09, 2015, 05:25:59 AM »
Hi,

 not sure I understand your question, but yes, if you create inputs for each joysticks and hardcode each player index with a joystick index, then it's all good, you only need to create them in the Input settings and you are good to go. you'll be left with detecting that indeed joysticks are plugged or not, which is another story :)

 Bye,

 Jean