Is there any way to use two keyboards with same inputs in a local multiplayer game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Montasir Raihan

Hello everyone. I’m trying to make a local multiplayer game using Godot 3.4.2 stable. I have two characters and they will try to kill each other. The characters will be controlled by two players using two different keyboards but they will use the same inputs.

For example, suppose, A and B are the characters of my game. When Player 1 presses W, only A will move forward. Similarly, when Player 2 presses W, only B will move forward. I’ve saw a discussion talking about the same issue, but I didn’t quite catch the answer. Here’s the link.

https://forum.godotengine.org/78584/how-to-implement-local-multiplayer

Does anyone know how to do it? Is there any way to do it? Thank you in advance.

[N.B: I don’t have any gamepads, just two keyboards.]

:bust_in_silhouette: Reply From: jgodfrey

I don’t think this is possible - even at the OS level (for Windows anyway). While you can connect (and use) multiple keyboards at the same time in Windows, I don’t think there’s any way to differentiate between them. So, pressing “Z” on one keyboard (for example) would be the same as pressing “Z” on the other keyboard.

Also, looking at Godot’s input map, keyboard input doesn’t have a Device number, unlike some other input types. That’s used to differentiate the input of multiple, similar input devices (like 2 game controllers for example).