atsb / Doom64EX-Plus

An improved modern version of Doom64EX.
GNU General Public License v2.0
100 stars 16 forks source link

[BUG] Choppy frame rate, makes game unplayable #198

Closed owner-w closed 10 months ago

owner-w commented 1 year ago

I am getting a lot of frame skips, leading to a very choppy "low fps" experience. The stutter may seem tolerable at first but it is really hard to aim at monsters during intense battles, making it difficult to play. Video demonstration:

https://user-images.githubusercontent.com/132102644/235251848-4b07ec7d-744a-4ffc-95a0-580256c0f811.mp4

My resolution is 3840×2160@120hz.

Regular EX does not have this issue. See video of how it behaves there:

https://user-images.githubusercontent.com/132102644/235251931-4206baba-ac52-4f33-8f16-cf176597af2e.mp4

atsb commented 1 year ago

This is Windows or a Linux distro? Because I do get some frame skips on Linux and I’ve been attempting to track this down for months. It only happens on uncapped mode too.

atsb commented 1 year ago

I've narrowed it down to at least (what I think) is a combination of vsync and hardware. On one of my 'not so good' machines running Linux, it is dradful and very choppy. On Windows, I don't see it at all, it is very smooth and on my powerful Linux machine with a 12 core Xeon and RTX A2000 it very rarely skips a frame.

Try without vsync and see if it helps.

azamorapl commented 1 year ago

For what it's worth I had a similar issue, and I fixed it by disabling vsync in Nvidia Control Panel (the built in options did nothing).

bubbleguuum commented 11 months ago

EX+ has weird frame pacing issues depending on settings. On my 4K 60hz G-Sync monitor I had to do all of these to have no stutter (micro or not), no (massive) input lag and no tearing:

atsb commented 11 months ago

Yeah, I thought I fixed it but I got it on one of my machines. This is an issue I've been trying to figure out. The original EX was also plagued ever so slightly by the same thing but somewhere, frame pacing is being delayed by what seems like 1ms every few frames.

atsb commented 11 months ago

Ok, I have released RC2 https://github.com/atsb/Doom64EX-Plus/releases/download/3.6.5.8-rc1/doom64ex-plus-3.6.5.8-RC2-windows.zip

I tested this on a rather low-end compuer with an i3-1115G4 (UHD Graphics G4) machine. I had zero stutters and it was buttery smooth (Windows 11).

bubbleguuum commented 11 months ago

Thanks I did some test with that version, GTX 1080TI, 4K, fullscreen mode, in-game vsync off, no NVIDIA CP tweaks, no RTSS framerate cap.

All stutter seems to be indeed gone. But there is still some input lag (keyboard and mouse).

Using RTSS (Riva Tuner Server Statistics, part of MSI Afterburner) to cap framerate to 60 (my monitor's refresh rate) entirely fixes input lag, making input super responsive. RTSS with the framerate cap produces super stable frametimes which are exactly 1000/60 = 16.6667 ms. This can be seen with its framegraph display.

Also I'm not sure the in-game "vsync off" setting works properly as (without the RTSS framecap) I got no screen tearing at all as if it was vsync on.

atsb commented 11 months ago

Thanks for this, good news indeed. I'll clean up the latency and get the vsync working.

atsb commented 11 months ago

Ok, feels like I have removed latency on movement now and I placed the vsync toggle within the code that draws frames, so each frame it'll be set instead of when just the renderer was active.

I also fixed the Interpolation setting crashing when used a lot and fixed the audio (my little experimental hack didn't work). I re-uploaded a new RC2.

azamorapl commented 11 months ago

Tried with RC2, I still have the same stutter as before. I am using a 120hz monitor, though.

atsb commented 11 months ago

Yeah, I can’t test that at all. I might just cap the frame rate to 60 and no higher

bubbleguuum commented 11 months ago

Tried with RC2, I still have the same stutter as before. I am using a 120hz monitor, though.

With v-sync off in-game ?

atsb commented 11 months ago

I’ll do some experiments on my more powerful laptop later without any vsync implementation. Perhaps this could be causing some issues at higher refresh rates. The EX code is pretty weird in places and it maybe is interfering with the interpolation.

azamorapl commented 11 months ago

Tried with RC2, I still have the same stutter as before. I am using a 120hz monitor, though.

With v-sync off in-game ?

Yeah, it makes no difference (or maybe slightly better? I can't tell if it's a placebo). Still pretty much like the video in the OP. Everything is fine if I explicitly disable vsync for the game in nvidia control panel, though.

bubbleguuum commented 11 months ago

Tried with RC2, I still have the same stutter as before. I am using a 120hz monitor, though.

With v-sync off in-game ?

Yeah, it makes no difference. Plays pretty much like the video in the OP. Everything is fine if I explicitly disable vsync for the game in nvidia control panel, though.

Interesting, as in-game vsync off in RC2 really behaves as if it was on, according to my testing.

atsb commented 11 months ago

Ok, I got it. I tried on my Linux machine which has an RTX GPU and yeah I still got stuttering, unless vsync was off in NVidia control panel. I have removed VSync and Antialiasing from the code and now, I get a totally smooth frametime graph on Linux (and probably Windows too). I'll do a little more fine tuning and push the code

azamorapl commented 11 months ago

Tried the latest build but the stuttering is still there for me, probably due to the higher refresh rate?

atsb commented 11 months ago

Must be, I don’t get it at all on any of my systems

atsb commented 10 months ago

I'll look into getting it working with higher refresh rates, but since this is now fixed for the majority of users, I'll close it.

bubbleguuum commented 10 months ago

There is still framepacing issues and input lag in released v3.6.5.8. Tested on Windows 11, 60Hz 4K monitor with 4K resolution set in-game (using Windows scaling workaround), G-Sync disabled, no NVIDIA CP tweaks, first level on WMD difficulty.

And there is noticeable stutter, but only in fullscreen mode, as shown by these framegraph spikes (fullscreen, no frame cap):

fullscreen_noframecap

In windowed mode, there is no lag spikes (as long as v_windowborderless is not enabled (set to 1)) but there is still noticeable input lag (windowed, no framecap):

windowed_noframecap

To get rid of input lag and have perfect 16.666ms frametimes most of the time, I still have to cap framerate to 60 with RTSS and use windowed mode (windowed, frame cap):

windowed_framecap

So long story short: it works best in windowed mode with a 60Hz RTSS framecap. Forcing vsync in NVIDIA CP does nothing for me.

atsb commented 10 months ago

It must need to be capped to 60hz then internally, I’ll make sure to add this so the frame rate will have this internal cap. Not nice, but a solution. Thanks!