Skip to content

Add support for joypad echo events#117782

Open
Nintorch wants to merge 1 commit into
godotengine:masterfrom
Nintorch:i-hear-echoes
Open

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

Conversation

@Nintorch
Copy link
Copy Markdown
Member

@Nintorch Nintorch commented Mar 24, 2026

This PR adds the code in Input class to send joypad echo events for both buttons and axes.
This PR adds 5 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;
  • input_devices/joypads/joypad_echo_events/axis_echo_events/send: If true, the engine will send joypad echo events for axes movement after the user has moved the joypad axes for long enough, true by default (it has no effect if input_devices/joypads/joypad_echo_events/send is set to false);
  • input_devices/joypads/joypad_echo_events/axis_echo_events/deadzone: The deadzone that is used by the engine to determine if joypad axes echo events should be sent, 0.5 by default.

Echo events for joypad buttons:

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

Echo events for joypad axes:

2026-04-25.15-22-57.mp4

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. (EDIT: I think this approach is good enough, so it's now used in this PR!)

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
Copy link
Copy Markdown
Member

Calinou commented Apr 14, 2026

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
Copy link
Copy Markdown
Member Author

Nintorch commented Apr 14, 2026

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
This PR adds the code in `Input` class to send joypad echo events if they are enabled in the project settings.
@AdriaandeJongh AdriaandeJongh removed the request for review from a team May 1, 2026 08:59
Copy link
Copy Markdown
Member

@Calinou Calinou left a comment

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
Copy link
Copy Markdown
Member Author

Nintorch commented May 6, 2026

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 :(

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