narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
939 stars 70 forks source link

Pizza Syndicate - vsync not working #223

Closed ghost closed 10 months ago

ghost commented 1 year ago

Pizza Syndicate (aka Fast Food Tycoon) doesn't support Vsync. I enabled it in-game via SHIFT+11 menu, and even exported to a file. I check in-game framerate via RTSS (RivaTunerStatisticsServer).

btw. Any plans to introduce built-in framerate display for DDrawCompat?

narzoul commented 1 year ago

It seems to be working to me. If you crank up the Interval parameter of the VSync setting to 16, then you should see significant stuttering, e.g. when moving the mouse cursor over the main menu icons. That said, the game already has VSync on by default (with Interval=1 setting) so there should be no need to force it. What are you trying to accomplish?

That said, the game uses a mix of page flipping and direct screen updates via blitting to/locking the primary surface. These are not directly controlled by VSync, so you can still see higher frame rates because of it.

I couldn't get the RTSS overlay working, so I don't know what kind of numbers it's showing. I know some third party apps sometimes show wrong FPS numbers, e.g. Fraps often shows twice the actual value.

btw. Any plans to introduce built-in framerate display for DDrawCompat?

Yes, a built-in stats overlay will be added in the next release.

ghost commented 1 year ago
  1. In order to get RTSS overlay working with Pizza Syndicate you have to change "Application detection level" in RTSS to "Medium". In-game I can see two separate overlays, one for the external and and one for the internal window of the game. The overlays display different framerate values.
  2. As you wrote, changing Interval parameter of VSync causes the game to be completely unplayable. With RTSS you can enable async framerate limiter and set a number (like 60) which doesn't cause such issue.
  3. The game doesn't have built-in VSync of any kind. By default, RTSS displays for me over 100fps when framerate limiter is not enabled.
narzoul commented 1 year ago
  1. In order to get RTSS overlay working with Pizza Syndicate you have to change "Application detection level" in RTSS to "Medium". In-game I can see two separate overlays, one for the external and and one for the internal window of the game. The overlays display different framerate values.

I tried that. Also tried a bunch of other settings, nothing works so far using the latest version (7.3.4).

  1. As you wrote, changing Interval parameter of VSync causes the game to be completely unplayable. With RTSS you can enable async framerate limiter and set a number (like 60) which doesn't cause such issue.

A frame limiter is not the same as VSync. If you're looking for a frame limiter, use the FpsLimiter setting with "flipend(60)", for example.

  1. The game doesn't have built-in VSync of any kind. By default, RTSS displays for me over 100fps when framerate limiter is not enabled.

Yes, it does have VSync enabled by default. You can double check it from debug logs: 3d4c 11:17:31.694 > IDirectDrawSurfaceVtbl::Flip(&026F1650, null, 1) The last parameter of the Flip function is dwFlags, which controls VSync among other things. The relevant values here are:

#define DDFLIP_WAIT                          0x00000001L
#define DDFLIP_NOVSYNC                       0x00000008L

If DDFLIP_NOVSYNC is not explicitly specified, then VSync is enabled by default. Check e.g. the online docs for details: https://learn.microsoft.com/en-us/windows/win32/api/ddraw/nf-ddraw-idirectdrawsurface7-flip

The only way you would not have VSync enabled (with DDrawCompat) is if your drivers or some third party tool (RTSS?) hooks the Flip method after DDrawCompat does, and overrides the dwFlags parameter. But I'm pretty sure driver settings operate at a lower (driver) level, rather than by hooking runtime functions. So DDrawComapt should always enforce to wait for VSync before allowing the next Flip call to be processed, even if some lower level hook disables VSync for the actual presentation itself, which is a separate thing in DDrawCompat.

Getting an FPS value higher than 60 with VSync on is normal if your monitor's refresh rate is higher than 60. I can get up to 144 on a 144 Hz monitor. With flipend(60), I get a maximum of 60, as expected (measured with internal flip counter, not yet released).

ghost commented 1 year ago

I tried that. Also tried a bunch of other settings, nothing works so far using the latest version (7.3.4).

Make sure you have "Show On-Screen Display" enabled, "Custom Direct3D support" disabled and "On-Screen Display support" enabled.

Getting an FPS value higher than 60 with VSync on is normal if your monitor's refresh rate is higher than 60. I can get up to 144 on a 144 Hz monitor. With flipend(60), I get a maximum of 60, as expected (measured with internal flip counter, not yet released).

My monitor's refresh rate is 60 so I would expact the game to display 60fps. However, RTSS framerate counter says it's way over 60, with or without DDrawCompat. I did flipend(60) as you suggested, but didn't notice any difference. Lowering to 30 actually makes a difference.

narzoul commented 10 months ago

Check again with the Stats overlay in v0.5.0. Both VSync and FpsLimiter should be working.