FunkinCrew / Funkin

A rhythm game made with HaxeFlixel
https://www.newgrounds.com/portal/view/770371
Other
2.98k stars 2.29k forks source link

Unknown issue is causing gamplay to skip, or desync with the song, resulting in gameplay stutter, lag, etc #3495

Closed TudioS20 closed 1 month ago

TudioS20 commented 1 month ago

Issue Checklist

What platform are you using?

Itch.io (Downloadable Build) - Windows

If you are playing on a browser, which one are you using?

None

Version

0.5.1

Context (Provide images, videos, etc.)

Upon loading any given song, sometimes the game's audio will stutter, or lag. When this occurs, the general gameplay + visuals will stutter as well.

I have a somewhat low-end computer, so bugs will happen to me that aren't actually bugs, but from what I've heard elsewhere, this bug has happened before to others.

Steps to reproduce (or crash logs, errors, etc.)

Just...play a song and see what happens. It's kinda random, so I don't know if it happens with EVERYONE.

biomseed commented 1 month ago

This happens to me too. It's a bug that happened in the latest patch. I think it happens to everyone

Hundrec commented 1 month ago

Can you provide a video of this happening?

TudioS20 commented 1 month ago

Sadly, no, I can't. However, I CAN tell you that it has been reported on Twitter. Multiple people have talked about lag spikes and things similar to it.

If you check Ninjamuffin's Twitter, he made a post where he talked about 0.5.1 being released. There's some replies that talk about it.

Hundrec commented 1 month ago

Thanks for the info! This tweet demonstrates the bug quite well: https://x.com/MajidyMajidy_/status/1840811401683636307

TudioS20 commented 1 month ago

What I saw wasn't as...harsh. It was somewhat more...subtle, but yes, that IS in fact, the bug.

NotHyper-474 commented 1 month ago

Apparently it's the input offset causing this. Another video demonstrating the issue:

https://github.com/user-attachments/assets/79468dd8-5e68-44ea-9555-333de758c4f4

TudioS20 commented 1 month ago

Yeah, that's the bug. But my offsets aren't changed. I don't even know HOW to change it.

What I had was VERY mild, only appearing like, a couple times. It wasn't...THIS bad.

biomseed commented 1 month ago

Apparently it's the input offset causing this. Another video demonstrating the issue:

8mb.video-dWi-yFMMw8Ns.mp4

It is NOT the input offset. I have not changed it once in my entire life

NotHyper-474 commented 1 month ago

It is NOT the input offset. I have not changed it once in my entire life

Well, I could only replicate it with a different offset. Also I wasn't 100% sure hence the "apparently"

biomseed commented 1 month ago

Well, I could only replicate it with a different offset. Also I wasn't 100% sure hence the "apparently"

Don't worry, I knew you weren't sure

biomseed commented 1 month ago

@NotHyper-474 limiting your fps may actually cause the bug. I changed it to my monitor's, 75 (I'm normal). Try a different fps limit or just 75 They added it to the options menu and it now defaults to 60 which might explain why they didn't notice it while bug testing

NotHyper-474 commented 1 month ago

Testing with 30 FPS I've noticed some stutters but nothing like the other video. Can be noticed at 0:03, 0:11 and 0:13

https://github.com/user-attachments/assets/7841ec80-9e9a-42b1-b9cd-9aae5f4c5e6d

TudioS20 commented 1 month ago

That's the amount of stutter I have. It's VERY subtle, usually...

I wonder if I should cap the game at 30 FPS too...?

SEBBY180 commented 1 month ago

I tried increasing the FPS, and it helps a bit, but it doesn't get rid of the audio stutter.

SEBBY180 commented 1 month ago

The more notes are on screen, the more the audio stutters, it seems.

TudioS20 commented 1 month ago

Well, regardless, this actually seems to be an issue, and I PRAY TO GOD ALMIGHTY the Funkin' devs see this issue, and fix it ASAP, because...I REALLY don't wanna start work on my mod with...THAT interfering with it, among other issues.

Squiddu commented 1 month ago

I've been recording all the issues I've had with offset since 0.4.x, and my god it just keeps getting worse.. obviously whether or not this specifically has anything to do with offset is still undecided, but it's still a possibility, given the weird minor visual/audio stutters I noticed ever since 0.4.x (where offset seemed to generally at least.. not crash anywhere).

