Skip to content

Breaking changes

Joseph Madamba edited this page Apr 1, 2023 · 1 revision

Occasionally we will make changes which require custom rulesets to make amendments to maintain compatibility. Wherever possible, we maintain compatibility via [Obsolete] attributes, but it is encouraged that you leave obsolete warnings turned on, and deal with them sooner rather than later. Generally we aim to leave obsolete methods around for 3-6 months after obsoletion.

This page serves to give a list of all breaking/major changes.

vNext

Localisation support added for string return type methods

Mod.Description type has been changed

    // ...
-   public override string Description => "...";
+   public override LocalisableString Description => "...";
    // ...

ResumeOverlay.Message type has been changed

    // ...
-   protected override string Message => "...";
+   protected override LocalisableString Message => "...";
    // ...

Ruleset.GetDisplayNameForHitResult(HitResult) type has been changed

    // ...
-   public override string GetDisplayNameForHitResult(HitResult result)
+   public override LocalisableString GetDisplayNameForHitResult(HitResult result)
    // ...

Ruleset.GetVariantName(int variant) type has been changed

    // ...
-   public override string GetVariantName(int variant)
+   public override LocalisableString GetVariantName(int variant)
    // ...

PerformanceCalculator method signatures have changed

The PerformanceCalculator signature has changed a bit in order for performance calculators to be constructed less during critical code paths. Refer to the following diff for required changes:

// Constructor signature.
- ctor(Ruleset ruleset, DifficultyAttributes attributes, ScoreInfo score);
+ ctor();

// These are the methods that actually perform the calculation:
- public virtual PerformanceAttributes Calculate();
+ protected virtual PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes);

// Helper methods to calculate performance:
+ public PerformanceAttributes Calculate(ScoreInfo score, DifficultyAttributes attributes);
+ public PerformanceAttributes Calculate(ScoreInfo score, IWorkingBeatmap beatmap);

// Ruleset API:
- public PerformanceCalculator CreatePerformanceCalculator(IWorkingBeatmap beatmap, ScoreInfo score);
- public virtual PerformanceCalculator CreatePerformanceCalculator(DifficultyAttributes attributes, ScoreInfo score);
+ public virtual PerformanceCalculator CreatePerformanceCalculator();

ScoreProcessor now requires a Ruleset construction parameter

Migration is simple: define a constructor on custom ScoreProcessor implementations and pass an instance of your Ruleset to the base constructor.

FramedReplayInputHandler.CollectPendingInputs renamed to FramedReplayHandler.CollectReplayInputs

Accessibility has also changed from public to protected, however the rest of the method signature remains identical and a simple find-replace can be used to fix existing usages.