Skip to content

Fix lack of encode-decode stability when writing out mania beatmaps with some key counts#37256

Merged
peppy merged 8 commits intoppy:masterfrom
bdach:key-count-decode-encode
Apr 10, 2026
Merged

Fix lack of encode-decode stability when writing out mania beatmaps with some key counts#37256
peppy merged 8 commits intoppy:masterfrom
bdach:key-count-decode-encode

Conversation

@bdach
Copy link
Copy Markdown
Collaborator

@bdach bdach commented Apr 10, 2026

Closes #37232.

The actual fix is e959b20; everything else is window dressing / test harness to ensure I don't try and do a wrong change like #37251 did. I recommend reviewing commit-by-commit.

See this desmos for visual explanation of change, I think it does a better job at explaining this than any words I could type here.

Of note:

  • In the end this did only affect 14K but that should never be assumed when floating point is involved.

  • Test cases generated here were generated in stable manually.

  • Except for 11 / 13 / 15 / 17K which are not officially supported and which don't work in lazer due to orthogonal reasons (see comment added in this PR in ManiaBeatmapConverter), decoding in lazer was always fine.

  • My worry was that the old encoding method before this PR could potentially cause stable to move a note from one column to another but thankfully that is not the case. The old method of encoding columns as X positions does not cause issues wherein lazer reads them back differently than stable after encode.

    I checked this by checking out master, re-encoding all of the test stair-pattern nK beatmaps added in this PR on master, exporting that as compatibility, re-importing to stable, and cross-checking that the decoded beatmap is visually the same on lazer and on stable.

    This is important to check because if this wasn't the case, we'd potentially have cases of actual online beatmaps (remember that we have BSS now) wherein a beatmap plays differently on stable than on lazer due to notes moving between columns, and would need to screen for this being the case and potentially apply corrective / reconciliatory action.

@bdach bdach requested a review from smoogipoo April 10, 2026 11:32
@bdach bdach self-assigned this Apr 10, 2026
@bdach bdach added the area:beatmap parsing .osu file format parsing label Apr 10, 2026
@bdach bdach changed the title Key count decode encode Fix lack of encode-decode stability when writing out mania beatmaps with some key counts Apr 10, 2026
smoogipoo
smoogipoo previously approved these changes Apr 10, 2026
Copy link
Copy Markdown
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actual fix looks sane

@peppy peppy merged commit 6231e06 into ppy:master Apr 10, 2026
7 of 10 checks passed
@github-project-automation github-project-automation bot moved this from Inbox to Done in osu! team task tracker Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:beatmap parsing .osu file format parsing size/XXL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

The osu!lazer beatmap editor may save incorrectly when editing 10+ key beatmaps.

3 participants