Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add countdown settings to beatmap info #14480

Merged
merged 4 commits into from
Aug 25, 2021
Merged

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Aug 24, 2021

By which I mean the countdown type (currently there's only an on-off bool) as well as the offset. For reference, see wiki.

PRing this separately due to sheer line count (97% of which is the autogenerated database migration).

With regard to the countdown type, I started off with the existing bool + a separate CountdownSpeed? field, but it was kind of awkward in handling in the decoder and encoder, so in this variant the two are just merged into a single CountdownType (which is something stable also does).

When it comes to the bool -> int change of Countdown on the database side, sqlite doesn't have booleans anyway, so it was an INTEGER all along. It should not be a breaking change, and I've tested that it doesn't break, but if it's considered too risky I'll split back into two fields.

All that said I recommend exercising caution and making database backups just in case if someone is to test this. The reason I'm saying that is because I accidentally nuked my local db by switching between the first and second iteration of this pull and forgetting to tear down the migration from v1 before running v2. I would PR a change that makes the game copy out client.db to a backup file before nuking if migrations fail on launch, but I'm unsure whether that's wasted effort on EF at this point.

@bdach bdach added area:beatmap-parsing .osu file format parsing realm deals with local realm database labels Aug 24, 2021
@bdach bdach changed the title Add countdown settings to beatmap info Add countdown settings to beatmap info Aug 24, 2021
Comment on lines +1 to +5
osu file format v14

[General]
Countdown: 2
CountdownOffset: 3
Copy link
Collaborator Author

@bdach bdach Aug 24, 2021

Choose a reason for hiding this comment

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

This beatmap file is implicitly used for test coverage in LegacyBeatmapEncoderTest.TestEncodeDecodeStability (it uses all .osu files from test resources).

@@ -95,6 +94,9 @@ public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable, IHasPrima
public bool WidescreenStoryboard { get; set; }
public bool EpilepsyWarning { get; set; }

public CountdownType Countdown { get; set; } = CountdownType.Normal;
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Hmm, not sure this actually needs to be at a BeatmapInfo level. It could potentially just exist in Beatmap. The question is how we want to handle this kind of beatmap-level settings going forward I guess, and whether they should all exist in the database or only at parse-time.

Same can be said for many other variables in this class, so it might not need immediate action – just mentioning it while we're here.

Copy link
Collaborator Author

@bdach bdach Aug 25, 2021

Choose a reason for hiding this comment

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

It doesn't necessarily need to be on BeatmapInfo, true. I was mostly following precedent at this point (the fact that there was a countdown setting there already, and even ignoring that, these two would be the only non-databased settings on the setup screen side from combo colours).

I won't claim to have any insight on which way will be best eventually. Technically an implementation of the countdown (which doesn't exist yet) shouldn't need this databased, decoding would do just fine.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I think eventually we'd see only properties that are relevant outside of gameplay in BeatmapInfo, but as you say, it's probably fine to leave this here for now and move them all in bulk.

@@ -95,6 +94,9 @@ public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable, IHasPrima
public bool WidescreenStoryboard { get; set; }
public bool EpilepsyWarning { get; set; }

public CountdownType Countdown { get; set; } = CountdownType.Normal;
public int CountdownOffset { get; set; }
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

We should probably start xmldoc'ing these. I have no idea what this means, and there doesn't seem to be a usage of it yet which makes it hard to infer meaning. I'm guessing this is the number of... beats to offset the countdown by? Not sure on directionality though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct, this setting moves the start of the countdown N beats back. I'll add xmldoc to these if they don't end up slated for removal from the db model after all (as per the other comment).

@peppy peppy enabled auto-merge August 25, 2021 04:25
@peppy peppy disabled auto-merge August 25, 2021 05:38
@peppy peppy merged commit 6a1cf12 into ppy:master Aug 25, 2021
@bdach bdach deleted the countdown-beatmap-info branch August 25, 2021 06:20
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 realm deals with local realm database size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants