Split screen player devices !?


this is my first post in the forums. I’m learning Godot for a couple of months now. I have a question about local multiplayer with 2 players and devices they use.

If i want to make so a player is able to switch using the keyboard and a gamepad in single play game modes, i have to add two events in each input action for the player. So the event for the gamepad will use Device0.

But what if he wants to play with a friend in the split screen mode, should they connect a second gamepad with another set of actions, set up to use Device1 ?

Isn’t there a way the player 1 uses the keyboard and the player 2 the gamepad for split screen but being able to use any of the keyboard and the gamepad in the single play modes ?

As i understand this is impossible while if they only got 1 gamepad, it will be always bound to player 1 input actions !

1 Like

I have the same problem and have been searching for a solution. So far my solution is a rather cumbersome workaround. So if others here have a better option please tell.

Input are handled by two singletons “Input” and “InputEvent”.
The former has more methods that are relevant to a game where you will often need different behavior depending if you press/hold/release keys/buttons.
The latter is a more general class, and will have less methods aimed at serving inputs you actually need in a game.

The problem is now that Input does not come with a property of what device pressed it. Only “InputEvent” has the property .device.

The workaround is therefore to manually add all devices separately in your input mapping. like “controller1_jump = joypad_0, device 0”, “controller2_jump = joypad_0, device 1”, “keyboard_jump = spacebar”, etc.etc.

As I said, the workaround is quite annoying, but it is the best method I found so far.
My guess is that there must be a way to connect Input and InputEvent and carry over the property. But I am a noob too, so I have not been able to figure it out.