Silent-Hill-2-Enhancements icon indicating copy to clipboard operation
Silent-Hill-2-Enhancements copied to clipboard

Side effects playing the game at 60 FPS

Open Polymega opened this issue 5 years ago • 81 comments

You can use this save folder to reference some of the framerate issues mentioned below. Go to <path-to-game>\data\save\ and make a backup of your Folder 01 folder within here. Then, completely replace your Folder 01 folder with this new one.


Important (noticeably affects audio, visuals, gameplay)

  • [x] The fog speed moves twice as fast (too fast).
  • [x] The water animates/moves twice as fast.
    • Water areas: RPT Apartment boss fight, lake water while rowing, and water throughout the Labyrinth/Alternate Hotel.
    • Load save file Data 57, Data 58, Data 59, Data 60 to test. There are many water spots throughout the Labyrinth and Alternate Hotel areas.
    • Solution found by Polymega. Implemented by mercury501.
  • [x] The physics of the bullet casings dropping from the handgun and shotgun become wrong. This causes the SFX of them hitting the ground to wig out. This affects the handgun and shotgun.
  • [x] The "Ritual" prison monster's footsteps go crazy fast.
  • [x] AudioClipDetection can crash the game when playing in 60 fps.
    • Solution found and implemented by Elisha.
  • [ ] The animation process whenever James transcribes notes onto his map is twice as fast (too fast).
    • Map transcription areas: Motorhome, BAR Neely's, Town West (at broken bridge), and Hospital Director's Room.
    • Load save file Data 62, Data 63, Data 64, Data 65 to test.
  • [x] The intensity/effectiveness of the motion blur is reduced by half.
    • Load save file Data 66, Data 67 to test. These are just two motion blur example spots.
    • Solution found by Aero_. Would need to be implemented.
  • [X] PS2CameraSpeed moves twice as fast (too fast).
    • Solution found and implemented by Aero_.
  • [x] The visual range of the Lying Figure's spray attack is twice as long. The spray can look like it's hitting James when it actually isn't.
  • [x] The visual range of the Hyper Spray's spray is twice as long. The spray can look like it's hitting enemies when it actually isn't.
  • [ ] Enemies that hold you in place for attacks do twice as much damage. This is due to damage being accrued per frame. This can make the final boss unbeatable in certain situations.
    • Enemies that hold you in place: Flesh Lips, Abstract Daddies, Final Boss (tentacle choke and moth attack [?]).
    • Load save file Data 1 to test Flesh Lips. Load save file Data 2 to test Abstract Daddies. Load save file Data 3 to test Final Boss.

Other

  • [x] The flashlight's light turns on and off twice as fast.
  • [x] The flashlight dies out twice as fast in the prison bug room.
  • [x] The low health indicator flashes twice as fast.
  • [x] The flames in Angela's staircase move twice as fast.
  • [ ] The water drains twice as fast at the end of the RPT Apartment boss fight.
    • Load save file Data 57 to test. Defeat Pyramid Head to make water drain.
  • [ ] The water rises twice as fast when the Alternate Hotel elevator door opens.
    • Load save file Data 4 to test. Go in the elevator and go to the Basement (B) Floor.

FMVs

  • [x] FMV playback is affected if FMVs are saved as 60 fps. We only want one version of the FMV Enhancement Pack to maintain, so if we make the FMVs 60 fps we need to ensure 60 fps FMVs can also playback correctly if the game is set to 30 fps, for those that want to play at its original framerate.
    • Here is a test FMV at 60 fps. Go to <path-to-game>\sh2e\movie\, make a backup of toilet.bik, then replace it with this test 60 fps version. You can easily test this FMV by starting a new game or by watching "James in the Restroom" through the game's "MOVIE" menu found on the title screen.
    • Solution found by Aero_. Would need to be implemented.

Edits: I removed the "noise filter animated twice as fast" from the list. From a film point of view, it makes sense to have the grain animate the same speed as the framerate, and at 60 fps its still noticeable in its animation.

Polymega avatar Aug 28 '18 01:08 Polymega

Honestly, this is going to require a lot of patching and research and I'm not sure I can fix everything either. If I were to attempt this I would need help.

PS2CameraSpeed doesn't work, as you already know, but gosh it'd be nice to have a functioning version for 60 FPS, as well. It's almost unbearable to go back to the PC version's vanilla camera speeds after being spoiled by this mod.

