Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fps drop after 20-30 mins of play #166

Open
skylight102 opened this issue Mar 26, 2022 · 28 comments · May be fixed by #177 or #188
Open

Fps drop after 20-30 mins of play #166

skylight102 opened this issue Mar 26, 2022 · 28 comments · May be fixed by #177 or #188

Comments

@skylight102
Copy link

skylight102 commented Mar 26, 2022

Hi, I’m using plugy and pd2 on season 4 with d2dx, and everything works great for the first 20 mins, and then the game seems to revert to 30 fps, and feels really jittery / choppy. I then restart the game and it works for 20 mins smooth as a whistle. I’m using windows 10 / and a 3080 card. I’ve tried all kinds of different configurations and it always ends with fps lag after 20 mins. It's like the background, effects, weather etc all continues running at 60fps, but the minions/AI and skill effects starts to run at 30fps. So I'm thinking this is something to do with predicted movements becoming out of sync. Is there anything else I could try? Is this a known problem with Pd2? Thanks so much, I’ll have to buy you a coffee.

@skylight102
Copy link
Author

skylight102 commented Mar 28, 2022

Anyone, Please? I'd donate to someone who can help me fix this, thank you.

@tomasz1986
Copy link

tomasz1986 commented Mar 28, 2022

The project hasn't seen any updates for ~9 months or so, so I doubt there will be any quick fix soon, but I can only say that I've personally experienced similar issues. I don't think it's bound to any specific time of play though. Sometimes, the game runs perfectly smoothly for hours. Other times, everything just starts to suddenly slow down as if the animations were taking place in slow motion. One thing to note is that the external FPS counter that I use still shows the game running at high FPS, even though in reality it doesn't feel smooth at all.

Unfortunately, the only solution I've found to this particular issue is to restart the game.

Edit: This issue is likely a duplicate of #141 and #146 though 😉.

@skylight102
Copy link
Author

skylight102 commented Mar 29, 2022

Doesn't look like they've received much activity and I wouldn't say this is subtle. On mine, you can really tell the difference all of sudden. The drop is 60 to 25 fps.

Is there some way to reload Diablo2/D2DX, without leaving a game?

@tomasz1986
Copy link

tomasz1986 commented Apr 3, 2022

Is there some way to reload Diablo2/D2DX, without leaving a game?

I've just experienced the problem today right after opening D2 from a minimised state after several hours. Unfortunately, I still don't think there is anything that can be done other than restarting the game. I've tried playing around with graphics settings, changing the resolution, etc., but nothing made any difference.

@skylight102
Copy link
Author

skylight102 commented Apr 3, 2022 via email

@whipowill
Copy link

This happens when the game loses focus, such as when you alt-tab away and come back. Exiting the game to menu will return FPS, but going back into a game it will drop again. The only way to fix it is to completely close and reopen the game. I don't have this problem on my Windows machine, but I do have it when running D2DX over Wine on my Linux machine.

@skylight102
Copy link
Author

