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

Implemented IDifficultyCalculatorBeatmap to move diffcalc-specific functions into specific classes #29989

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Givikap120
Copy link
Contributor

Part of this PR - #29482

Calculation of MaxCombo and ObjectsCount time complexity is changed from O(t^2) to O(t) for progressive calculation.
This significantly cuts the time of TimedDifficultyAttributes calculation.

@bdach
Copy link
Collaborator

bdach commented Sep 25, 2024

With this sort of thing and #28473 I do worry a bit if IBeatmap isn't growing out of control. But I haven't been able to get a conclusion on that other one so...

@smoogipoo
Copy link
Contributor

I agree with @bdach, maybe difficulty calculators shouldn't use IBeatmap, and provide their own interface instead?

@Givikap120
Copy link
Contributor Author

I agree with @bdach, maybe difficulty calculators shouldn't use IBeatmap, and provide their own interface instead?

Does this mean that I should remade it to add something like IDiffucultyCalculationBeatmap?
Or this still needs some discussion.

@bdach
Copy link
Collaborator

bdach commented Sep 25, 2024

I agree with @bdach, maybe difficulty calculators shouldn't use IBeatmap, and provide their own interface instead?

Last I tried this avenue (exactly when exploring solutions to #28473, mind) I ended up with a bunch of generic badness. The primary problem here is WorkingBeatmap.GetBeatmap(), which firmly chains itself to IBeatmap. After which point it's rather difficult to do any lateral movement wrt interface separation without either ugly yolo casting, or sprinkling in generic badness (WorkingBeatmap.GetBeatmap<TBeatmap>()....????) Then there's also beatmap conversion which is another level of the same...

@smoogipoo
Copy link
Contributor

@bdach I don't think that's going to be relevant here because the IBeatmap in this case is post-WorkingBeatmap.GetPlayableBeatmap(). I just see it wrapping whatever IBeatmap results from the former, as:

// Difficulty calculators internally will use this
interface IDifficultyCalculatorBeatmap : IBeatmap
{
}

// Private implementation, could either house stuff to do with progressive difficulty, or be overridden to do as such.
private class DifficultyCalculatorBeatmap : IDifficultyCalculatorBeatmap
{
    public DifficultyCalculatorBeatmap(IBeatmap baseBeatmap) { }
    // Delegations to baseBeatmap, or custom implementation for progressive difficulty.
}

At least, I can't see why this wouldn't work in principle. I suggest you try going down this route and see if anything blocking comes up - if it does then it needs more discussion because I would hope things to be this simple.

@bdach
Copy link
Collaborator

bdach commented Sep 25, 2024

If I understand your proposal correctly this sort of decorator pattern probably works. If it does, then sure I guess. I might have overlooked that.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Sep 27, 2024
@Givikap120 Givikap120 changed the title Moved Diffcalc-Related Extensions to IBeatmap to allow for progressive calculation Implemented IDifficultyCalculationBeatmap to move diffcalc-specific functions into specific classes Sep 27, 2024
@Givikap120 Givikap120 changed the title Implemented IDifficultyCalculationBeatmap to move diffcalc-specific functions into specific classes Implemented IDifficultyCalculatorBeatmap to move diffcalc-specific functions into specific classes Sep 27, 2024
@Givikap120
Copy link
Contributor Author

BIG WARNING
this will most likely break all the custom rulesets, as DifficultyCalculator.CreateDifficultyAttributes signature is changed and now has IDifficultyCalculationBeatmap instead of IBeatmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants