shinyquagsire23 / OpenJKDF2

A cross-platform reimplementation of JKDF2 in C
Other
493 stars 39 forks source link

(Solved in v0.9.0)Poor framerate on higher resolutions/fullscreen(Also breaks console graphics) #253

Closed vincentizee closed 1 year ago

vincentizee commented 1 year ago

Been trying to get this to run well for days and sorry if this is not a very technical description.

When in windowed mode (starting resolution is something like 640x300 according to the debug window) I get ~140 fps, which is great but as soon as I go to fullscreen the fps goes to 45-55. The only way I can play this in fullscreen is to lower my screen resolution in windows to 800x600 so that the upscaling won't drastically affect the performance.

I'm on a gtx 1080 on Win10, this issue seems to be constant and nothing to do with my pc. Is there a way to force the amount of scaling performed so that I don't have to break my windows every time I want to try to play the game(albeit in potato resolution). Everything is vanilla settings except for 144 fps cap. 55fps 140fps

shinyquagsire23 commented 1 year ago

You can change the internal framebuffer resolution by modifying the SSAA multiplier (ie, 0.5 would render at half resolution), my SSAO impl isn't the greatest so I usually have to keep it around 0.7 at 4Kish if I have SSAO/bloom on.

40fps on a 1080 feels kinda off though, and the console graphics breaking is definitely a bug

vincentizee commented 1 year ago

Changing the multiplier does change the resolution for me but not the framerate. I tried all the way down to 0.1 multiplier and although it looks "great", I don't get any performance increase. It's like the size of the window automatically determines the performance for me. I can drag a windowed version of the game down and get more fps and I can drag it up to get less. jkdf2 01 ssaa This is with a 0.1 multiplier.

Biggs-Hoson commented 1 year ago

I've got the exact same problem on 2 PCs. ~70fps on a R7 5800H, RTX 3060 laptop ~90fps on a R9 5900X, GTX 960 desktop Scales with the window size, no settings seem to solve the performance issue. Interestingly, the performance seems to improve when going to the better CPU and worse GPU. Hope this helps.

rgstoian commented 1 year ago

Same problem here, game runs at around 40FPS regardless of graphics settings. CPU: Intel i5 6600k RAM: 24GB DDR4 GPU: GTX 1070 8GB Same weird window size/FPS behavior as @vincentizee

raleesound commented 1 year ago

I have this issue as well:

4k = 45 FPS (goes below 30 in certain areas) 1440p = 55 FPS 720p = 100 FPS

CPU: i7 6700k GPU: 980 Ti RAM: 32 GB

I know that my rig is older, but these numbers seem very low for a game this age, unless there is just some fundamental major overhead to the rendering process.

Havner commented 1 year ago

What's your SSAA multiplier? I have 4080 and anything above 2 kills the FPS drastically. Like several orders of magnitude more than it should. Even on 2.0 I barely have 60fps in 4K. That's the biggest fps killer I've found in OpenJKDF2.

raleesound commented 1 year ago

@Havner I have SSAA set at 1.0, so that is not the issue

shinyquagsire23 commented 1 year ago

the good news is that I noticed in testing yesterday that my Win11 Parallels VM has the same issue, which is ~interesting because Parallels passes through macOS OpenGL directly, and macOS hasn't had this issue. So I should at least be able to debug and A/B test things pretty easily.

I'm hoping I won't have to tie SSAA into Windows/SDL APIs because I was planning on adding a resolution selection box or something soon but idk, as it is it doesn't seem to function correctly on Windows

rgstoian commented 1 year ago

I don't think it's SSAA related, I'm getting the same performance in full-screen with it set to 0.5 or 1.0, also with HIDPI on or off on a 4k display.

shinyquagsire23 commented 1 year ago

This might be fixed in v0.9.0?

rktjmp commented 1 year ago

Fixed it on my Linux64-SDL build.

Biggs-Hoson commented 1 year ago

v0.9.0 solved this issue for me on both my PCs. The Ryzen 5800H, RTX 3060 laptop runs at >200 fps while the Ryzen 5900X GTX 960 system runs at > 400 fps, so they're probably CPU bottlenecked at this point. I would consider this issue solved.

One last note for posterity, The laptop was running Windows 11, the desktop was running windows 10, both were using a 3440 by 1440p monitor however smaller resolutions were tried too.

Thank for the fix.

raleesound commented 1 year ago

@shinyquagsire23 This looks like it was fixed with v0.9.0 for me. I have noticed that the SSAO and Bloom impact performance heavily when used in conjunction with SSAA, but I am now able to run it in 1440p locked at 144fps on my 6700k/980Ti rig. From there, I can either enable SSAO and bloom and maintain my FPS, or I can set SSAA to 2.0 without losing perf, but if I put the two together I get 36 FPS.

But I'm really just adding that last bit in case the data is helpful to you, I would definitely consider this issue resolved from my end. Awesome work on this project!

shinyquagsire23 commented 1 year ago

@raleesound yeah that's more or less the expected performance behavior, on my M1 MBP it's like 200+FPS with vanilla rendering, but with both SSAO/bloom on I have to set it to 0.7x res in order to keep 60+ FPS. My implementation definitely needs work but part of it is just legacy engine crust (all the camera transformations are still done on CPU for example)

The fact that resolution was significantly CPU limited is slightly concerning though and makes me think that maybe there's some extra FPS to be eeked out if I can find which function is causing issues. But at least all platforms are to the same point performance-wise now lol