nipkownix / re4_tweaks

Fixes and tweaks for the "UHD" port of Resident Evil 4
zlib License
339 stars 33 forks source link

Knife and Incendiary Grenade OP above 60fps #263

Open DarthxVoid opened 2 years ago

DarthxVoid commented 2 years ago

Describe the feature you'd like to see added

When you release the re4 fps and be able to play with 90, 120, 150.... fps, the Incendiary grenade, flash and knife will be very OP because their damage is per tick and the flash stun time is also per tick, so it would have to be fixed to make the game balanced

Mister-Curious commented 2 years ago

huh? my incendiary gren's damage is based on FPS? What is a tick? What is OP?

linkthehylian commented 2 years ago

Being able to go above 60 fps is only available in certain versions of re4_tweaks and hasn't been publicly released yet. Once it does though, I think that will be the time to look into it.

What is a tick? What is OP?

I think they meant, "per second" since the term "tick" is mainly used when referring to online games. Also "OP" is an acronym for "overpowered".

emoose commented 2 years ago

Tick is also used in offline games too, mostly known from source engine games, but pretty sure other engines use a similar thing too.

It's pretty much just how many times a second the game actually updates objects etc, similar to framerate but usually lower so less work needs to be done, eg. game might present at 120Hz but only actually update positions etc 30 times a second, so tickrate for that would be 30.

In RE4s case the tickrate seems to be tied to the framerate, not sure if it's updating at exactly the same as framerate or if it's 1/2 of framerate though (the 1/2 framerate stuff might just be used for a few weird things)

About the OP, I guess that probably means the damage is also being increased at 60FPS too? Think I did hear about that before too. Maybe worth looking into some time, haven't really looked into how game handles damage yet though (something to do with YARARE_INFO struct maybe, "to suffer damage; to be deceived", that might just be for damage applied to player though) If anyone can let me know where the weapon damage values are located in the EXE maybe I can trace where it's used from there.

DarthxVoid commented 2 years ago

yes the damage of certain weapons and grenades is linked to the game frame, at 30fps Mendez dies with 6 Incendiary grenades, the flash grenade lasts 1 minute and the ganados do not hit axes and arrows already at 60 fps it's 4 grenades to kill Mendez, the flash grenade lasts almost 2 minutes and so on, I don't know why it's linked to the frame

emoose commented 2 years ago

Seems GetWepDmVal is used to get damage amount for most weapons, except some other ones are handled differently, most EmXX classes contains a emXXSetDmVal which either calls the GetWep func or uses a hardcoded damage amount for certain weapons, that then returns the final damage amount to the emXXDmCk func which applies the damage via LifeDownSet.

My first guess would be to change LifeDownSet so that damage amount given is multiplied by deltaTime, at 60FPS this would halve the damage each tick, which should result in same damage between 30/60 (since 60FPS = double the number of ticks, halving damage amount per tick should make the total damage match up) If there's any weapons which only apply damage in a single tick this would pretty much halve its entire damage though, good chance there's probably some weapons like that here (especially if it's only certain weps that seem to have increased dmg...)

Probably better to figure out which weapons are most affected and then hook GetWepDmVal to do the deltaTime stuff (if the damage is definitely being affected by FPS, deltaTime should hopefully be able to fix it fine)

E: eh, checked the knife and seems to only do a single tick of damage, at least against the enemy I tested with, it's possible damage against objects / other enemies get handled differently though, or maybe the way I tested it wasn't ideal for triggering multiple hits or something.

LethalPlacebo commented 2 years ago

Hey guys, not sure if this helps but Japanese YouTube user wairokku has several videos documenting the differences/bugs between 30FPS and 60FPS on the Steam version of RE4. Here's one of them that shows the incendiary grenade difference that DarkxVoid mentioned:

https://www.youtube.com/watch?v=2Wiq5StTKwE

The other videos are very easy to find on the user's channel, they haven't uploaded much else. It's worth noting that some things listed in the videos, like the boat machine gun in the Separate Ways campaign, were actually addressed in official Capcom patches, but many were not, such as the incendiary grenade or falling item speeds.

Regarding the knife, you can tell that sometimes the knife double slashes on 60FPS, for example when you break a box with a snake in it by slashing it, often times you'll end up automatically killing the snake without having to slash twice.

DarthxVoid commented 2 years ago

the knife also at 60fps gives 9 hits on the padlock and at 30fps it only gives one, and the flash grenade stun time lasts longer at 60 fps, but instead of basing it on 30 fps there's no way to leave it at the level of 60 fps

LethalPlacebo commented 2 years ago

the knife also at 60fps gives 9 hits on the padlock and at 30fps it only gives one, and the flash grenade stun time lasts longer at 60 fps, but instead of basing it on 30 fps there's no way to leave it at the level of 60 fps

I'm not sure if there's one for the flashbang, but this video shows the difference when slashing the padlock in the cage:

https://youtu.be/GWNgxjYSw9g?t=162

I did my own testing on this on Professional difficulty using Area Jump in debug mode. At 30 FPS, the lock takes 4 knife slashes, whereas on 60 FPS it only takes 3 so it seems that this may have been partially patched? Unless RE4 Tweaks is doing something here.

Other thing of note: there are two locks in that cage. The other lock requires 5 knife slashes at 30 FPS, but still only 3 at 60 FPS. Hope any of this info was useful.