afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
987 stars 68 forks source link

Mysterious performance hiccup every ~3 seconds #244

Closed afritz1 closed 1 year ago

afritz1 commented 1 year ago

Despite using the Visual Studio profiler, I haven't figured out why a visible hitch keeps happening in the game world and main menu. It happens fairly consistently too, for like 80ms regardless of the current frame rate. Not sure if this occurs on other platforms besides Windows 10.

I improved the Profiler class recently. It might be useful in Game::loop() or other places.

Maybe a beat frequency issue between monitor vsync and the game loop's update delta time? Maybe something with how SDL presents the current frame to the screen?

afritz1 commented 1 year ago

This was seemingly caused by a bug in SDL_PollEvent() with USB devices and joysticks. Upgrading to SDL 2.0.10 fixed it for me on Windows 10.