elishacloud / Silent-Hill-2-Enhancements

A project designed to enhance Silent Hill 2 (SH2) graphics and audio for the PC. It also includes scripts to build or modify SH2 audio files (SFX, BGM and Dialog).
http://www.enhanced.townofsilenthill.com/SH2/
zlib License
573 stars 41 forks source link

Extreme Slowdown During Gameplay #670

Closed AnEternalEnigma closed 1 year ago

AnEternalEnigma commented 1 year ago

Game engine slows to a crawl after most recent updates. Using Windows 11 Pro updates as of November 9, 2022 and the latest Nvidia driver 526.47. The issue alleviates temporarily when I alt-tab and then return but initiates again. I have enclosed a video of the issue and a d3d8.log.

Video enclosed: https://www.youtube.com/watch?v=z8zxu9EJjUc

d3d8.log

Polymega commented 1 year ago

Thanks for sharing your log. One file I noticed immediately in the game's directory that maybe shouldn't be there is the dxgi.dll (and accompanied dxgi.log). So to start things off super-simple, if you remove these from the game's directory, does it fix the issue?

AnEternalEnigma commented 1 year ago

No, this did not fix the issue.

elishacloud commented 1 year ago

I noticed some unusual modules getting loaded into the game:

17980 19:44:30.715 |- C:\WINDOWS\SYSTEM32\directxdatabasehelper.dll
17980 19:44:30.714 |- C:\ProgramData\A-Volute\A-Volute.28054DF1F58B4\Modules\ScheduledModules\AudioDevProps2.dll
17980 19:44:30.714 |- C:\ProgramData\A-Volute\A-Volute.28054DF1F58B4\Modules\ScheduledModules\NahimicOSD.dll
17980 19:44:30.714 |- C:\ProgramData\A-Volute\A-Volute.28054DF1F58B4\Modules\ScheduledModules\ProductInfo.dll
17980 19:44:30.714 |- C:\ProgramData\A-Volute\A-Volute.SonicStudio3\Modules\ScheduledModules\AudioDevProps2.dll
17980 19:44:30.715 |- C:\ProgramData\A-Volute\A-Volute.SonicStudio3\Modules\ScheduledModules\ProductInfo.dll

Any of these could be causing the slowdown.

Also, it would be good to figure out what feature could be causing this. Can you try setting these options below and seeing if any of them help with the performance issue?

You can modify these options in the ini file if they exist, otherwise you can add them to the ini file, if they don't exist. You can set them all at first and then if they fix the performance issue then you can try each one, one-by-one to see which one or ones are causing the issue.

ScreenMode = 3
d3d8to9 = 0
EnableSoftShadows = 0
UseCustomModFolder = 0
HookDirect3D = 0
FixGPUAntiAliasing = 0
PauseScreenFix = 0
Polymega commented 1 year ago

I did a quick Google search and it looks like Sonic Studio/Sonic Radar can cause all sorts of issues with various PC games.

AnEternalEnigma commented 1 year ago

None of the options changes worked and made things worse. None of the splash screens loaded and all I saw was a blank black screen with the original SH2 mouse cursor (the bloody knife) on the screen. I started the game by hitting enter repeatedly and the game's performance was even slower. The menus were so laggy I just had to Alt+F4. Uninstalling Sonic Studio also had no effect.

Polymega commented 1 year ago

Do you have any special Nvidia filters being applied to the game? I noticed the dark/black levels are still crushed for you, and am wondering if there's an external program running filters/effects on the game that might be affecting performance?

AnEternalEnigma commented 1 year ago

I'm not really familiar with Nvidia filters, so I'm going to say no. I don't really mess with the Control Panel either.

elishacloud commented 1 year ago

Try disabled each of these options individually rather than all at once, such that only one of these are disabled at a time. I suspect that at least one of these options should make a difference.

ScreenMode = 3
d3d8to9 = 0
EnableSoftShadows = 0
UseCustomModFolder = 0
FixGPUAntiAliasing = 0
PauseScreenFix = 0
AnEternalEnigma commented 1 year ago

Having each one disabled at a time had no effect. Still slowdown.

Polymega commented 1 year ago

Elisha thinks he might know what is causing the issue and is taking a look. In the meantime, this won't help with the slowdown, but if you'd like to do some spring cleaning you can also remove these files from the game's directory:

d3d9.log
_README.txt
AnEternalEnigma commented 1 year ago

Do you think it would be beneficial to do a clean install of everything? I've had versions of the Enhanced Edition on my computer since February 2021.

elishacloud commented 1 year ago

