re4_tweaks icon indicating copy to clipboard operation
re4_tweaks copied to clipboard

Porting & PC-specific issues

Open emoose opened this issue 3 years ago • 66 comments

Since the issues page has got a bit large and it's a little difficult to find the UHD issues that still need work, I figured a separate page indexing them all would be useful.

This page mostly deals with three kinds of problems: issues that appeared during the porting process (GC/PS2->Wii->X360->PC), PC specific issues, and problems caused by 60FPS+ framerate - issues with/caused by re4_tweaks & feature requests aren't covered.

This is by no means complete and mostly just which issues I can recall right now, probably missing a lot from here.. please feel free to mention any that are missing and I'll update this list.

Issues without a linked issue page are either very well-known already, or uncertain/rumoured, if anyone finds an example to prove the issue exists feel free to make a reply or new issue page for it.

Port issues/changes

  • Filter03 (glare) is broken, currently applies extra color to whole scene, should just be adding some extra color to edges of models that are close to light/fire sources - Filter03 has some code removed compared to GC version, but restoring the GC code doesn't seem to help (tested this recently too, still no luck with it...) (#5)
  • Water texture is changed from GC, seems to have broken reflections in some spots (https://github.com/nipkownix/re4_tweaks/issues/175#issuecomment-1243043667)
  • The item pickup from Saddler appears before end cutscene starts, making pickup glow appear throughout cutscene (even covering whole screen at one point) (#331)
  • Main menu background can no longer be scrolled around, code for it seems to have been removed (which port removed it first? ~~Wii~~ 360/PS3?) (#290)
  • Audio effects (echo/reverb) are missing, probably relied on GC/Wii's AX audio processing/effect library (does PS2 still have them though?) (#300)
  • Enemy spawns changed in PS2 port onwards? (heard this mentioned but haven't confirmed it - might not be something we can fix in the code though) - confirmed that certain enemies were removed after the initial GC release (see below), but I'm sure I heard spawn locations changed too...
  • Merchant death animation was changed from GC version (#238)
  • Shadows are drawn on top of fog effect, making it clear where enemies might be hiding in the fog... probably an issue with how they emulate GC/Wii GX graphics, seems fog is drawn with a shader, can we make that shader draw after the shadows?
  • UHD ports removed blood texture on U3, ~~could be related to Leon face texture not changing when in pain too~~, something about model texture changes maybe broken?
  • Not really an issue, but the Wii version added support for Wiimote aiming, which many prefer over controller/mouse - the code for it is still mostly included intact in the UHD release, would be awesome to expose that to players (either with something that could support Wiimotes directly, if there is any library for that, or maybe just allowing the aim crosshair to be controlled by mouse pointer position would be enough, IIRC there's already tons of software that can translate Wiimote -> mouse position...)

PC-specific issues

  • Framerate is a lot worse compared to the older PC port, using dxvk can help improve it, but that could bring it's own issues too. Could be caused by overhead from the GameCube/Wii GX-API -> DX9 layer that it uses (dxvk wouldn't really affect that though...), or maybe the D3D9 MULTITHREADED flag slowing things down? (#44, #255)
  • Game-speed is tied to FPS, if framerate goes lower than the chosen FPS cap (30/60) then game will start to slow down - UseDynamicFrametime setting added by re4_tweaks can help with this, but also causes a lot of issues too, game isn't designed to work well with varying frametimes... (eg #328)
  • Framerate cap can't be changed during gameplay - editing the value in memory does work to change it though, but maybe there's a reason they disallow it during gameplay (certain timer values for things like cEm routines do make use of deltaTime/gamespeed when they're inited...)
  • XAudio related code will cause game crash if no speakers/headphones are connected
  • XAudio related code randomly causes crash when loading a stage, even with speakers/headphones connected (crash seems to happen around something like 1 in 10 runs for me - might be caused by having VS debugger attached though...)
  • Audio crack/pops when some enemies talk
  • Del Lago spear-throwing section seems to still be based around analog sticks, with a mouse it feels really floaty, sometimes just ignores mouse movements altogether, code for it is only using AnalogXX values, could use some improvement (https://github.com/nipkownix/re4_tweaks/issues/160)

60FPS issues

  • Water animation speed is doubled at 60FPS (#175)
  • Some animated texture speeds usually aren't correct, also seems there's no interpolation happening with them, so 30FPS texture animations look very obviously 30FPS (eg. waterfalls)
  • Certain animations (rifle reload) use a mode that locks the animation to 30FPS, other game anims are able to play at 60FPS+ fine, seems to maybe be disabling interpolation - re-enabling it brings a huge amount of issues though, likely an issue with the animation data itself? (maybe format it's stored in can't be interpolated easily...) (#23)
  • Damage from enemies & weapons may be doubled at 60FPS
  • Certain falling item & object animations (chest opening, cabinet opening...) still have speed issues at 60FPS, seems some were fixed while others were left out.

emoose avatar Sep 15 '22 15:09 emoose

Main menu background can no longer be scrolled around, code for it seems to have been removed (which port removed it first? Wii?)

This actually still exists in the Wii edition and I've made sure to test it as well. Idk which port removed it first unfortunately, but it's definitely there on Wii.

No emulation was done to test this, btw. I still own my Wii and copy of the game for it haha.

linkthehylian avatar Sep 15 '22 23:09 linkthehylian

Thanks for compiling all these issues in one single post!! I have some clarifications/additions in case you want to update the first post:

-"Animated textures also run at doubled speed": The fire effects still run at 30fps, maybe some other animated sprites effects runs at double speed, but I'd say most of them don't.

  • UHD issue. The "falling item" speed when you shoot a gem or a treasure, etc. is inconsistent. It depends on the room. The fix in the re4_tweaks makes the items that fell at the right speed to fall at half speed. Unfortunately, the double speed animations are a mess, for example, some treasure chests open at normal speed, some others at double speed... I guess they did all the 60fps animation porting process by hand and they forgot lots of them ¿?

  • UHD issue. When the player turns his head when an enemy approaches, the right hand animation doesn't move as it should and makes the weapon to float. Only using certain weapons (regular shotgun, for example, among others). Here's an example: Striker (OK) vs Shotgun (bad) https://www.dropbox.com/s/5aaowsacfpetyc4/Shotgun%20animation%20issue.mp4?dl=0

  • HD ports issue. Shadows in the floor of all characters (enemies, player) are not affected by the ambient/stage fog. This makes the shadows to look pitch black even if they are immersed in a foggy area. Both fog and the character shadows data are stored in the LIT files. Maybe it's a matter of changing their "hierarchy" somehow... UHD: https://www.dropbox.com/s/gq175ioi1p563xv/Floor%20shadows%202%20PC.mp4?dl=0 Gamecube: https://www.dropbox.com/s/owcnbgintmgnta1/Floor%20shadows%202.mp4?dl=0

  • UHD issue. The light bloom effect of the game is semi-broken (the "immersive" one, not the simple rotating sprite). You can see it through walls in certain moments and it flickers when the camera moves (again, only under certain conditions). And it deactivates even when a model doesn't reach the effect completely. I'd say some internal coordinate is wrong. I made some tests a long time ago and I noticed when the effect disappears when moving the camera to the right or left, it matched when the effect is visible through a wall. (FYI) I've edited the bloom effects to do this video, so it's really obvious what the problem is by watching it: https://www.dropbox.com/s/hrhh3lekbay5yyy/00-BROKEN%20BLOOM%20EFFECT%20-%20NEW%20AND%20MORE%20UNDERSTANDABLE%20VIDEO.mp4?dl=0 The same problem happens with the flare lens effect. I guess it's the same issue.

  • UHD issue. The flare lens effect is unstable a lot of times. When you Alt+TAB the game and come back to the game, the odds the flare lens effects are gone or unstable are high. https://www.dropbox.com/s/k0jqwhqqjfv61ju/FLARE%20LENS%20CRAZY.mp4?dl=0

  • Sound issue: Mostly when Ganados talk (maybe in some other cases) the sound starts with a "click" https://youtu.be/HKecTuS9vkM

  • Novistadors in room r20a: Originally, in the North America first release of the game, there were 2 Novistadors in the small room (the one with the lock). They were triggered when you rescue Ashley and you come back to obtain the broken butterfly with Ashley's help. I restored them in the HD project, but they are there since the start. The data for the 2 Novistadors is still in the ELS file (the trigger enemies files). So I guess the code that activates the 2 Novistadors was removed. image

  • Cabinet doors wrong position when reenter room r315. Better a video: In Main Campaign, WRONG: https://www.dropbox.com/s/dnrr39x4467fppx/r315%20CABINET%20WRONG%20DOOR%20POSITION%20WHEN%20REENTER%20THE%20ROOM.mp4?dl=0 In Separate Ways (room 515), CORRECT: https://www.dropbox.com/s/hndmc22wi4it7vt/r515%20CABINET%20OK%20DOOR%20POSITION%20WHEN%20REENTER%20THE%20ROOM.mp4.mp4?dl=0

And that's it XDDD phewww!

albertre4HD avatar Sep 17 '22 11:09 albertre4HD

Many thanks for the list, was hoping you might see this post and add to it :smile:

Cabinet doors wrong position when reenter room r315

Had a quick look at this, might be caused by a small coding error, comparing the function in r315 to r515 it seems r315 is adding to the cabinet door position while is r515 taking away from it instead, very subtle issue since the only change is - instead of +...

Surprised they didn't fix r315 too since they obviously fixed the issue themselves in r515... guess they maybe didn't want to touch any of the older main-game code in case something broke? idk.. should be safe to change it though.

Changing it in CE seemed to fix it, you can hex edit EXE to change it too, search for D8 45 08 83 C4 04 and change it to D8 65 08 83 C4 04 (just change 45 to 65), will see about adding it to re4_tweaks soon too.

emoose avatar Sep 17 '22 11:09 emoose

Ha! Great. When I think I tried porting all files from room r515 to r315 ...

Don't mention it!

Maybe it wasn't broken in Separate Ways by default... I can't see them fixing this small bug, really XD

albertre4HD avatar Sep 17 '22 12:09 albertre4HD

Novistadors in room r20a: Originally, in the North America first release of the game, there were 2 Novistadors in the small room (the one with the lock).

This one is a little trickier, the GC debug does also spawn them too, so it's easier to test, but you do have to go through the bar shooting section & ashley segment first for game to count her as "rescued", then returning thru r20c -> r20a will have new enemies spawned, and the 2 enemies will show up on r20a.

On UHD though doing the same will let r20c enemies spawn, but none on r20a...

Doesn't seem r20a has code for spawning those enemies in either version, so they must be done some other way. Seems the game has at least 3 different ways of making enemies show on earlier maps:

  • EmListSetAlive takes an ESL index and sets it in memory to be alive/spawnable
  • cEmWrap::setEm takes an ESL index and uses EmListSetAlive on it
  • and it looks like checkEmListNo can actually change what ESL the map will use based on flags

The enemies on r20c seem to get spawned by checkEmListNo, by changing the ESL it loads when the SCF_R206_ASHLEY_RESCUE_IDX flag is set, unfortunately there doesn't seem to be any difference between GC/UHD in the flag checks in checkEmListNo that I could see, so it could be either a call to EmListSetAlive / cEmWrap was changed, or maybe the ESL that it changes to once SCF_R206_ASHLEY_RESCUE_IDX is set was changed (emleon04)

Could be that the Novistadors show up in the normal non-ashley-flag ESL (emleon03? unsure), but without the alive flag, while emleon04 would have a copy of them with the alive flag set, but maybe UHD removed the duplicate entry with alive flag entirely - just a guess though, it's also likely something could be calling the EmListSetAlive on them sometime after the Ashley rescue instead... will try looking more into it soon.

emoose avatar Sep 17 '22 16:09 emoose

Ahhhhh. You gave me an idea. Since all the r20a enemies were stored in emleon03.esl, I only edited that file and forced the game to spawn the Novistadors since you enter the room the first time. In fact there was the data for 2 Novistadors in that room, but they were a different variant and their spawn position and bahaviour was different from the one in the USA GC version. And now I understand why: These were not the lost Novistadors.

But I never thought emleon04.esl also contained 2 r20a entries... ONLY 2!! and guess what?: They are the 2 missing Novistadors :D image

In the emleon04.esl of the PC port the enemy ID is "zeroed" So they simply didn't appear... So I simply changed the initial "01 00" of both lines to "01 2D" and they magically appeared only after rescuing Ashley and go back through room r20c.

So, it's fixed! You just need to replace this file https://mega.nz/file/kGJnwL6B#IWw0EykvKE50mWewGb74uiWWhG9smpu5krVkYebZA78 (and don't load a savegame in the castle, because I think the game stores the enemies data inside the savegame, and if you saved the game when the wrong file was in the game folder, it won't contain the 2 Novistadors)

So, we can conclude this issue only needs a 2 bytes file edit. EDIT: Can this edit be performed by re4_tweaks? Or I simply include the edited file in the future HD project 1.2? Just asking. The file is already done ;)

Is there any other missing enemy compared to the first USA GameCube version? Because the solution is probably the same.

albertre4HD avatar Sep 17 '22 17:09 albertre4HD

Aha nice, thought it might be something in there, was going to start comparing entries in GC to UHD to look for it, but didn't think of trying to look for the ones with 20a room ID heh.

I did notice some of the earlier entries in the emleon04 also had the enemy ID zeroed compared to GC as well though (eg. the ones at 0xE0 - 0x1E0 use ID 0x14/0x25 on GC debug, but zeroed on UHD) so guess there's a good chance other enemies might have been removed the same way, wonder if a quick GC->UHD ESL converter tool could be useful for those, would make it easier to compare at least.

Think it might be better for HD project to include that, could be other mods that also edit that ESL that we wouldn't want re4_tweaks to override.

emoose avatar Sep 17 '22 17:09 emoose

Oh, you are right! I don't know any tool that does that, but it shouldn't take too much time to compare the lines and see the zeroed entries Haha Oh yeah! let's make the game harder!

albertre4HD avatar Sep 17 '22 17:09 albertre4HD

Ok, here go the differences in the ESL files:

emleon03.esl I don't know what's the difference of 00 and 01. image

emleon04.esl As you mentioned: REMOVED ENEMIES!! image REMOVED ENEMIES!! image

emleon05.esl I don't know what's the difference of 00 and 01. image

emleon06.esl I don't know what's the difference of 00 and 01. image

And that's it! These are the main differences in Enemies Spawn Lists In brief, the removed enemies are:

  • 2 Novistadors in the broken butterfly area when you come back to these areas after rescuing Ashley
  • 8 zealots in the blue columns room when you come back to these areas after rescuing Ashley

albertre4HD avatar Sep 17 '22 22:09 albertre4HD

Thanks for looking into it! Pretty strange choice to remove those enemies, pretty sure those are all optional right? You have to choose to backtrack to run into them, so not like players are ever forced to defeat them to continue the story, odd. Maybe they figured adding enemies there could be a waste of ammo or something.

I think the difference between 00 and 01 in that column is setting the ALIVE flag, so being set to 00 would pretty much remove them, except game does have ability to bring those ones alive later on in code with EmListSetAlive (game can't do that with enemies that have ID 00 like Novistadors though afaik), it uses that with a bunch of enemies, no idea if it's used with the changed ones you found though.

emoose avatar Sep 17 '22 22:09 emoose

I haven't noticed any difference playing in normal and professional and entering those areas several times after killing them all... So, I have no idea what the 00 01 do in those cases XD

And yes, those enemies are optional 100% It's the price you have to pay to backtrack and obtain the broken butterfly for free, and you can dodge them anyway. Specially the ones in room r20f (blue columns). You just need to run and that's it. So... no idea why did they remove them... ¿?

Ohh! I almost forget these other 2 bugs:

  • UHD: When U3 "It" transforms, a blood texture covers him (the texture is gone during the "second round"). But the texture is missing in UHD and later ports. It was present up to the PS3 port: PS3: https://youtu.be/WnL-BsKiwnI?t=40483 PS4: https://youtu.be/m-bzZo_sRzY?t=23396 image

  • UHD 60fps: During the first Saddler cutscene in the church, the chandelier Leon uses to jump from one side to another flickers. This only happens during an actual gameplay, not in the Movie Browser. My guess is something gets activated when Leon uses the chandelier, or maybe the final 2 animation frames in 60fps mode are fighting each other. It looks ok at 30 fps https://youtu.be/m-bzZo_sRzY?t=6155 image

albertre4HD avatar Sep 17 '22 23:09 albertre4HD

Interesting discoveries here, specially about those enemies being probably intentionally removed, hmm 🤔

nipkownix avatar Sep 18 '22 14:09 nipkownix

Another clarification about this point:

"UHD ports removed blood texture on U3, could be related to Leon face texture not changing when in pain too, something about model texture changes maybe broken?"

They are 2 different things. And this leads me to another bug and some notes about it.

  • UHD: Missing facial expressions Leon's and other player facial expressions in pain and death are stored inside the plxx.udas files as morphing data. These are Leon's model data converted to obj using the bin converter tool: image

So it's not a texture, but a morphing animation. Exactly the same method used during cutscenes to animate faces. Cutscene morphing faces reach up to 30 different meshes, unlike the ingame characters which only have 1 or 2.

It's strange Ashley face is properly animated. She has exactly the same morphing method that makes her to look worried during the idle animation when she's with Leon.

So, let's analyze characters face morphing data:

  • Leon (pl00, pl08, pl09, pl10): 2 morphing meshes
  • Ashley (pl01, pl11, pl05, pl15): 2 morphing meshes
  • Ada (pl0b, pl0c, pl16): 1 morphing mesh: Unused even on the Gamecube... Her facial expression never changes. but it's incorrectly used in the debug build when she jumps through a window. So it can be triggered: image

And some Leon facial expression images in the Gamecube: image image

  • HUNK and Wesker have no morphing data, so their faces never changes
  • Krauser face animation works with bones instead of morphing meshes, just like the enemies. So, he has no problems

And that's it!

albertre4HD avatar Sep 18 '22 18:09 albertre4HD

Ah interesting, thanks for the breakdown. I noticed the game does have a PlSetFace function that's gets called by a ton of places, and some character classes also have a setFace function too (which PlSetFace calls into), for some characters that function does nothing, but seems these classes do try loading in data at least:

  • cPlLeon
  • cSubAshley
  • cPlWesker
  • cPlAda

while these classes have no code and don't try loading anything:

  • cPlAshley (ashley segment version I guess)
  • cPlKlauser
  • cPlHunk

I also found in the PS2 version a enum for the kinds of faces those functions set:

  • FACE_NORMAL = 0
  • FACE_SURPRISE = 1
  • FACE_SHOUT = 2

Doesn't seem to have anything pain/death related, unless they just reused the enum values without renaming them maybe - or it's possible this setFace stuff I'm looking at isn't actually related to how they apply the pain/death ones, will try checking GC version soon, maybe something is different there.

E: btw, could you tell me which file in the pl00.udas has the morph data? Are they both stored inside pl00_004? If they are, then I guess this setFace code must be for something different, since this seems to be reading from _094 / _095...

emoose avatar Sep 19 '22 14:09 emoose

Ahh, that makes sense, Ashley as player (pl01) has the morphing data, but her face never changes in the Gamecube.

About Wesker, there is no morphing data. Maybe they had the intention to include it but they forgot XD

albertre4HD avatar Sep 19 '22 19:09 albertre4HD

Hm, tried forcing the setFace functions to the surprise/shout ones, didn't notice any difference in Leon's face with it though, maybe there is something broken with that function there, will have to try testing it on GC too.

Looks like the pl00_094/pl00_095 data used for those might also be referencing data from the main model too (_004?), maybe the morph data you found in there.

Unfortunately the Shape code it uses to apply the face CalculateShape_new is pretty similar to the main MOTION_INFO animation stuff, using Hermite curves and weird stuff like that, so not very easy to understand... AFAIK hand shapes are also using the same function though, and maybe faces during cutscenes too, so I guess it's not completely broken at least, maybe just an issue with the _094/_095 data.

emoose avatar Sep 20 '22 11:09 emoose

I see... _004 is the face model for Leon, for example, it's pl00_004.bin Faces are usually number 004 Leon's with jacket extracted models: image

albertre4HD avatar Sep 20 '22 11:09 albertre4HD

Looks like changing setFace does have an effect on GC, here it is forced to 1 / FACE_SURPRISE:

Dolphin_22-09-20_13-31-23-870

and with 2 / FACE_SHOUT:

Dolphin_22-09-20_13-32-32-358

and finally for comparison, the default 0 / FACE_NORMAL:

Dolphin_22-09-20_13-30-14-605

FACE_SHOUT seems very similar to FACE_NORMAL, but I think there might be some slight difference around the mouth there.

So I guess the issue is probably with the setFace stuff then, will have to double-check that forcing it on UHD definitely doesn't work, then will maybe try seeing if I can replace the _094/_095 data with something from cutscenes instead to see if that affects anything.

E: yep, still no effect forcing it on UHD. Looks like cutscenes are making use of the same Shape stuff for lip sync though, maybe they changed something to fix 60FPS lip sync and broke the setFace stuff in the process. Going to try forcing one of the cutscene shapes during gameplay to see if it still animates in-game at least.

emoose avatar Sep 20 '22 12:09 emoose

Haha it's funny to see these images The second one it's about the eyes' expression. He looks more serious/focussed. I have no idea when he uses this face... The first one is for both damage and death Great you fount it on the GC!

albertre4HD avatar Sep 20 '22 16:09 albertre4HD

Added a button to test setting the shape data directly (wasted like 30 minutes debugging because I was making it apply to m_pHead_24 instead of m_pFace_10 >.>) With shape data from cutscene the button did move the face around, it was all polygons shooting out of his face though (forgot to take pic), I guess cutscene face model is different somehow? but at least it showed the data from cutscene did change stuff. Edited it to use the FACE_SURPRISE data and got this, blink and you might miss it:

https://user-images.githubusercontent.com/1755499/191324725-09f12eb9-6f3d-49a1-80eb-f399e16fe50d.mp4

Weird thing is with the cutscene shape data the changed polygons stayed after the animation, but I guess something in FACE_SURPRISE is making it reset straight after it (SURPRISE does only has 1 frame defined, while the cutscene shape had ~100 or so), will need to look into it more...

E: seems ShapeMove is what resets the face, looks like they might have bugged something in there with the 60FPS changes. It does seem to accept a flag that stops it from resetting though, if I set that then the face stays fine when I force it: image

If you search for 8B 48 10 6A 02 56 in the EXE (should be 3 matches for leon/wesker/ada) and change the 02 to 03 that should set the flag for the setFace func, can't really tell if it's letting the pain face show when attacked or not though, looked like he did have closed eyes when dying but maybe that happened anyway?

emoose avatar Sep 20 '22 17:09 emoose

Here's a build with a slightly better patch to ShapeMove instead of setting that flag (undo the flag if you tried it), should help with the other chars like Ashley too, but might need to make sure it didn't affect any cutscene faces: dinput8.zip

Still not sure if it's working properly though, I did get a bug while making it which made his jaw pop out when attacked which was visible for a few seconds, fixed that now, but hopefully means the actual pain face shows too.

emoose avatar Sep 20 '22 18:09 emoose

Oh wow! What an exhaustive research! As always! I'm going to test it in a few minutes :D

albertre4HD avatar Sep 20 '22 18:09 albertre4HD

Oh yeah! I've only tested this and there are no problems during the first cutscene. I'll do more checks later (I have to go now) image

albertre4HD avatar Sep 20 '22 19:09 albertre4HD

wonderful!

qingsheng8848 avatar Sep 21 '22 12:09 qingsheng8848

Ashley (when she's with Leon) also changes her facial expression now! image

Wesker doesn't, but he has no alt.face expressions, so even if there is the code, there's nothing to load.

Ashley as main player and Ada don't change their expressions never, but it was already like that in the Gamecube

albertre4HD avatar Sep 21 '22 18:09 albertre4HD

UHD 60fps: During the first Saddler cutscene in the church, the chandelier Leon uses to jump from one side to another flickers. This only happens during an actual gameplay, not in the Movie Browser. My guess is something gets activated when Leon uses the chandelier

Confirmed this happening too, went back and made two saves, one before jumping on it (where I'd need to jump on it to start the cutscene), and one after - issue only seems to happen on the save that's before jump, so I guess something related to chandelier gets changed after jumping, and game doesn't reset it properly afterward, but saving/reloading after jumping on it lets the data be set back to normal, so the cutscene (and movie browser) doesn't have the issue.

Maybe something related to the position of it, I'd guess if it was off even a tiny bit it might cause the cutscene to act up, will try giving a closer look soon.

E: huh, position of it doesn't get changed at all by jumping on it, looks like they use the MOTION_INFO stuff to handle the animation of it swinging though, seems a flag is set after jumping that stops the MOTION stuff, maybe during event cutscenes it ignores that flag or handles it different somehow, will have to see if I can find where it's setup.

emoose avatar Sep 24 '22 18:09 emoose

Thanks for confirming the issue! Damn 60fps... XD

albertre4HD avatar Sep 24 '22 18:09 albertre4HD

Ahh think I've got it, it's to do with the deltaTime variable, seems the chandelier animation keeps running after you've jumped from it, just with a neutral animation, which is fine when deltaTime is static (0.5 for 60FPS / 1 for 30FPS), but the framelimiter code in the game actually has a strange check to see if an event is running, and if it is then it allows deltaTime to be based on the actual time the previous frame took (I never understood why it's doing that, maybe it's something to try and improve the sync of the cutscenes or something, or to reduce slowdown during cutscenes)

So since it's based on the actual time of last frame, the deltaTime starts changing to something like 0.5000039935 or 0.5000010133 each frame, and I guess the animation system doesn't like deltaTime changing so much, resulting in it shaking/flickering around.

Our replacement framelimiter code copied the same weird event check & making deltaTime use actual frame time, if I remove that weird code then the chandelier seems to be fixed (and if I force that code, the chandelier starts flickering in gameplay too :p), so pretty sure that's the culprit.

Not really sure how to fix the animation code to work with frametimes like that, so I guess for now I can probably just add a check to see if it's playing chandelier event and make it skip the frametime code if it is, if any other cutscenes have weird flickering like that maybe they could be fixed the same way too.

emoose avatar Sep 24 '22 19:09 emoose

Wow! Good finding! AFAIK, this is the only one cutscene with a flickering dynamic stage item

Just a curiosity question, in case you know: Why some chest lid animations have correct speed while others have double speed (at 60 fps of course). Is this caused by the porting team adjusting one by one all the animations to 60 fps and they simply did some of them and forgot some others? Or is it something more complicated? Example: room r104. double speed room r204, correct speed https://www.dropbox.com/s/6q60wbl841hfhdc/chest%20speed%2060fps.mp4?dl=0

albertre4HD avatar Sep 24 '22 19:09 albertre4HD

Is this caused by the porting team adjusting one by one all the animations to 60 fps and they simply did some of them and forgot some others?

Yeah that's mostly it, for a lot of broken anims it's usually the code itself manually changing the position/angle each frame, original GC code relied on game running at 30FPS, so how much it changed it by was timed for that, for 60FPS they manually edited a ton of functions to make it take the deltaTime variable I mentioned before into account, some reason they forgot to update a lot of funcs though, which I can't really explain since it's not really too difficult to find them...

eg. just from the room names you've posted, I can see r204 has a r204_openBox func, which calls r204_BoxMove, which has a loop that tweaks angle of it by 0.05000, but that gets multiplied by deltaTime, which is why the speed is correct.

Meanwhile r104 has r104_openBox which calls r104_openBox_main, which has a similar loop that tweaks it by 0.05666, but without any usage of deltaTime, which is most likely why speed is doubled there.

Only reason I found them was because you knew the room names though (and we had most of the functions for those rooms named), with the source code they had they could have easily searched for all code that changes angle/position of an object, checked if it was something tied to framerate, and updated it with deltaTime, who knows why they didn't...

If you happen to have a list of rooms with broken timings like that we can maybe track down the funcs responsible (though for separate ways & other PS2+ content we're still missing a lot of func names, so might be a bit more difficult)

emoose avatar Sep 24 '22 20:09 emoose