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

Make BeatmapAttributeText to have mod-relevant info #29151

Closed
wants to merge 15 commits into from

Conversation

Givikap120
Copy link
Contributor

@Givikap120 Givikap120 commented Jul 27, 2024

As you can see, current BeatmapAttributeText takes the data directly from the beatmap class. For something like beatmap name it's fine, but for example Star Rating will quickly become irrelevant if you will switch Ruleset or enable some Mods.

This PR fixes this by changing the update logic of such attributes as:

  • BPM
  • Length
  • Circle Size
  • HP Drain
  • Approach Rate
  • Overall Difficulty
    They will be updated on: Beatmap change, Ruleset change, Mod change, Mod Setting change.

In the separate branch of logic (only on Beatmap change) will be updated such attributes as:

  • Star Rating
  • (new) Max Performance, aka pp for SS. This attribute was requested by many players.
    Those attributes are updated via BindableDifficulty.

For Max Performance attribute to work, code for simulating SS play was moved from PerformanceBreakdownCalculator to the corresponding util function in the newly created ScoreUtils class.

As bdach requested, attributes text data will be updated according to the category of current attribute (for performance reasons).

@bdach
Copy link
Collaborator

bdach commented Jul 27, 2024

So this is just adding a bunch of new components that respect mods? And BeatmapAttributeText continues to not do so?

I cannot accept that premise. To me this PR is not valid because it does not do the right thing.

BeatmapAttributeText exists now and users are using it. So it must be made to work correctly. Or something has to be done silently for users to keep their skins working.

@Givikap120
Copy link
Contributor Author

So this is just adding a bunch of new components that respect mods? And BeatmapAttributeText continues to not do so?

I cannot accept that premise. To me this PR is not valid because it does not do the right thing.

BeatmapAttributeText exists now and users are using it. So it must be made to work correctly. Or something has to be done silently for users to keep their skins working.

So you propose changing BeatmapAttributeText to respect mods?
If yes - the only question is what to do with toggle AccountForRate that makes AR and OD rate-adjusted?
Are there a way to hide a toggle if selected something other than AR/OD?
Or just remove it in general

@bdach
Copy link
Collaborator

bdach commented Jul 28, 2024

the only question is what to do with toggle AccountForRate that makes AR and OD rate-adjusted?
Are there a way to hide a toggle if selected something other than AR/OD?
Or just remove it in general

Either use a different placeholder for not rate-adjusted AR/OD or just use rate-adjusted always. It's not like the mod select display has a toggle for accounting for rate or not is it?

@Givikap120 Givikap120 changed the title Add mod-sensitive beatmap attributes display into skinning Make BeatmapAttributeText to have mod-relevant info Jul 28, 2024
@Givikap120
Copy link
Contributor Author

Givikap120 commented Jul 28, 2024

So this is just adding a bunch of new components that respect mods? And BeatmapAttributeText continues to not do so?

I cannot accept that premise. To me this PR is not valid because it does not do the right thing.

BeatmapAttributeText exists now and users are using it. So it must be made to work correctly. Or something has to be done silently for users to keep their skins working.

Change PR according to this. Now new tests are required?

@Givikap120
Copy link
Contributor Author

Changed the logic to make it update only necessary info instead of all
Still some room for optimization, but the effect is not worth it for extra complexity

@peppy
Copy link
Member

peppy commented Aug 8, 2024

Please update the PR description to explain in detail what this does. Users need documentation of this in changelogs and I'm not going to go through and do this myself from the code.

@Givikap120
Copy link
Contributor Author

Please update the PR description to explain in detail what this does. Users need documentation of this in changelogs and I'm not going to go through and do this myself from the code.

made detailed description

@peppy peppy self-requested a review August 9, 2024 09:12
@peppy
Copy link
Member

peppy commented Aug 9, 2024

How are you testing this btw? There doesn't look to be a test scene setup.

/// <param name="beatmap">Beatmap, on which perfect play will be simulated</param>
/// <param name="ruleset">Ruleset, for which perfect play will be simulated</param>
/// <param name="mods">(Optional) set of mods that will be accounted for in simulation</param>
/// <param name="baseScore">(Optional) score that will be used as a base</param>
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this parameter.

[Resolved]
private BeatmapDifficultyCache difficultyCache { get; set; } = null!;

private Bindable<StarDifficulty?>? bindableDifficulty;
Copy link
Member

Choose a reason for hiding this comment

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

null null? no thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bindable<StarDifficulty?> is the return type of difficultyCache.GetBindableDifficulty
And this Bindable is not always set (it will be created only when Attribute is StarRating or MaxPerformance)
Because of this Bindable is nullable
How it can be made in a different way? I don't quite understand

osu.Game/Skinning/Components/BeatmapAttributeText.cs Outdated Show resolved Hide resolved
osu.Game/Skinning/Components/BeatmapAttributeText.cs Outdated Show resolved Hide resolved

private async Task<double> calculateMaxPerformance(DifficultyAttributes? difficultyAttributes)
{
if (difficultyAttributes == null || cancellationTokenSource == null)
Copy link
Member

Choose a reason for hiding this comment

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

huh? what's is this supposed to imply?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sanity check so it will not try to calculate pp if something happened during difficultyAttributes calculation (either cancelled or error)

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BeatmapAttributeText are not affected by mods
4 participants