You could try that. Also, can you try with a smaller resolution? Ideally you would try with the same resolution you were using when you removed d3d8.dll. This way we can test to see if at the same resolution it works the same with and without d3d8.dll.

AnEternalEnigma commented 1 year ago

Lowering to 1920x1080 did not work.

elishacloud commented 1 year ago

Ok, can you try with this ini file? Just replace your existing ini with this one.

d3d8.zip

AnEternalEnigma commented 1 year ago

It changed it to the regular PC version of the game

elishacloud commented 1 year ago

Yes. That just disables every feature of the Enhanced Edition. Can you try re-enabling these settings tab-by-tab using the SH2EEconfig.exe tool to see which tab's settings has the issue?

AnEternalEnigma commented 1 year ago

I am noticing that after the Konami and Team Silent splash screens, the game crashes to desktop when all of this tab is unchecked image

AnEternalEnigma commented 1 year ago

I re-enabled "Allow for high quality images" and the game worked again but the slowdown still happens

AnEternalEnigma commented 1 year ago

Also, when I have "Allow for high quality audio" unchecked, the .exe just launches a frozen black screen and I have to kill in task manager.

Polymega commented 1 year ago

I re-enabled "Allow for high quality images" and the game worked again but the slowdown still happens

The reason for this is that the high resolution textures (from the Image Enhancement Pack) are stored in the sh2e folder and, when this option is unchecked, the game still pulls these texture but can't handle them, since they're larger than the vanilla file sizes/dimensions.

Also, when I have "Allow for high quality audio" unchecked, the .exe just launches a frozen black screen and I have to kill in task manager.

The same is true for this and the high quality audio (from the Audio Enhancement Pack).


It changed it to the regular PC version of the game

When Elisha gave you that test d3d8.ini file it basically disabled everything in our project. When you tested this, did the game run at full speed, at least? If so, that can help confirm it's a particular setting in the project causing the issue.

AnEternalEnigma commented 1 year ago

Yeah, the default d3d8.ini did make everything run normally. I have a separate, unmodded version of Silent Hill 2 as well on my computer that I use for speedrunning and that also runs fine.

AnEternalEnigma commented 1 year ago

Don't know if this is relevant or not, but I've noticed that if I skip the cutscene in the mirror, the game runs fine. But when I leave the bathroom and it loads the next in-engine scene of James walking to the barrier outside, it slows down again.

Polymega commented 1 year ago

To maybe make things easier:

Temporarily rename the sh2e folder to anything else. This will prevent our project from pulling any of our modified files that would otherwise freeze/hang the game when center features aren't enabled (like you experienced/described right above).

Then, disable all the features on a per-tab basis, with testing/launching the game between disabling each tab, as Elisha suggested. Hopefully, when disabling everything on a tab, the game will eventually run correctly. This will then tell us if a particular feature on whatever the last tab you disabled is the culprit. From there, you can re-enable things on that tab, one-by-one, until you hone in on the specific offender.


Perhaps before doing any of that, if you play in windowed mode (Display > Display > Screen Mode) and make the resolution very small, does it run at 'full speed'?

AnEternalEnigma commented 1 year ago

I have tested windowed mode and it still slows down. I also experimented with taking my Windows 11 desktop scale back down to 100% since I am on a 4K monitor and it still slowed down.

AnEternalEnigma commented 1 year ago

Just took it down to 640x480 on windowed and still slowed down

Polymega commented 1 year ago

Thanks for testing that. Try disabling everything available on a per-tab basis found in the Configuration Tool if you haven't done a full sweep of that yet, please.

elishacloud commented 1 year ago

It seems like the issues may be on the "Display" or "Advanced" tabs. Can you try clicking the "Default" button to set all default settings and then disabling all settings on the "Display" and "Advanced" tabs?

AnEternalEnigma commented 1 year ago

I found the culprit. It's 100% the "custom streaming audio engine" setting. Works perfectly when it's unchecked.

Polymega commented 1 year ago

Can you re-enable that and temporarily remove these files from the game's directory, and see if it still fixes things?

dsoal-aldrv.dll
dsound.dll
AnEternalEnigma commented 1 year ago

It slowed down with the custom audio streaming engine enabled and those two files removed from the folder

Polymega commented 1 year ago

Thanks for testing that. I was curious if DSOAL was conflicting with the custom streaming audio engine. You can place those files back in; those files are for DSOAL which restores 3D audio for the game.

We'll take a look into this. In the meantime, you can click the "Default" button in the Configuration Tool to restore everything back then re-disable "Use custom streaming audio engine."

And just a heads-up: When this feature is disabled, it'll use the vanilla game's bugged audio engine. This will eventually make the game's background music start to skip infinitely until it stops playing altogether then most likely crash your game. When this feature is disabled, you'll need to run the game on a single core to mitigate the issue (found on the last tab).