The bullet casing SFX wigs out, as you already know. This affects the handgun and shotgun.

The flashlight dies out very quickly in the prison bug room.

I've fixed these during my own private testing.

The "Ritual" prison monster's footsteps go crazy fast.

I know for a fact I can't fix this. I spent all day trying and found nothing. I thought maybe this was the only problem remaining, but with the other things you've listed I'm afraid I'm going to have trouble fixing those as well.

There's a framerate variable the game uses to determine the speed of many, many things, but apparently the ritual monster isn't one of them.

AeroWidescreen avatar Aug 28 '18 03:08 AeroWidescreen

Oh, for sure. I didn't mean to overwhelm you with this but wrote this all down for posterity for you or anyone else curious to know how 60 FPS affects things. TBH work on this ought to be lower on the list anyways.

Polymega avatar Aug 28 '18 03:08 Polymega

Do you know of a way to remove the shell casing sound effect? For me, it's the only offender when playing that 60 fps. I've tried editing the sddata.bin file myself and I found the shell casing sfx in question (It is sddata349.wav which not noted in the audio mapping so here you go). I tried deleting the file first before merging the rest into a new sddata file. But the sfx trigger for the shell casing was moved to the next available file, (sddata350.wav) which is a chainsaw sound effect. I tried deleting the contents of sddata349.wav while leaving the file to be merged but the problem still persists. Any idea what to do?

filipinowhiteboy avatar Aug 28 '18 17:08 filipinowhiteboy

Yes, if you delete the file all other sounds are moved over to fill the space. So sddata350 then becomes sddata349 in the game, sddata351 becomes sddata350, etc.

You simply need to create a silent .WAV file and save it out as sddata349.wav. Be sure you save it as a mono (not stereo) wave file. The length of the silent audio file shouldn't matter here.

Then, repeat the process of re-packaging the sound files to a new sddata.bin and you're good to go.

Polymega avatar Aug 28 '18 17:08 Polymega

I see. I thought deleting the content in sddata349.wav and saving it as a blank wav file would be enough though. Am I doing something wrong?

filipinowhiteboy avatar Aug 28 '18 17:08 filipinowhiteboy

I thought [...] saving it as a blank wav file would be enough though

Are you just renaming a blank .txt to .wav or something? That would be the problem why, then. You'll need an actual, legit silent audio .wav file for it to work.

You can open a short .wav file in Audacity, select the track image, click the "silence" button image, and save it out as sddata349.wav. Just be sure to save it as mono and not stereo.

Edit: Here's a roughly 1-second silent .wav file for you to use: sddata349.zip

Polymega avatar Aug 28 '18 17:08 Polymega

I thought [...] saving it as a blank wav file would be enough though

Oh, I think I understand now. You deleted the entire track of sddata349.wav and saved it out as-is? If so, there's no track for the game to play then, so it won't work. There needs to be a track for sddata349. So make it a second or two of silence. When you open the track in Audacity, you need to see some sort of track, if that makes sense.

Edit: Here's a roughly 1-second silent .wav file for you to use: sddata349.zip

Polymega avatar Aug 28 '18 17:08 Polymega

I see. Thank you for specifying....and for the instruction on how to create a silent wav file. ^_^

EDIT: Works like a charm! thanks for telling me what to do. Like I said, I find the shell casing sound effect to be the only problem. The other issues you described seem rather negligible. The game is quite playable at 60 fps after the sfx is removed

filipinowhiteboy avatar Aug 28 '18 18:08 filipinowhiteboy

This is to be expected due to my aging GeForce GTX 670 FTW

I have a GTX 1060 and expierience framedrops when playing with 60fps, also in SH3. I don't think it's really our hardware not able to keep up with a 15 years old PC game. :)

kartur avatar Aug 31 '18 20:08 kartur

True. :) I can't speak for SH3, but I know forcing SH2 PC to run on a single core doesn't take advantage of multi-core processing to help with performance. But we must run the game on a single core to alleviate the severe sound loop bug.

Polymega avatar Aug 31 '18 21:08 Polymega

I'm curious to see the fixes Aero has planned for us. 60 FPS is the only way to play :)

Keith94 avatar Aug 31 '18 21:08 Keith94

There's potential for some more really nice fixes down the line thanks to Aero, Elisha, Bigmanjapan, and others. :)

Polymega avatar Aug 31 '18 21:08 Polymega

