Skip to content

Conversation

@bdach
Copy link
Collaborator

@bdach bdach commented Jun 10, 2025

Mostly closes #33505.

Compare

Vector2 pos =
formatVersion >= LegacyBeatmapEncoder.FIRST_LAZER_VERSION
? new Vector2(Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE))
: new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));

I say "mostly" here because I'm rather skeptical that this is 100% rock solid still, for one reason - namely that the game stores path control point coordinates relative to the head in memory, then turns them into absolute coordinates when encoding, and then on decoding turns them back into coordinates relative to the head, which in floating-point world is a Bad Idea because of round-off error. But I'm not fixing that without introducing a completely new beatmap format or rewriting half the editor to address that, so I'll just pretend that I don't know any of this until someone notices.

Not sure if we want to run any diffcalc here to validate this.

bdach added 2 commits June 10, 2025 13:49
…point coordinates

Mostly closes ppy#33505.

Compare

	https://github.com/ppy/osu/blob/97e6187f0d7c3dbee896596a623e34627135bf0e/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs#L56-L59

I say "mostly" here because I'm rather skeptical that this is 100% rock
solid still, for one reason - namely that the game stores path control
point coordinates relative to the head, then turns them into absolute
coordinates when encoding, and then on decoding turns them back into
coordinates relative to the head, which in floating-point world is a Bad
Idea because of round-off error. But I'm not fixing that without
introducing a completely new beatmap format or rewriting half the
editor to address that, so I'll just pretend that I don't know any
of this until someone notices.
@bdach bdach requested a review from a team June 10, 2025 12:16
@bdach bdach self-assigned this Jun 10, 2025
@bdach bdach added the area:beatmap parsing .osu file format parsing label Jun 10, 2025
@bdach bdach changed the title Fix lack of slider encode-decode stability due to truncating control point coordinates Fix lack of slider encode-decode stability due to truncating control point coordinates on decode Jun 10, 2025
{
string[] vertexSplit = value.Split(':');

Vector2 pos = new Vector2((int)Parsing.ParseDouble(vertexSplit[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(vertexSplit[1], Parsing.MAX_COORDINATE_VALUE)) - startPos;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm reasonably confident that ParseDouble() was gratuitous here because IHas[XY]?Position are all single precision-based anyway.

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/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some sliders may "unwind" themselves when saving and re-entering editor

2 participants