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

Fix PP not being calculated correctly for nightcore scores #186

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

bdach
Copy link
Contributor

@bdach bdach commented Oct 19, 2023

I guess this would be one way to roll forward with ppy/osu#24640, but there is a chance something somewhere else could have relied on the inheritance and might now break, so not sure whether this should be the solution here...

Check is slightly rewritten since it wasn't making much sense to me previously (why add nightcore to allowed mods if double time is selected?)

I guess this would be one way to roll forward with
ppy/osu#24640, but there is a chance something
somewhere else could have relied on the inheritance and might now break,
so not sure whether this should be the solution here...

Check is slightly rewritten since it wasn't making much sense to me
previously (why add nightcore to allowed mods if double time is
selected?)
@peppy
Copy link
Sponsor Member

peppy commented Oct 20, 2023

Can I get an ELI5 of how this fixes things?

@bdach
Copy link
Contributor Author

bdach commented Oct 20, 2023

CreateDifficultyModCombinations() will generally only output combinations with double time and ignore nightcore, on the basis that the two are interchangeable. But these two methods don't generally want to drop nightcore, so the logic goes that if a score has nightcore on it and DT is otherwise allowed, then add NC to the set of allowed mods, as it wouldn't generally be there due to the aforementioned method ignoring its existence.

This broke because we removed the ModNightcore : ModDoubleTime inheritance.

@peppy
Copy link
Sponsor Member

peppy commented Oct 20, 2023

To confirm, IsSubclassOf is basically a synonym for what was already there, right?

@smoogipoo
Copy link
Contributor

smoogipoo commented Oct 20, 2023

One thing that could be considered here is to take this implementation (which has tests) and do a conversion of Mod[] -> Ruleset.ConvertToLegacyMods() -> MaskRelevantMods() -> ConvertFromLegacyMods()

The reasoning is that the MaskRelevantMods() method is used for looking up database attributes, so it must match one of the values of DifficultyCalculator.DifficultyAdjustmentMods().

I'd even suggest moving that to the base game project.

@bdach
Copy link
Contributor Author

bdach commented Oct 20, 2023

To confirm, IsSubclassOf is basically a synonym for what was already there, right?

Not really. That part is checking if double time is in allowedMods at all. It doesn't really correspond to anything in the old code, as the old code just seemed to assume double time will always be in allowedMods and just blindly added nightcore whenever encountering it (...or double time, which is similarly weird).

One thing that could be considered here is to take this implementation (...)

Sure, I'm not opposed. Especially so that it will maybe help us spot this sort of thing earlier in future due to avoiding cross project dependencies.

@peppy
Copy link
Sponsor Member

peppy commented Oct 20, 2023

Not really. That part is checking if double time is in allowedMods at all

Right, I missed the variable change at the start...

@peppy peppy requested a review from smoogipoo October 20, 2023 06:09
Copy link
Contributor

@smoogipoo smoogipoo left a comment

Choose a reason for hiding this comment

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

Silly GitHub... I had a pending review comment, but it's not critical.

Comment on lines -81 to 82
if (mods.Any(m => m is ModDoubleTime))
if (allowedMods.Any(type => type.IsSubclassOf(typeof(ModDoubleTime))) && mods.Any(m => m is ModNightcore))
allowedMods.Add(allMods.Single(m => m is ModNightcore).GetType());
Copy link
Contributor

Choose a reason for hiding this comment

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

I propose we remove this condition altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...by adding nightcore to DifficultyAdjustmentMods game-side, I presume? I'm not sure how you'd preserve behaviour otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking it could be added unconditionally to allowedMods here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmmmmmmm I think I prefer what's already here. You're probably right that unconditionally adding wouldn't probably ever be a problem but it is what it is.

@smoogipoo smoogipoo merged commit 7dec1f1 into ppy:master Oct 24, 2023
3 checks passed
@bdach bdach deleted the fix-nightcore-pp branch October 24, 2023 10:13
MrHeliX pushed a commit to MrHeliX/osu-tools that referenced this pull request Jun 5, 2024
Fix PP not being calculated correctly for nightcore scores
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

osu!lazer Difficulty Calculation Through osu-tools Produces Incorrect Values on ppy/master
3 participants