Actually I think I have to revoke what I said earlier. Last time I tried playing with 60fps was one or two years ago, now (perhaps due to the opengl-wrapper?) it actually runs pretty smooth (tested for about 10min).

CPU-Load on Core 0 is always 100%, it doesn't matter if 30 or 60 FPS GPU-Load is 10-25%

desktop 2018 08 31 - 23 56 14 01 mp4_snapshot_00 41_ 2018 09 01_00 13 49 desktop 2018 08 31 - 23 56 14 01 mp4_snapshot_02 27_ 2018 09 01_00 14 18 desktop 2018 08 31 - 23 56 14 01 mp4_snapshot_04 16_ 2018 09 01_00 14 53

kartur avatar Aug 31 '18 22:08 kartur

I've been getting fairly consistent FPS myself. The streets are the only areas where the the fps....doesn't drop but hitch for a fraction of a second and it doesn't happen often.

filipinowhiteboy avatar Aug 31 '18 22:08 filipinowhiteboy

Can anyone link the edited sound file (replacing the bullet casing sound with silence) on here for easy access? I’d love to be able to play either 30 or 60 fps with as little trouble as possible.

OregonPacifist avatar Sep 01 '18 03:09 OregonPacifist

OregonPacifist, Polymega posted a link to the edited sddata file a few comments up. Just remember to back up your original sddata file before using it.

filipinowhiteboy avatar Sep 01 '18 12:09 filipinowhiteboy

@filipinowhiteboy thanks for the reply. I was looking for an already edited version of sddata.bin. The only file I saw that was posted is a silent sddata349.wav file.

OregonPacifist avatar Sep 01 '18 20:09 OregonPacifist

@OregonPacifist Oh! I see. Give me a second, I'll link mine.

EDIT: Here you go https://drive.google.com/drive/folders/10NfcCB73bsNDkchRLHAY8B7_myTcBIwd?usp=sharing

Now remember, You want to backup your old sddata file in case you change your mind and want to keep the sfx and play at 30fps. Also, the sddata file I sent you, must be placed in the sh2e/sound folder. This file will NOT work with the main sound from the data folder.

filipinowhiteboy avatar Sep 01 '18 21:09 filipinowhiteboy

@filipinowhiteboy Thanks for the link. I haven't used any audio editing software before and don't have enough time to learn it lol. I will be sure to save the two different versions of the file separately in case I want to play 30 or 60 FPS. You've just made my day!

OregonPacifist avatar Sep 01 '18 22:09 OregonPacifist

@OregonPacifist You're welcome. Let me know if there's a problem.

filipinowhiteboy avatar Sep 01 '18 22:09 filipinowhiteboy

Are all these issues still present in the latest release when playing at 60 fps?

DonelBueno avatar Nov 25 '20 05:11 DonelBueno

@DonelBueno Yes, it is. I think they might have updated the enhanced sound file recently. I might have to make a new version of the sdata file if they did.

filipinowhiteboy avatar Nov 25 '20 11:11 filipinowhiteboy

Besides any issues checked off, they are still present in the game, yes.

Polymega avatar Nov 25 '20 15:11 Polymega

I would like to have some sort of a starting point to improve and try to fix the various issues that is caused by high framerates, @AeroWidescreen would you be able give me some help with that? Also in need of save files to diagnose the various issues. As a sidenote, is there a way to boot the game with a breakpoint set on a specific instructions on startup?

illusion0001 avatar Oct 21 '21 13:10 illusion0001

Framerate Integer Add FPSLimit = 60 to d3d8.ini to enable 60fps.

// Default: 30(int)
0x4F6CA3 0x1E

Framerate Float

// Default: 30(float)
0x6388A8 0x41F00000

Frametime Float 1 / FPSLimit = Float

// Default: 0.03333333507(float)
0x6BC194 0x3D088889

Flashlight Speed Integer 2 * FPSLimit = Integer

// Default: 60(int)
0x50A5BD 0x003C

Fog Speed Assembly Code

0x489120 call FogSpeedCodeCave

FogSpeedCodeCave:
fld dword ptr ds : [0x932D48] // Variable Frametime Float
fdiv dword ptr ds : [ ] // Divide by 2(float)
ret

Bullet Shell Physics Assembly Code

