nipkownix / re4_tweaks

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

(Feature Request) Additional 60fps fixes #524

Open JudeH1 opened 1 year ago

JudeH1 commented 1 year ago

Describe the feature you'd like to see added

On 60fps, Leon's hitbox is significantly bigger. https://www.youtube.com/watch?v=PcBi8p3z7cw In addition, enemies behave more aggressively (I can't find a video comparing this, but it seems to be a known issue in the speedrunning community). It would be great if these things could be fixed.

emoose commented 1 year ago

Tried looking into that hitbox issue before, seems the problem isn't that hitbox itself changed, but running at 60FPS meant that collision checks are performed more often, so the character can't go as far into the colliding object before it detects that collision happened.

One way to think about it is say char moved at 30 units per second, at 30fps the character would move 1 unit each frame, so 1 unit into an object until a collision check is made - but at 60fps it would move at 0.5 units each frame, so the char would at most be able to move 0.5 units inside it before collision was detected, making hitbox feel bigger since character didn't travel as far.

Not sure if that makes it any easier to understand though lol, but what it means is physics/collision would need to run at same rate as 30FPS somehow to fix it (or maybe some way to make it run duplicate checks across frames could help, IIRC we did do something like that for falling objects?)


E: thinking about this more, something similar to the falling item fixes could probably work here. Maybe in the code that detects a hit, we could add a check to see if time of current frame would be equal to a 30FPS frame, and only if it is then the collision is counted. (IIRC game does have a frame counter that increments by 1 every 30fps frame, but 0.5 every 60fps, so we could just check if that's whole number to see if this would be a "proper" frame) Otherwise if this frame would be in-between a 30FPS frame, we just ignore the collision and let whatever movement continue on to the next frame instead, which AFAIK should let it keep travelling the same distance that it would at 30FPS.

No idea where that'd need to be implemented atm though, maybe will try playing around with it soon. (also wonder if something like this might help with the AI code at all, if we only execute AI stuff on each 30FPS frame that might let it behave as it does at 30FPS, not sure if that might make it seem stuttery/laggy at all though, depends if any graphics/animation code might be tied into the AI functions I guess...)

JudeH1 commented 1 year ago

That makes sense. Do you know what's up with enemy behavior? I see in a pull request you mentioned that "enemies seem to turn around much quicker at higher FPS, and attack you almost instantly (so that means 60FPS has been hard-mode this whole time?)," I was wondering if you ever figured out if/how this specifically affects the game's 60fps setting?

RiasatSalminSami commented 1 year ago

If it does get fixed, I hope there still remains option to keep the enemy AI aggressive and hitbox large for 60 fps mode. I like the added difficulty personally.

47MWCSBN commented 1 year ago

and also some gun still lock in 30 fps animation

nr1995 commented 1 year ago

and also some gun still lock in 30 fps animation

Yeah the regular wooden rifle reload animation being stuck in 30fps is a real tragedy.