Skip to content

Add support for joypad button echo events - #117782

Open
Nintorch wants to merge 2 commits into
godotengine:masterfrom
Nintorch:i-hear-echoes
Open

Add support for joypad button echo events#117782
Nintorch wants to merge 2 commits into
godotengine:masterfrom
Nintorch:i-hear-echoes

Conversation

@Nintorch

@Nintorch Nintorch commented Mar 24, 2026

Copy link
Copy Markdown
Member

This PR adds the code in Input class to send joypad echo events for buttons
This PR adds 3 new project settings:

  • input_devices/joypads/joypad_echo_events/send: If true, the engine will send joypad echo events after the user has pressed the joypad buttons or moved the joypad axes for long enough, false by default for existing projects and true by default for newly created projects;
  • input_devices/joypads/joypad_echo_events/wait_time: The amount of time of pressing the joypad buttons or keeping the joypad axes over the deadzone required for the engine to start sending echo events, in seconds, 0.5 by default;
  • input_devices/joypads/joypad_echo_events/count_per_second: The number of times per second joypad echo events should be sent by the engine after the user has pressed the buttons or kept the axes over the deadzone for long enough, 20 by default;
2026-04-14.22-17-37.mp4

This PR also works with high numbers of echo events per second that are set via input_devices/joypads/joypad_echo_events/count_per_second. Here I set it to 1000, you can see that the counter increases by 1000 every second:

2026-04-14.22-18-08.mp4

TODO:

  • InputEventJoypadButton.is_echo() + ProjectSettings.input_devices/joypads/send_joypad_echo_events
  • ProjectSettings.input_devices/joypads/joypad_echo_events_wait_time
  • ProjectSettings.input_devices/joypads/joypad_echo_events_count_per_second
  • Run Input::_process() in the main/rendering step instead of the physics step
  • Try to add echo events for axes
  • Godot Docs PR ( Clarify the usage of controller echo events godot-docs#11950 )
  • Enable ProjectSettings.input_devices/joypads/send_joypad_echo_events by default for new projects?

@Nintorch Nintorch added this to the 4.x milestone Mar 24, 2026
@Nintorch
Nintorch force-pushed the i-hear-echoes branch 2 times, most recently from a866bc5 to afe75f5 Compare April 12, 2026 15:20
@Nintorch Nintorch changed the title Add support for joypad button echo events Add support for joypad echo events Apr 13, 2026
Comment thread core/input/input.h Outdated
Comment thread core/input/input.cpp Outdated
@Calinou

Calinou commented Apr 14, 2026

Copy link
Copy Markdown
Member

I'm currently not entirely sure how to add echo events for axes in a way that makes sense, but I was also thinking of creating another project setting that would be a deadzone for echo events. If the axis value is higher than the deadzone, the echo events will be sent.

I would just reuse the same deadzone as the regular action. If you hold an axis at a position where the input would be sent, it should also echo eventually.

@Nintorch

Nintorch commented Apr 14, 2026

Copy link
Copy Markdown
Member Author

I'm currently not entirely sure how to add echo events for axes in a way that makes sense, but I was also thinking of creating another project setting that would be a deadzone for echo events. If the axis value is higher than the deadzone, the echo events will be sent.

I would just reuse the same deadzone as the regular action. If you hold an axis at a position where the input would be sent, it should also echo eventually.

But the thing is, InputEvents don't depend on actions, it's the actions that depend on InputEvents, as far as I know. 😅
And different input actions can contain similar axis events, which will create some ambiguity (what action should we choose for the deadzone?).

Comment thread doc/classes/ProjectSettings.xml Outdated
Comment thread doc/classes/ProjectSettings.xml Outdated
Comment thread doc/classes/InputEventJoypadButton.xml Outdated
Comment thread doc/classes/InputEventJoypadButton.xml Outdated
Comment thread doc/classes/InputEventJoypadButton.xml Outdated
Comment thread doc/classes/InputEvent.xml Outdated
Comment thread doc/classes/InputEvent.xml Outdated
Comment thread doc/classes/InputEvent.xml Outdated
Comment thread editor/editor_node.cpp Outdated
@Nintorch
Nintorch marked this pull request as ready for review April 25, 2026 10:35
@Nintorch
Nintorch requested review from a team as code owners April 25, 2026 10:35
Comment thread doc/classes/ProjectSettings.xml Outdated
Comment thread doc/classes/ProjectSettings.xml Outdated
@Nintorch
Nintorch requested a review from a team April 28, 2026 10:14
@AdriaandeJongh
AdriaandeJongh removed the request for review from a team May 1, 2026 08:59

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it mostly works as expected.

Some feedback:

  • Echo events don't work for focus navigation, or Tree/ItemList navigation. I would expect echo events to be followed in both cases to match other games/engines.

    • In contrast, it works with keyboard-based navigation (try holding down Tab).
  • The repeat timer should ignore Engine.time_scale, as currently, using a higher time scale will speed up the rate at which echo events are sent (as well as reduce the initial delay before the first echo event). You can test this by using --time-scale 5 in the Main Run Args project setting.

@Nintorch

Nintorch commented May 6, 2026

Copy link
Copy Markdown
Member Author

Although now that I think about it, should we really have axis echo events? I mean, they have to share the same deadzone for all actions, otherwise we have to introduce a different type of echo events (most likely InputEventAction, and we will have to modify its documentation to say that it is sent by the engine in case of echo events). If neither approach is good enough, I'm not sure how we can make axis echo events :(

This PR adds the code in `Input` class to send joypad echo events if they are enabled in the project settings.
@Nintorch Nintorch changed the title Add support for joypad echo events Add support for joypad button echo events Jun 24, 2026
@Nintorch

Copy link
Copy Markdown
Member Author

I decided to remove joypad axis echo events for now, I think we need to discuss this part more since there are several approaches to do it.

Tested locally, it mostly works as expected.

Some feedback:

  • Echo events don't work for focus navigation, or Tree/ItemList navigation. I would expect echo events to be followed in both cases to match other games/engines.

    • In contrast, it works with keyboard-based navigation (try holding down Tab).

That's strange, because button echo events for just fine for me. Did you try to use the sticks for navigation? In that case, yes, they weren't supposed to work at the moment, and now they're removed, so I think it's hopefully not a problem for now. :D

2026-06-24.16-08-14.mp4
  • The repeat timer should ignore Engine.time_scale, as currently, using a higher time scale will speed up the rate at which echo events are sent (as well as reduce the initial delay before the first echo event). You can test this by using --time-scale 5 in the Main Run Args project setting.

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make gamepads send echo events for UI navigation purposes

3 participants