0x4F0EAC call BulletShellPhysicsCodeCave
004F0EF5 call BulletShellPhysicsCodeCave
0x4F0F12 call BulletShellPhysicsCodeCave
0x4F0F23 call BulletShellPhysicsCodeCave


BulletShellPhysicsCodeCave:
fld dword ptr ds : [0x932D48] // Variable Frametime Float
fmul dword ptr ds : [ ] // Multiply by 2(float)
ret

It appears that most of the framerate problems can be attributed to this frametime variable:

sub_447830:
0x447830 fld dword ptr ds : [0x932D48]
0x447836 ret 

But changing it at this location just causes more problems. This is why I have separate code for the Bullet Shell and Fog Speed.

And the remaining issues might be constants that need adjusting, like the Flashlight Speed. This is all I know, this is all I have.

AeroWidescreen avatar Oct 21 '21 21:10 AeroWidescreen

Hi @illusion0001,

Thanks for taking an interest in this project and wanting to look into high framerate issues. Looks like Aero has you covered with all his research on the matter. Here's a link to general save points throughout the entire game:

http://www.igotaletter.com/temp/sh2pc/General_Saves.zip

Completely replace your <path-to-game>\data\save\Folder 01 with this Folder 01. If you need more specific/customized save files directly at the various high framerate issue spots, let me know and I can make some for you.

Any other questions please ask and we'll be happy to do our best to assist. Thanks again

Polymega avatar Oct 21 '21 22:10 Polymega

@AeroWidescreen sub_447830 has over 320 references, yikes. tried out some of the codes and they do work, any ways I could track other issues down or is it just testing if x2 or div2 of frametime and replacing existing subroutine calls the only way?

Since 2.0f ptr is missing, I used 0x52b6c9 instead.

Frametime_Division2
FLD  dword ptr [0x932D48]
FDIV dword ptr [0x52b6c9] //40000000 2.0f
RET

Frametime_Multiply2
FLD  dword ptr [0x932D48]
FMUL dword ptr [0x52b6c9] //40000000 2.0f
RET 

illusion0001 avatar Oct 22 '21 07:10 illusion0001

any ways I could track other issues down or is it just testing if x2 or div2 of frametime and replacing existing subroutine calls the only way?

That's the only way I know of. It's extremely tedious, which is why I haven't gotten really far with it. I was hoping someone more skilled would know a better way, but I guess it isn't that easy. ☹️

AeroWidescreen avatar Oct 24 '21 16:10 AeroWidescreen

Hey @Polymega, I tried to send you an email but I think you didn't see it, so I was thinking about something and I'd like to hear some input on it. I believe it's not very common to have framerate that varies depending on the "context" of the game but I was remembering how The Legend of Zelda Ocarina of Time runs at 30FPS on pause menus (item seleciton, map, equipment screen etc), 60FPS on the file select screen, and otherwise the game runs at 20FPS. Do you think something like that could work for SH2? As in, the framerate changes to 60 when you are in the memo list, map, inventory, full screen puzzles, save screen, etc.

SH4 does something a little odd which is that it runs at 30FPS, but when you enter the hole to move between the "dream dimension" and room 302 there's a very short cutscene of you "crawling" into/back out and it runs at 60 (at least I could swear it runs at 60 because it's a lot smoother than everything else and it's not ore-rendered either), and it really makes those transitions stand out.

Like, obviously it wouldn't make that big of a difference but I think it could be pretty kino as a stop-gap between having 30FPS only and having the option of playing on 60.

Btw, I really appreciate the work the team has put on SH2EE. Thank you for your hard work.

AwesumSource avatar May 02 '22 22:05 AwesumSource

Hi @AwesumSource,

I sent you a response the other week but it might have not gone through. I'll copy + paste my message here:


About 60 fps: The Xbox version of SH2 actually does this. It has 60 fps in the inventory screen (and I also think in the save/load screen), but is 30 fps everywhere else. I'm still holding out hope that we can properly fix most/all 60 fps issues so we can simply have high framerate throughout the entire game, but this has been a "compromise" that I have kept in my back pocket if it turns out we can't address most of the high framerate issues. To answer your question specifically: It's something I have planned to bring up if all other options fail for a 60 fps patch.

[...]

Thank you for reaching out to me and sharing your thoughts! I'm confident that a really good 60 fps solution will come at some point. It might not be soon, but it'll come in due time, I'm sure. :)

Polymega avatar May 03 '22 00:05 Polymega