Strangely i have this problem on windows : ( I love D2DX so much but sadly it is not the complete solution as described. There needs to be a way of resyncing diablo in-game, without having to relaunch it. Because sometimes I can be in a game for 2-3 hours...

@skylight102
Copy link
Author

Any saviour out there been able to figure out the cause to this? <3

@jaydee2k
Copy link

jaydee2k commented Jun 1, 2022

This is a motion prediction issue. After an unspecific time of playing motion prediction gets turned off for whatever reasons.
I played a lot of 1.09d lately and the issue there is a lot less severe. In 1.09d only the motion prediction for cast effects turns off after some time of playing everything else like movement is still smooth. Must be an issue in it's implementation which works better for 1.09d as for 1.13d as of now...

@Marcelo20XX
Copy link

Marcelo20XX commented Jul 23, 2022

As someone above told you, the problem is that the game loses focus after a period of time, I think it might be because there was a code on the original client that send, in reality spam a string, just to check if the game lost focus but the downside was that it made your CPU 0 to run as it maximum clock and consume like 35% of your total CPU power if you had a multicore threaded CPU...

Bolrog added a so called FPS fix but the side effect is this bug, I think reverting this code to its original state can fix the problem...

@skylight102
Copy link
Author

skylight102 commented Jul 23, 2022 via email

@Marcelo20XX
Copy link

Marcelo20XX commented Jul 24, 2022

I think I found a solution, I tested it doing a full playthrough from Act I to Baal and haven't found the FPS drops...

For this test I used a 1.09d Bowazon build on Nightmare Difficulty, constantly tested with Multishot since that skill is the easiest to see if the missile is animating smoothly, also I kept an eye for any AI, special effect or weather lagging and didn't found a single instance until ending the game after killing Baal...

Total time of the playthrough was about 5 hours so I gave the game plenty of time to display any wrong behavior and as expected it didn't happen. This test was made on Windows 10 using an Asus Nvidia 1660 GTX Super on the client 1.09d LoD and with PlugY 11.02 installed...

So I will attach the fix for anyone to test it too, there is a png which explains the change I did to the D2Client.dll too inside the zip...
D2 FPS hotfix 1.09d.zip

@skylight102
Copy link
Author

skylight102 commented Jul 24, 2022 via email

@Marcelo20XX
Copy link

Marcelo20XX commented Jul 24, 2022

Never mind, run a test again and this time I played until Act III, I was about 4 hours by then, let my char idle for another 3 hours and continued to Act IV, was killing some random Knights and the bug triggered again, the AI and missiles just turned off its movement prediction and were updating at 25 FPS, sigh!

One thing to note though, when I did the first test I never alt tabbed or minimized the game, I played at fullscreen, not even used the volume keys as they are known to cause desyncs in Windows 10 due to the volume overlay creates an additional window. On the second test I used the volume control so maybe that's why the test failed I don't know, its very difficult on my end to test this bug since it appears after quite a long time...

@skylight102
Copy link
Author

skylight102 commented Jul 24, 2022 via email

@tomasz1986
Copy link

tomasz1986 commented Aug 4, 2022

Just a quick tip for those, who experience the issue after having the game minimised for a long time. Once you decide to stop playing and minimise the game, you can suspend the game process, and then resume it later once you decide to play again. This way the game doesn't run in background when minimised, and as such, after resuming it still runs at the desired FPS for me.

There're multiple methods to do the whole suspend/resume operation, but the most basic is to use the built-in Resource Monitor. You can open it by typing resmon.exe in the Start Menu, then find Game.exe, right-click it and select "Suspend Process". There's also "Resume Process" in the very same menu, which you can use later to bring the game back to life.

@Marcelo20XX
Copy link

Sadly the issue for me appears even if I am actively playing the game, fastest character to trigger this bug seems to be the sorceress as she creates a bunch of missiles and effects I am able to reproduce this bug in about 15 mins of playing...

@tomasz1986
Copy link

tomasz1986 commented Aug 11, 2022

fastest character to trigger this bug seems to be the sorceress as she creates a bunch of missiles and effects I am able to reproduce this bug in about 15 mins of playing...

Another way to quickly reproduce it for me seems to go to Lut Gholein with summons (e.g. Necro or Druid) in a new game. I can immediately notice their movement being extremely choppy and jittery. However, the issue affects only the summons and not the main character, and it does seem to go away after some time once you go out of the city.

@Marcelo20XX
Copy link

Marcelo20XX commented Aug 11, 2022

On the contrary, if you want to have a stutter free experience, play as any 1.09d melee build i.e. Fendazon, Zealadin or WW Barb on Single Player...

That make me think that is the code that deals with the player driven pets or missile AI that is causing the bug, as I had my char pretty much idle on Frozen Tundra and let the imps fire their bolts at me for like 3 hours and never triggering the bug...

Did someone look at the code and could debug the dll to see why is reverting the Motion Prediction? normally I can attach Visual Studio debugger at a compiled exe but I don't know how to do that do a dll...

@Marcelo20XX
Copy link

Marcelo20XX commented Aug 13, 2022

This bug is driven me insane, it prevents D2DX to be the complete solution, can we organize a bounty to make it fixed? I am willing to pay money to the person who can came with a fix...

PD: I had Diablo 2 Resurrected but for some reason I prefer to play with the old graphics with PlugY and on the 1.09d patch...

@tomasz1986
Copy link

tomasz1986 commented Aug 21, 2022

The original commit that added motion prediction is 11cd4a6. I've tried to skim through it, but with my very rudimentary C skills, I couldn't see anything obvious. It seems quite complex though, so you'd likely need an actual C/C++ programmer who also knows a bit about the D2 code base to be able to work on this one…

PD: I had Diablo 2 Resurrected but for some reason I prefer to play with the old graphics with PlugY and on the 1.09d patch...

It would be great if D2 Resurrected had this kind of motion prediction in its "legacy mode" 🙂. As it is right now, it looks and plays awful when compared to D2DX. The "modern mode" in D2 Resurrected of course is great, but my PC is way too slow for it, so D2DX is all I play.

@skylight102
Copy link
Author

skylight102 commented Aug 21, 2022 via email

@Marcelo20XX
Copy link

I had some experience with both, C++ and the Diablo II code, I will see if I can do something but I will give it a try, if only I can attach the VS debugger to the dll like I can with a recompiled exe if would be faster to find why it deactivates. At this time I can only speculate that either somehow the entities list gets corrupted or some other thing like the sprite cache is making the MoP shutting off...

Still it would be ideal to reach and convince Bolrog or one of the other two collaborators to make a final fix for this bug, that's why I was willing to pay if they somehow made a commit that fixes the bug but I suspect money for them is not really important...

@Marcelo20XX
Copy link

Marcelo20XX commented Sep 23, 2022

Hi guys! I returned with some good news!!!
I have a conversation with the user Jarcho and he might have fixed this issue, currently it needs more testing before we can claim is fixed for good. I already ran a LoD 1.09d test on the entire Act V with my Sorceress without triggering the bug, as my comment above states, this class was previously triggering the bug on average after 15-20 mins played. So I will give you a link to his repository for you to try it: https://github.com/Jarcho/d2dx/releases

I am excited to know about your results, so post them here if it is fixed on your end too...

@Jarcho Jarcho linked a pull request Sep 24, 2022 that will close this issue
@skylight102
Copy link
Author

Great news, has anyone been able to get this to work for 1.13c? I'd really like to start playing again but can't seem to get it to work! Thanks : )

@Marcelo20XX
Copy link

It must be something on your end, I suggest you reinstall the game. I already tested Jarcho's fork and is running well on 1.13c, here is a compiled glide3x.dll plus SGD2FreeRes updated to version 3.0.2.5:
MoP_1.13c.zip

Just unzip it on the root dir of the game, its preconfigured to Widescreen and Motion Prediction ON

I strongly recommend you to update to the most recent version of SGD2FreeRes which is 3.0.2.6 though once you got this up and running...

@skylight102
Copy link
Author

skylight102 commented Sep 27, 2022 via email

@skylight102
Copy link
Author

Loving the fork by Jarcho! Legend!

I have been testing it on PD2, mostly great but I do find that there is some slight lagging when there are large groups of enemies, mainly when you get hit by melee, and when things die, the models seem to be a little jittery when they die. Has anyone else experienced this and possibly have a fix?

@Jarcho Jarcho linked a pull request Mar 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants