godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.08k stars 21.18k forks source link

Input problem using bluetooth keyboard #90621

Open GameNestStudios opened 7 months ago

GameNestStudios commented 7 months ago

Tested versions

System information

Issue description

Hello there. I´m having an issue with my inputs using a bluetooth keyboard. I have a character that basically moves forward whenever W is being pressed. I´m using the Input singleton with his is_action_pressed function to know if W is being pressed. It works normally but after 20 seconds the character stops to move.

After debugging what the problem was I noticed the event is_action_just_released() is being called by itself. After testing in my laptop´s keyboard I noticed the problem disappears. So I think there is an issue with my bluetooth keyboard.

I don´t know if the problem happens only on my keyboard or is a general problem with bluetooth keyboards.

My keyboard is a CHINAMATE CM-31 2.4GH WIRELESS (I know by the name sounds like a crappy one LOL, but still I think is a problem could be fixed).

Thanks in advance.

Steps to reproduce

Minimal reproduction project (MRP)

https://github.com/GameNestStudios/input_problem

The character in this project accepts moving in 8 directions and camera movement with the mouse. You just need to keep W key pressed to move forward, and after 20 seconds the player stops and "true" is logged to the console (in the input_controller script there is a print(event.is_action_released("move_forward")) line).

huwpascoe commented 7 months ago

Do you have IME language input enabled on your system?

Does the keyboard stop typing if you hold down the key while in notepad.exe?

GameNestStudios commented 7 months ago

Do you have IME language input enabled on your system?

Does the keyboard stop typing if you hold down the key while in notepad.exe?

After searching what IME is and checking I couldn't find a proper answer to your first question because I'm not sure what the answer is. I mean, I have 3 languages installed:

image

and all of them come with some kind of spellchecking and stuff.

With Notepad I get the same problem, I press down and hold a key and after 648 characters written it stops as well (always 648 characters).

Zireael07 commented 7 months ago

None of those languages use IME.

If you have the problem in a completely different app like Notepad, it's likely some driver limitation of your keyboard

huwpascoe commented 7 months ago

I mean, I have 3 languages installed and all of them come with some kind of spellchecking and stuff.

Basically IME or "Input Method Editor" means that as you're typing, a subwindow appears that allows you to type different languages with an US keyboard layout. This can cause problems in some programs, for example Audacity likes to freeze if IME is enabled. The GLFW library has problems with it https://github.com/glfw/glfw/issues/2176.

image

With Notepad I get the same problem, I press down and hold a key and after 648 characters written it stops as well (always 648 characters).

This is a good indicator that it's a hardware problem. I'll guess the keyboard is going to sleep because there's no keys changing state.

If you do the notepad.exe W test again but also tap backspace occasionally to keep it awake, if it keeps going past those 648 characters then that confirms it's a sleepy keyboard.

GameNestStudios commented 7 months ago

@Zireael07 @huwpascoe If the problem is about the keyboard driver or hardware then there is not much to do. Maybe there is a way of dynamically keep "awake" the keyboard by sending some kind of signal to the keyboard software (have no idea if such thing exists). Thank you anyways for the response in so short time.