ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.33k stars 2.28k forks source link

Gameplay may skip/stutter briefly at the start of beatmap when lead-in time is used #22488

Open VisMGA opened 1 year ago

VisMGA commented 1 year ago

Type

Performance

Bug description

I've occasionally noticed a slight lag at the beginning of certain maps. Looking at my footage frame by frame, my cursor still moves, but approach circles slow down or freeze briefly. I've only noticed it on maps that have hit objects very close to the beginning of the map. Some maps: https://osu.ppy.sh/beatmapsets/1129015#osu/2359641 https://osu.ppy.sh/beatmapsets/418202#osu/905342 https://osu.ppy.sh/beatmapsets/770023#osu/1618984 Harder to tell if it appears on this map as well, but I think it might. https://osu.ppy.sh/beatmapsets/1095785#osu/2290176

Screenshots or videos

https://user-images.githubusercontent.com/35517046/216144255-46948064-6319-40d9-a1fc-cd6d74737e1e.mp4

Version

2023.123.0-lazer

Logs

performance.log performance-audio.log performance-draw.log performance-input.log performance-update.log runtime.log updater.log database.log input.log network.log

Theighlin commented 1 year ago

Same issue as described in https://github.com/ppy/osu/discussions/16515, and more visible in the video of the last reply https://www.youtube.com/watch?v=FNnIlO2X9sE

peppy commented 1 year ago

Probably best to leave this open if there's not already an issue tracking this.

Don't really have a solution in mind yet, beyond adding empty space to the start of the track as part of the byte stream (could work quite well, but would be a bit fiddly to implement).

For what it's worth, stable has the same issue for any beatmaps where the first hitobject is very close to the start of the audio track.

peppy commented 1 year ago

In the latest release, the effect of this should have been greatly reduced. If anyone was experiencing this, could you please check how it's feeling these days?

I do have a forward path to reduce this down to zero, but it requires a bit more work, so it would be good to know how we're doing to better prioritise the follow-up work. In local testing, things are feeling pretty good (still noticeable but not as jarring/distracting), but this could be per-system and per-platform.

Theighlin commented 1 year ago

Stutter seems to be the same for me from the few beatmaps i've tried.

Xerbly commented 10 months ago

I can still recreate this issue on a few maps, in version 2023.1130.0. Also, switching audio outputs somehow fixes the issue temporarily. Here is a video:

https://github.com/ppy/osu/assets/89270842/cc4fc85f-aa27-4ee4-9273-07821bee105b

Also logs if you need them. performance-update.log runtime.log input.log performance.log performance-draw.log database.log

Maxwell-lt commented 10 months ago

I've been able to consistently reproduce what looks like the same issue on the latest release (2023.1223.0-lazer). I've recorded a few plays that have this issue, and in all cases recordings made with OBS show that there is a pause of about 133-150ms (9 total frames with the same position of approach circles/slider snaking, recorded at 60FPS).

This happens consistently for each of the beatmaps I've observed this issue on, which includes all four of the beatmaps listed in the original issue description. However, I was not able to reproduce the issue on the beatmap @Xerbly used https://osu.ppy.sh/beatmapsets/1621390#osu/3310382. (Nor did switching audio outputs have any effect for me.)

This occurs in all four game modes, per my testing on https://osu.ppy.sh/beatmapsets/1530096#osu/3370765

My scenario appears to be more severe than what's been previously reported, as it causes the audio to play >100ms ahead of the gameplay timing (most easily observed when using the Auto mod), requiring the circles to be clicked very offbeat for an optimal judgement.

Once a break happens, the audio and gameplay regain sync.

I've tried windowed, borderless, and fullscreen screen modes, as well as multiple frame limiter settings (tried VSync, 4x, and unlimited), and both multi and single thread modes. This issue was reproducible in each of those scenarios.

This is not an issue that I can reproduce on osu!stable. I tried https://osu.ppy.sh/beatmapsets/1002234#osu/2097830 (see video below for behavior on osu!lazer) on stable and did not encounter a stutter or audio timing issues.

System details

Kernel: Linux 6.1.65 OS: NixOS 24.05.20231204.2c7f3c0 Desktop Environment: KDE Plasma 5.27.9 Window Manager: KWin (Wayland) Audio Backend: Pipewire CPU: AMD Ryzen 9 7950X3D GPU: AMD Radeon RX 6950 XT

Videos

Video showing a stutter near start of approach circle on https://osu.ppy.sh/beatmapsets/1002234#osu/2097830 (at 00:09 in video)

https://github.com/ppy/osu/assets/17859747/6532a465-56f9-4f8c-88ee-7c03766958d8

Video showing a stutter near end of approach circle then audio sync becoming correct after a break on https://osu.ppy.sh/beatmapsets/1530096#osu/3435055 (at 00:06 in video)

https://github.com/ppy/osu/assets/17859747/68e00dff-1c26-48dd-a058-4cba7cdfde35

Video showing a stutter with the frame statistics overlay visible on https://osu.ppy.sh/beatmapsets/211586#osu/497556 (at 00:05 in video)

https://github.com/ppy/osu/assets/17859747/1143d621-230d-4c13-9326-335682135420

Logs

Exported after a single play with this issue

compressed-logs.zip

peppy commented 10 months ago

Thanks for the report, but we're already aware of how to repro this and we are just waiting on having enough time to fix it.

Theighlin commented 10 months ago

Heads up that https://github.com/ppy/osu-framework/pull/6088 fixes the issue for me (Tested on more than 1 map and even a couple from OP) Release

https://github.com/ppy/osu/assets/53081750/73702ca0-999c-4e76-9753-e22e85d73a89

PR

https://github.com/ppy/osu/assets/53081750/25a12519-9f48-4f0b-b9bd-a4e0f4d60028

peppy commented 10 months ago

I suspect the top level audio mixer does heavy lifting here, and may solve the issue on other platforms when we do the same there (although it's arguably worse on window than anywhere else, so this is already a relief).

mattborkin commented 6 months ago

This happens to me with the lazer release when playing Osu! mania as well.

I believe I read above that the issue happens when the notes start right away without an empty space ahead of it. That being the case, could a quick fix be to simply somehow add blank space and silence before every track automatically?

peppy commented 6 months ago

could a quick fix be to simply somehow add blank space and silence before every track automatically?

Touched upon in https://github.com/ppy/osu/issues/22488#issuecomment-1413273074.

mattborkin commented 6 months ago

could a quick fix be to simply somehow add blank space and silence before every track automatically?

Touched upon in https://github.com/ppy/osu/issues/22488#issuecomment-1413273074.

Good call, thank you!