Fix OsuAutoGenerator failing to alternate when objects are exactly 50ms apart#36227
Merged
peppy merged 3 commits intoppy:masterfrom Jan 5, 2026
Merged
Conversation
…is exactly zero. Previously, there if two consecutive hitobjects were 50ms apart both mechanisms to make sure that the input buttons are alternated would fail. This produced a replay frame which lifts the current button, followed by a frame which presses the same button again, at the same time as it was lifted. The key-up frame would always get skipped without frame-stability, leading to hitsounds and hit animations not getting played in the editor.
…t the same time as current frame
Member
This was attempted at least once before by someone, but from recollection it read even worse 😅 |
peppy
approved these changes
Jan 5, 2026
This was referenced Jan 19, 2026
This was referenced Jan 28, 2026
This was referenced Feb 9, 2026
This was referenced Feb 12, 2026
This was referenced Mar 4, 2026
This was referenced Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36213, closes #22353
Probably also resolves several comments on #26559 (osu-ruleset only, anything mention maps with 150 or 300bpm)
Currently, if 2 objects are exactly 50ms (1/4 at 300bpm) apart the autoplay generator will generate frames that make it impossible to hit the second object without frame-stability, leading to hitsounds & hit animations not working in the editor for those objects.
There's a combination of 3 things happening that cause this problem, fixing either one of them fixes the problem.
AutoGenerator.KEY_UP_DELAY) after an object's end time into the replay.If the next object starts before this key-up frame, that frame is later removed when the next object's click frames are generated.
If the objects are exactly 50ms apart the next frame and the key-up frame will have the exact same time.
buttonIndexwill only be incremented when the difference between the current and last frame is greater than 0, effectively disabling alternating if the objects are <= 50ms apart.Basically, at exactly 50ms both mechanisms that ensure alternating don't work and the generated replay will put the key-down frame at the exact same time as the key-up frame and will use the exact same button as for the previous object. Without frame stability (i.e. in the editor) the key-up frame will always be skipped.
As far as I can tell there's 3 (relatively simple) ways to fix this:
I opted with the second fix because there's another bug in the same method that should also be fixed:
osu/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs
Line 248 in b6dc646
This statement has the same issue. It's purpose is to interpolate the previouss frame's position if it is too close to the current frame, except it won't get interpolated when the difference is 0. This leads to the cursor teleporting to the object at it's start time:
2026-01-05.03-08-05.mov
A better long-term solution would probably to simplify the autoplay generator so it doesn't take several hours of debugging to figure out what half of the code in it actually does but that's for another time.
Before:
2026-01-05.03-01-05.mov
2026-01-05.03-06-19.mov
After:
2026-01-05.03-00-55.mov
2026-01-05.03-07-16.mov