Huge frame time deviation when playing 30fps games

Hey. I’ve had this happen to me since as far as I can remember but never found a solution. This happens with any 30fps game regardless of emulator, which leads to extreme ammounts of judder as I pan the camera. I get the same judder in emulators outside retroarch. My guess is that I’m getting terrible frame deviation on those emulators as well, although I don’t know how to check. I took this screenshot and noticed the frame time jump around between about 29ms to 43ms extremely fast.

I only found one solution and that was to set the Vsync Swap Interval to 2. Like the description says, it effectively halves the refresh rate to 30 and I could finally get a deviation of 0.8% and a stable 33ms frame time.

Is this normal behaviour or could there be something wrong with my system? This isn’t a retroarch specific problem but it’s the only program where I can find a workaround to playing 30fps games without judder - the vsync swap interval.

Using retroarch --verbose --menu, I got a result of 59.998800 Hz 3.007 % frame time deviation which already looks excessive.

I’ve used DDU to uninstall the drivers and reinstall them. Settings are all default. I have an Nvidia 970, running Windows 10 1803. Any help would be greatly appreciated.

Is it only with Dreamcast games? I have the same issue with the dreamcast cores in RA so it’s probably not your system that’s the issue. The games run fine in Demul though.

No, no. Like I said, it happens regardless of emulator. Should have pointed out it happens regardless of system too. Have the same issue playing Monster Hunter on PPSSPP - inside or outside retroarch.

Made a small recording showing the problem:

It’s clearly visable how smooth the game is if the swap interval is set to 2. As soon as I set it back to 1 the frame times go crazy and the judder starts.

Upon further testing with different emulators I noticed that the ones that run smoothly are the emulators that always report running at 60fps. Examples are Demul, PCSX2, Dolphin and BettlePSX. Regardless of the framerate of the game, the actual emulator seems to be running at 60fps. Citra, PPSSPP, Reicast (RA core or standalone) all have this same problem of judder and crazy frame times when running 30fps games. This makes me wonder if the problem is my system or these emulators simply have bad framepacing, vsync or framelimiter.

Things like dynamic rate control were designed with 60Hz and higher in mind, yes, so content that falls below your monitor’s refresh rate could be problematic in that regard. The entire point is to have as low a fluctuation between the refresh rate of your screen device and that of the game.

A couple of hints here:

  • Go to Video Settings, go to ‘Estimated Screen Framerate’, and press either Start button on your gamepad or the Spacebar to reset the A/V counter to zero. If any frame time deviations started building up, they will be reset by doing this. So if you suffered from very high frame time deviation, doing this can reset it back to 0.
  • You might want to try messing around with 30Hz resolutions for 30Hz content, or trying swap interval set to 2 for 60Hz and higher resolutions. For 120Hz resolutions and up, Black Frame Insertion is also an option. You could see if that works better.
  • If you have FreeSync/G-Sync, you might be able to use the ‘Sync To Exact Content Framerate’ option (Settings -> Frame Throttle). This might give better results.Tatsuya79 in particular reported very good results with this.

Anyway, long story short, there are a couple of options available to you that can be used at your disposal in RetroArch. But I agree that things should become a lot more easy to use from this perspective, maybe some kind of ‘automagic’ mode. But again, it’s probably difficult to read the minds of the advanced user in terms of what should be enabled and configured for which specific core/system.

BTW - another thing - a big impetus behind the reason why nearly all of RetroArch’s user-facing actions have to be asynchronous/threadable in the future, is because every action in RetroArch can affect the A/V counter. So that means if a shader is being loaded, right now there can be some slight effect on this adversely influencing the A/V counter, same with ROM file loading. So the best thing to do after doing an operation like ‘load a shader preset/shader’ or ‘load a ROM file’ is to go into Settings -> Video, go to Estimated Monitor Framerate, and reset the AV counter.

Anyway, so I agree that some things need to be redesigned here, and perhaps for now as a stop-gap, after a shader load or content being loaded, we should just force the AV counter to be reset beforehand so that we don’t start with frame time deviations out of the box with the user being unaware of what is going on. However, it is the long-term (and short-term) goal of this project to make it not necessary to have a hack like this, this is why content loading should be reimplemented as a task, same for shader loading.

Also, as for cores, a lot of the time, these frame time deviations can happen because the emulator simply isn’t doing a good job at real-time performance. I have the feeling that very little actual measurement is being done in a lot of these emulators to prevent frame time deviations like this, and often times we try to deal with it ourselves in some of the forked emulators that don’t need to stay in lockstep with upstream.

Things that could upset frame timings negatively:

  • Blocking file I/O in an emulator
  • Thread mutexes/locks that are not atomic
  • Any kind of operation that blocks
  • Threading in general happening inside a core

This is universal, so not only talking strictly from within the confines of a libretro core, but also standalone emulators. Even standalone games more or less often suck when it comes to frame limiters (Nier Automata and others come to mind, and Denuvo often ruins stable frame times as well when devs implement it in a lazy way), hence the likes of Special K that often reimplement the frame limiters in a game. It’s just that few standalone emulators and games try to make smooth performance a priority like this.

Wasn’t expecting such a thorough explanation. Thanks. At least I finally know why things happen the way they do. I surely hope more emulators get framerate right just like BeetlePSX. I’m testing Spyro right now and even though it’s a 30fps game, the experience is almost entirely judder free. I got a few miliseconds of judder but it’s very rare. I’m having a huge frame time deviation though but the framerate manages to be stable. Even after reseting AV it jumps straight to 30%

I have a 60Hz regular monitor btw.

You usually need to wait 2048 frames before you can get a reliable frame time deviation reading. So you need to let the frame counter continue to count upwards until it reaches 2048 frames, then frame time deviation will continue to stabilize (or not, depending on what is going on with the frame pacing).