Johnsen290 commented 1 month ago

same thing for me, I changed the visual offsets to default 0, did not fix it, working better before the patch it slowed down the music

https://github.com/user-attachments/assets/8f9e2c5c-9409-4f87-8495-f16d01fb9003

before

https://github.com/user-attachments/assets/54b17d7b-df13-4fd5-91ab-df0aed23f4be

biomseed commented 1 month ago

Why did you change the title to that Eric? That's not the issue

AbnormalPoof commented 1 month ago

I’m pretty sure it’s because the input offsets are the source of the issue.

Had the same problem when porting over a few charts of mine, but setting the input offset to 0 fixed it.

It’s probably a resync issue (The tolerance is REALLY low now. Kade set the tolerance to 5 ms in another PR compared to the previous 100 ms)

biomseed commented 1 month ago

I’m pretty sure it’s because the input offsets are the source of the issue.

Had the same problem when porting over a few charts of mine, but setting the input offset to 0 fixed it.

It’s probably a resync issue (The tolerance is REALLY low now. Kade set the tolerance to 5 ms in another PR compared to the previous 100 ms)

I did not change my input offsets at all and I still have the issue

Hundrec commented 1 month ago

Looks to me like the resync feature is interacting with anything that offsets the song, including input offsets and lag. biomseed, are you experiencing performance issues/running on a lower end device?

biomseed commented 1 month ago

Looks to me like the resync feature is interacting with anything that offsets the song, including input offsets and lag. biomseed, are you experiencing performance issues/running on a lower end device?

I am not on a low end device. It has run the game completely fine before the patch at the full fps limit (168)

Hundrec commented 1 month ago

Right after I asked you that, I encountered this bug while trying to play Ugh Erect on my decent PC ...with 0ms input offset.

I have no idea what's causing this, but I suggest that this issue be renamed to include "anything that desyncs the song"

https://github.com/user-attachments/assets/393e219e-feab-4271-9e02-1facac4f3a6e

biomseed commented 1 month ago

Which FPS limit are you using? Is it 60?

Hundrec commented 1 month ago

Yes, I'm on 60fps I'll try again with my monitor's 75fps

Edit: Still happening at 75fps

Edit 2: It only seems to be happening on Ugh Erect / Ugh Hard. High Erect and Cocoa Erect don't stutter at all. This makes me believe the song is being desynced by something causing lag spikes in Week 7

AbnormalPoof commented 1 month ago

The tolerance is REALLY low now.

^ I’m not sure if offsets are the culprit here, but it might be resync for sure.

biomseed commented 1 month ago

Edit 2: It only seems to be happening on Ugh Erect / Ugh Hard. High Erect and Cocoa Erect don't stutter at all. This makes me believe the song is being desynced by something causing lag spikes in Week 7

Ugh Erect is having a lot more stutters for me, though it might just be placebo.

TudioS20 commented 1 month ago

Okay, I'm back.

So, my issue tends to occur...really...anywhere, with any song. My input offsets are at default, and I've played with different FPS.

The issue is not entirely input offsets. It COULD be, and there is a STRONG possibility that it COULD be, but my offsets are at zero, default, unchanged since the earliest versions, and I DID NOT have this issue prior to 0.5.1.

As for EliteMasterEric changing the name, I do not believe this is 100% tethered to input offsets AT ALL.

I don't think we really know 100% WHAT is causing this in general, so with all the respect I can give, I am just letting you know: I am going to change the name to something more neutral, or something that highlights the issue in a more...yea, neutral way, because I do not believe the issue has a definitive answer yet.

Johnsen290 commented 1 month ago

Okay, I'm back.

So, my issue tends to occur...really...anywhere, with any song. My input offsets are at default, and I've played with different FPS.

The issue is not entirely input offsets. It COULD be, and there is a STRONG possibility that it COULD be, but my offsets are at zero, default, unchanged since the earliest versions, and I DID NOT have this issue prior to 0.5.1.

As for EliteMasterEric changing the name, I do not believe this is 100% tethered to input offsets AT ALL.

I don't think we really know 100% WHAT is causing this in general, so with all the respect I can give, I am just letting you know: I am going to change the name to something more neutral, or something that highlights the issue in a more...yea, neutral way, because I do not believe the issue has a definitive answer yet.

