Project 1999

Project 1999 (/forums/index.php)
-   Technical Discussion (/forums/forumdisplay.php?f=40)
-   -   Mouse turning lag / frame skip issue SOLVED (/forums/showthread.php?t=407337)

Serendib 08-28-2022 10:36 PM

Mouse turning lag / frame skip issue SOLVED
 
This was driving me NUTS for so long. I recently have a problem where I would sometimes be mouse turning while running and the game would lag with a frame skip, sometimes very slight, sometimes up to a half a second. I had no idea what was causing this.

Then I realized that I got a new mouse, and I remembered an ancient bug I once found when writing my own game engine:

The mouse polling rate was set too high.

As soon as I turned down my mouse polling rate from 1000 to 125, all my issues disappeared. Here is how to do it in the Razer Synapse settings menu:

https://i.imgur.com/itdaUjf.png

The reason for this happening is kind of technical, but here it is: Inside the main event processing game loop for some games (and it turns out, titanium) there's code like this:

Code:

Event e;
while (nextEvent(e))
{
  // do things with the event
}

The high polling rate of the mouse (if moved at the correct speed) causes this queue to fill up faster than it can be processed on the same frame. Meaning you manage to move your mouse at the unlucky speed it could actually cause this to loop forever while your mouse is still moving.

Anyways - that's the fix. If you notice your game skipping frames while you mouse turn, try turning down your mouse poll rate.

Noren 08-29-2022 02:58 AM

Thanks a lot, I'll try that on my logitech mouse !


All times are GMT -4. The time now is 08:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.