Options for keyboard input timestamping

Godot Version

4.3

Question

I’m working on a rhythmgame and would appreciate to hear about options how to achieve keyboard event timestamps closest to the actual physical key press. The only option I learned so far is to increase FPS cap so that events are also processed faster. So, I wonder if this is the only way to go or if there are some alternatives?

Thanks

You can disable input accumulation through a script, this should fire _input events as soon as possible, rather than collecting data for the next frame.

func _ready() -> void:
    Input.use_accumulated_input = false

And of course keep your game trim to allow high framerates always helps

1 Like

Thanks for pointing out the input accumulation!

Meanwhile I did some searching and apparently it is possible to patch engine code so that event handler from OS delivers a timestamp (at least for Linux/X11 as described here). But even that timestamp might not be in sync with audio time…oh well, I’m tempted to cap fps to some ~200 and live with that.