The mythical GDExtension to decouple input from rendering

Godot Version

4.6.2

Question

I have heard repeatedly from multiple online sources that input in Godot could be decoupled from rendering with a GDExtension.

  1. Does this extension exist?
  2. Is there something built in to Godot that would do the same thing as this extension?

I just don’t want to spend hours looking this up or figuring out how to wrangle Google Search into displaying what I want to know.

What do you mean by “decouple”? In what way is rendering coupled with input in Godot and what purpose would this “decoupling” serve?

In particular, that second one mentions that timestamped input polling could be done in a GDExtension. It would be really nice for the game idea I have for either of these to happen.

Are you sure you need this?

I am planning to make a rhythm game, so it would be really nice to have, since it would mean that FPS != polling rate. However, I could also just keep the effects down, crank up the engine’s FPS, and tell the user about that piece of jank. I’m also planning to open source it, so chances are if the game gets popular enough someone might be pissed enough to make it for me.

Taking care of it now would be nice, but I can move forward without it.

You can have a lot of effects and still run at 60 or even 120 fps.

Doing it via an extension would likely require getting the input directly from the os or some low level library. I’m not aware of existence of such an extension though.

You can have a lot of effects and still run at 60 or even 120 fps.

Unfortunately, my goal is 250+ min FPS on a 780M, since that is what I would consider to be the bare minimum acceptable polling rate. The good news is I shouldn’t need that many FX to make it work, but I’d need to make a working prototype first.

Doing it via an extension would likely require getting the input directly from the os or some low level library. I’m not aware of existence of such an extension though.

I think Godot uses SDL to do input polling, so any solution would, in theory, be OS agnostic. The extension would literally be just spinning off another thread to get input from the OS at about 1000Hz, though the hard part would be communicating the inputs to the main thread.

Why? If they’re properly timestamped there’s no problem whatsoever. The real question is what’s the use of that granularity for the main rendering thread running at say 60 fps.

And super fast humans can’t react at 100hz with any sustained rhythm.

The average being much closer to 10hz

1 Like

It would be nice for a song going at, say, 337.5 bpm, since if someone is on beat there will be some significant jitter and input banding due to frame timings, but now that I think about it I think most people who would be playing at 60hz nowadays would probably also have 125hz keyboards, so maybe I’m overthinking this.

Maybe I’ll revisit this if it becomes a real issue. (It could be that Godot’s CPU reqs precludes graphics that are old enough to make separating input polling from rendering a good thing.)