Dropped inputs
Posted: October 9th, 2022, 4:11 pm
I did a playthrough of SDL-PoP a few days ago. It was my first playthrough of POP in over a year and there's one thing that keeps bugging me, which is that the game will sometimes drop input. It happens very rarely, but it's often enough that I find it a bit annoying. I can remember experiencing it during older playthroughs too, but I decided to try to understand the problem more this time.
First of all, it happens in DOS Prince of Persia as well (I tested it briefly in Dosbox and the dropped input behaved the same way).
It's rather easy to test: have the Prince stand still and briefly tap left/right to turn the character, and keep trying to turn this way. If your taps are quick enough, you should notice around a quarter of the key presses don't lead to the character turning. If you hold the key slightly longer, then the character will turn reliably with each key press. But quick taps will sometimes be ignored.
I think what's happening is that every 83.33ms (that's the interval between each game update at 12fps) the game checks if specific keys are pressed down in order for the prince to do actions, but if you manage to press a key and release it within that 83.33ms interval window then the keypress ends up being ignored.
I'm curious if this is something other people have noticed and been annoyed by, or if people have gotten used to how the game expects button presses (that is, lengthy key presses are always reliable). I haven't tested if the same problem exists when playing in gamepad/joystick mode. Either way, I'll see if I can find a good fix for this and implement it to the SDL-PoP codebase.
First of all, it happens in DOS Prince of Persia as well (I tested it briefly in Dosbox and the dropped input behaved the same way).
It's rather easy to test: have the Prince stand still and briefly tap left/right to turn the character, and keep trying to turn this way. If your taps are quick enough, you should notice around a quarter of the key presses don't lead to the character turning. If you hold the key slightly longer, then the character will turn reliably with each key press. But quick taps will sometimes be ignored.
I think what's happening is that every 83.33ms (that's the interval between each game update at 12fps) the game checks if specific keys are pressed down in order for the prince to do actions, but if you manage to press a key and release it within that 83.33ms interval window then the keypress ends up being ignored.
I'm curious if this is something other people have noticed and been annoyed by, or if people have gotten used to how the game expects button presses (that is, lengthy key presses are always reliable). I haven't tested if the same problem exists when playing in gamepad/joystick mode. Either way, I'll see if I can find a good fix for this and implement it to the SDL-PoP codebase.