Input queues


I spent some days trying several techniques for making the input more responsive. The most important was input queuing, which basically involves letting the player press several keystrokes in rapid sequence without losing any of them (except in special cases, for example when the player loses).

In hindsight I can say it was very interesting: the more complicated I made the code, the less satisfactory was the outcome.

First, I made the naive thing: using a literal queue for storing the keystrokes and executing them in the order of appearance. This made the experience very unwieldy; for some reason, my brain seemed to forget the plan my fingers outlined, and the resulting movements were surprising.

I tried to accelerate the animations according to the length of the input queue, but that was much more strange, for some reason.

Long story short, the final code (which is not perfect, but works relatively well) was much simpler: basically, there is no queue (or if you will, there is a one-move queue). If the game detects a new keystroke in the middle of an animation, it simply speeds up the animations and does nothing more: when the sped-up animation ends, the game executes the new keystroke. (In the video above you can see a short demonstration of the feature.)

Moral of the story: always try the simpler code first. Of course, simpler ideas are harder to find sometimes...

Get Dis Pontibus 2

Buy Now$6.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.