If there's no rush to play the project, I'd recommend just keeping the default settings enabled until we can come up with a solution for you to test.

Polymega commented 1 year ago

Oh, and can you attach a newer copy of your d3d8.log file? You can have the "Use custom streaming audio engine" enabled or disabled for this log; we just need you to boot up the game then exit it to generate a new log file.

elishacloud commented 1 year ago

@AnEternalEnigma, can you try with this update? I am hoping this will fix the issue with the custom audio streaming engine.

Here is the testing build: d3d8.zip

AnEternalEnigma commented 1 year ago

Here is my newer copy of d3d8.log. Sorry, had to leave the house for some errands. d3d8.log

Will try the updated one now.

AnEternalEnigma commented 1 year ago

The newer d3d8 did not work. It put some weird RGB pattern over my screen and the slowdown still happened. image

Polymega commented 1 year ago

Do you have a piece of software called something like "Nahimic" on your computer? It looks like this might've been included/installed if you used a SteelSeries headset before? If so, can you make sure the software is closed and not running? If you quit the software, does it fix this problem?

AnEternalEnigma commented 1 year ago

I didn't have any software running, but I found three instances of it in Task Manager. I ended all three tasks. After, it looks better but still faulty. The slowdown also happens. This is still with the new d3d8 provided.

AnEternalEnigma commented 1 year ago

image

AnEternalEnigma commented 1 year ago

I am about to start streaming on Twitch so my troubleshooting will have to wait until tomorrow.

Polymega commented 1 year ago

Do you have a piece of software called something like "Nahimic" on your computer?

I didn't have any software running, but I found three instances of it in Task Manager.

That's interesting; I wonder what possibly installed Nahimic and is making it run. I suggested it as I found these modules, which are not typical (and related to audio), are still being ran when you launch the game:

C:\ProgramData\A-Volute\A-Volute.28054DF1F58B4\Modules\ScheduledModules\AudioDevProps2.dll
C:\ProgramData\A-Volute\A-Volute.28054DF1F58B4\Modules\ScheduledModules\NahimicOSD.dll
C:\ProgramData\A-Volute\A-Volute.28054DF1F58B4\Modules\ScheduledModules\ProductInfo.dll

It put some weird RGB pattern over my screen

That's a CRT shader we'll be introducing in the next project release. We still have a few kinks to iron out with it (the shader becomes messed up when resizing the game's resolution through the Options menu). I'm not sure how it became enabled, but you can set CRTShader = 0 in the d3d8.ini file for the time being to disable it.

Polymega commented 1 year ago

When you run the game with our project, can you also open up Task Manager and show your CPU usage per core used? If you don't see the cores as separate graphs, right click in the area and select Change graph to > Logical processors.

image

We're wondering if some outside compatibility setting is forcing the game to run on a single core, bottlenecking things.

AnEternalEnigma commented 1 year ago

You may be on to something image

AnEternalEnigma commented 1 year ago

I have a program called Process Lasso that I use when I'm speedrunning SH2 on a separate .exe to force it to one core. But this program does not launch at startup and I only use it when I'm using my speedrunning (aka unmodified) install of SH2.

AnEternalEnigma commented 1 year ago

Well, that solves the problem. It was still somehow running in the background even without me opening the program. I spotted some tasks in Task Manager. I uninstalled the program and it now works without slowdown. I wonder why it started doing that? It didn't do that when I last played this and I've had Process Lasso on my computers since 2020 or so.

Polymega commented 1 year ago

There might have been a profile made in Process Lasso to detect any instance of "sh2pc.exe" running and force it to a single core. So to Process Lasso, it didn't matter what folder you launched the game from; so long as it saw "sh2pc.exe" it did its thing.

One way to get around this while still using Process Lasso is to rename the sh2pc.exe in your EE folder. That'd work, but we don't recommend doing it.

Polymega commented 1 year ago

Now the next thing I'd love to solve for you is the crushed levels:

001 002

Can you check two things for me?

Even though you don't use Nvidia filters, it might have accidentally gotten enabled for SH2. If you use Nvidia Freestyle, press Alt + Z and go to Game Filters. Do you have a filter profile set for SH2?

Another thing to check: Do you have custom filters for SH2 made through your OBS? Perhaps "Limited RGB Color" mode is set for SH2 in OBS? (Or maybe it isn't and needs to be?)

image

Polymega commented 1 year ago

I'll close this ticket as resolved. If you'd like to troubleshoot why the game has crushed blacks in the future, I'd be happy to try and further troubleshoot this with you.