could be because of how they "fixed" the offset system, they're supposed to fix songs becoming swing rhythm if you have a very high visual offset, and prevent that

oddMLan commented 1 month ago

Can confirm this issue, also confirm raising the FPS limit helps a bit, with 60 fps cap the stutters are really bad, but with 120 fps cap it's still there but not as bad. But I never had this issue with version 0.5.0, so this is also a regression. Nothing a quick git bisect can't help with :)

AbnormalPoof commented 1 month ago

Ohhh noo... Screenshot 2024-10-02 at 9 15 14 AM

Explanation

My input offsets are at 150 ms. Using this as an example (from Tutorial):

source/funkin/play/PlayState.hx:1464: VOCALS NEED RESYNC
source/funkin/play/PlayState.hx:1465: 150
source/funkin/play/PlayState.hx:1466: 456
source/funkin/play/PlayState.hx:1467: 306
source/funkin/play/PlayState.hx:2101: Resyncing vocals to 306

456 is the current FlxG.sound.music.time. 306 is correctSync, which is this: Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.combinedOffset));

150 is the deviation in ms outputted by VoicesGroup's checkSyncError(); function. Basically meaning how much it desyncs in milliseconds.

The issue

if (!startingSong && (Math.abs(FlxG.sound.music.time - correctSync) > 5 || Math.abs(vocals.checkSyncError(correctSync)) > 5))

This is the line causing the issue. It checks if the deviation is over 5ms, if it is, then it resyncs the vocals. And since 150 is the deviation... yeah... And since this occurs every beat. The song is basically unplayable.

It might be a mathematical error with this function (I could be wrong though!):

  function get_combinedOffset():Float
  {
    return instrumentalOffset + audioVisualOffset + inputOffset;
  }

Side Note: Is it necessary to use inputOffset here? I don't really see a reason why since it's for inputs, not the song.

Burgerballs commented 1 month ago

I'll probably make a PR for this lol

TudioS20 commented 1 month ago

Wait, so we actually found the issue!?

KoloInDaCrib commented 1 month ago

Not sure if this was fixed already, but since there was no pr I assume it's not

Surprisingly changing line 416 in Conductor to this fixes it: image (i think, gotta do more testing but so far nothing peculiar)

Footage (my current offset settings are 150ms): https://github.com/user-attachments/assets/f66ac4dd-d88b-45fb-91c7-343ae70b1ae4

Edit 1: theres still issues when I want to add additional offsets to player and opponent voices, will make a pr once i fix that

Edit 2: fixed that as well lets go babyyyy pr time >:]

CRLurker commented 1 month ago

So what can I do to stop the issue? Like my version is so bad the song won't even play.

AbnormalPoof commented 1 month ago

To fix the issue completely, either compile the develop branch or wait for v0.5.2.

AbnormalPoof commented 1 month ago

Fixed in v0.5.2.

SEBBY180 commented 1 month ago

This issue is still in 0.5.2 unless you set the framerate to at least 125.

KoloInDaCrib commented 1 month ago

It's on me for not testing my hypothetical solution (that was accepted n merged n stuff) for a higher range of framerates, I apologize,,,,,

EliteMasterEric commented 1 month ago

It's definitely fixed now.

biomseed commented 1 month ago

It's definitely fixed now.

It's definitely not as some people are still having the issue It also still happens for me though it's far less significant

oddMLan commented 1 month ago

It's definitely fixed now.

Famous last words

amyspark-ng commented 1 month ago

the issue DEFINETELY still exists

Hundrec commented 1 month ago

It's okay Eric We're always here to hunt down bugs for you and make sure they're totally fixed!

NotHyper-474 commented 1 month ago

Uhh...

https://github.com/user-attachments/assets/f280fdf7-0ecf-46ea-b3a4-f636884c1da7

Doesn't happen on Windows (although the subtle stutters are still there) and neither on higher FPS, might be because I'm on WSL (kinda like running Linux through a virtual machine) so in here the subtle stutters become way less subtle...

Hundrec commented 1 month ago

Another great remix bug, almost as good as Swing Mode

Johnsen290 commented 1 month ago

holy crap, that's really terrible