Multiple Gamepads (DEF-1416) (SOLVED)

Happy (and surprised) to see that PS4 controllers are fully supported in OSX I tried plugging it into Defold to control my gamecharacter.
Seems like there are no built-in support for that controller ( but after a few tweaks I managed to get at least the analogue stick and the right side buttons to work).

So my questions are actually 2:

Can you please update the default.gamepads in builtins to include the wireless controller?

How do you connect several controllers of the same type and get input individually?? (creating this small one screen/4p multiplayer game).

5 Likes

I will add these to the backlogg. The first part is not complicated, but your second question will need design and take some time. Both need to be prioritised :smile:

3 Likes

Support for multiple gamepads is something that I’ve been waiting for a long time now :slight_smile:
Maybe a simple solution could be to send the controller index with the input data in the on_input function. That way you could deal with splitting the input in any way you want.

1 Like

So no multi-controller support? :frowning: This pretty much puts an end to a game idea I wanted to do and test Defold. Is the focus of the game engine mobile?

1 Like

Currently, yes. But we want it to be used on other platforms as well.

1 Like

+1 for multi gamepad support. We also wanted to make a local multiplayer game

2 Likes

Most of my games are local co-op or local competitive, and without multiple gamepad support, I simply can’t continue working on those games. I’m starting to lose hope here. Is there any chance that we will see this feature any time soon?

1 Like

Moved this to Feature Request. @Ingela_Garneij: I couldn’t see if/when this feature (DEF-1416) was planned for release. Do you know?

1 Like

Must admit I assumed this was supported - we really need this feature too.

1 Like

Ok, this is starting to become quite urgent. I’m considering other engines because of this lacking feature.

1 Like

I think the question around multiple controllers comes down to how we deal with the index/id of each. From the top of my head, I could see something like this.

  • There are a number of controller slots (4?)
  • A controller plugged in is assigned the first available slot
  • The controller keeps its slot until it is removed by the user, which makes its slot available again
  • The slot is communicated in the input action, e.g. action = {…, controller_id = 1}

Does this cover your use-cases? If not, what’s missing? Is there a need for added/removed controllers being reported somehow?

1 Like

This sounds perfectly fine for my current use cases. I think 4 is the standard number of slots for microsoft controllers. I would assume that the keyboard input would be passed with controller_id = 0 or similar?

Any more functionality, like supporting added/removed gamepads, I would consider luxury-features and would be necessary only in the final game, and that’s quite some time away :slight_smile:

1 Like

Cool, I was thinking the controller_id would be missing for devices where it makes no sense, like keyboard, mouse and touch screens.

2 Likes

I don’t know if controller_id would be needed for anything else but gamepads but I guess either have it in mouse/keyboard etc or not doesnt matter.
You will probably always store away the id as soon as it is retrieved for the first time.
Maybe need some kind of solution for “knowing” what Gamepad is connected.

I mean say you have 2 connected gamepads.
First time that player2 moves right with it’s gamepad, how do we know it’s the 2’nd player that will move on screen? Unless yes it is like Ragnar says that we can always tie up id:2 to the second gamepad.

1 Like

To answer my own question. Many games have some kind of “starting point” (before or in the game) where you click X button to enter the game and then it will be assigned to a certain player.

1 Like

Yeah, that’s a good point. Wouldn’t that be possible with the id-system though? Say that controller with id 2 is the one who presses “start game”, you assign id 2 to Player 1.

1 Like

As things look right now the plans are to have updated the default.gamepads to include the PS4 controller this month and support for multiple gamepads in April. We will keep you posted.

3 Likes

How’s progress going with the multiple gamepads feature?

I checked the Jira ticket and it’s been postponed due to more pressing issues. There’s a new tentative release date set, but I’ll let @Ingela_Garneij confirm it since she’s got a better overview of the coming releases.

Yes, we have postponed this to after summer (release date preliminary to september), since we need to improve our canvas and spine functionality. I will try to push the prio up some, but I can’t promise anything

1 Like