From e25642b48472789aaffa5254106d763a4cee9cad Mon Sep 17 00:00:00 2001 From: StanR Date: Mon, 15 Jul 2024 14:45:31 +0500 Subject: [PATCH 01/29] Implement a bunch of rhythm difficulty calculation fixes --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 103 ++++++++++++++---- .../Preprocessing/OsuDifficultyHitObject.cs | 11 +- 2 files changed, 90 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index f2218a89a755..39c7572c85a1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; @@ -10,21 +12,65 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { public static class RhythmEvaluator { - private const int history_time_max = 5000; // 5 seconds of calculatingRhythmBonus max. - private const double rhythm_multiplier = 0.75; + private readonly struct Island : IEquatable + { + public Island() + { + } + + public Island(int firstDelta, double epsilon) + { + AddDelta(firstDelta, epsilon); + } + + public List Deltas { get; } = new List(); + + public void AddDelta(int delta, double epsilon) + { + int existingDelta = Deltas.FirstOrDefault(x => Math.Abs(x - delta) >= epsilon); + + Deltas.Add(existingDelta == default ? delta : existingDelta); + } + + public double AverageDelta() => Math.Max(Deltas.Average(), OsuDifficultyHitObject.MIN_DELTA_TIME); + + public override int GetHashCode() + { + // we need to compare all deltas and they must be in the exact same order we added them + string joinedDeltas = string.Join(string.Empty, Deltas); + return joinedDeltas.GetHashCode(); + } + + public bool Equals(Island other) + { + return other.GetHashCode() == GetHashCode(); + } + + public override bool Equals(object? obj) + { + return obj?.GetHashCode() == GetHashCode(); + } + } + + private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. + private const double rhythm_multiplier = 1.14; + private const int max_island_size = 7; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . /// public static double EvaluateDifficultyOf(DifficultyHitObject current) { + Dictionary islandCounts = new Dictionary(); + if (current.BaseObject is Spinner) return 0; - int previousIslandSize = 0; - double rhythmComplexitySum = 0; - int islandSize = 1; + + var island = new Island(); + var previousIsland = new Island(); + double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms bool firstDeltaSwitch = false; @@ -50,6 +96,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double currDelta = currObj.StrainTime; double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; + double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); @@ -58,12 +105,17 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double effectiveRatio = windowPenalty * currRatio; + double deltaDifferenceEpsilon = currObj.HitWindowGreat * 0.3; + if (firstDeltaSwitch) { - if (!(prevDelta > 1.25 * currDelta || prevDelta * 1.25 < currDelta)) + if (!(Math.Abs(prevDelta - currDelta) > deltaDifferenceEpsilon)) { - if (islandSize < 7) - islandSize++; // island is still progressing, count size. + if (island.Deltas.Count < max_island_size) + { + // island is still progressing + island.AddDelta((int)currDelta, deltaDifferenceEpsilon); + } } else { @@ -73,33 +125,44 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) if (prevObj.BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle effectiveRatio *= 0.25; - if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet) - effectiveRatio *= 0.25; - - if (previousIslandSize % 2 == islandSize % 2) // repeated island polartiy (2 -> 4, 3 -> 5) + if (previousIsland.Deltas.Count % 2 == island.Deltas.Count % 2) // repeated island polartiy (2 -> 4, 3 -> 5) effectiveRatio *= 0.50; - if (lastDelta > prevDelta + 10 && prevDelta > currDelta + 10) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. + if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. effectiveRatio *= 0.125; - rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay * Math.Sqrt(4 + islandSize) / 2 * Math.Sqrt(4 + previousIslandSize) / 2; + if (islandCounts.ContainsKey(island)) + { + islandCounts[island]++; + + // repeated island (ex: triplet -> triplet) + double power = Math.Max(0.75, logistic(island.AverageDelta(), 3, 0.15, 9)); + effectiveRatio *= Math.Pow(1.0 / islandCounts[island], power); + } + else + { + islandCounts.Add(island, 1); + } + + rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay; startRatio = effectiveRatio; - previousIslandSize = islandSize; // log the last island size. + previousIsland = island; - if (prevDelta * 1.25 < currDelta) // we're slowing down, stop counting + if (prevDelta + deltaDifferenceEpsilon < currDelta) // we're slowing down, stop counting firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size. - islandSize = 1; + island = new Island((int)currDelta, deltaDifferenceEpsilon); } } - else if (prevDelta > 1.25 * currDelta) // we want to be speeding up. + else if (prevDelta > currDelta + deltaDifferenceEpsilon) // we want to be speeding up. { // Begin counting island until we change speed again. firstDeltaSwitch = true; startRatio = effectiveRatio; - islandSize = 1; + + island = new Island((int)currDelta, deltaDifferenceEpsilon); } lastObj = prevObj; @@ -108,5 +171,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) } + + private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - multiplier * x))); } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 0e537632b164..95535274c121 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -20,7 +20,8 @@ public class OsuDifficultyHitObject : DifficultyHitObject /// public const int NORMALISED_RADIUS = 50; // Change radius to 50 to make 100 the diameter. Easier for mental maths. - private const int min_delta_time = 25; + public const int MIN_DELTA_TIME = 25; + private const float maximum_slider_radius = NORMALISED_RADIUS * 2.4f; private const float assumed_slider_radius = NORMALISED_RADIUS * 1.8f; @@ -93,7 +94,7 @@ public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObje this.lastObject = (OsuHitObject)lastObject; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. - StrainTime = Math.Max(DeltaTime, min_delta_time); + StrainTime = Math.Max(DeltaTime, MIN_DELTA_TIME); if (BaseObject is Slider sliderObject) { @@ -143,7 +144,7 @@ private void setDistances(double clockRate) computeSliderCursorPosition(currentSlider); // Bonus for repeat sliders until a better per nested object strain system can be achieved. TravelDistance = currentSlider.LazyTravelDistance * (float)Math.Pow(1 + currentSlider.RepeatCount / 2.5, 1.0 / 2.5); - TravelTime = Math.Max(currentSlider.LazyTravelTime / clockRate, min_delta_time); + TravelTime = Math.Max(currentSlider.LazyTravelTime / clockRate, MIN_DELTA_TIME); } // We don't need to calculate either angle or distance when one of the last->curr objects is a spinner @@ -167,8 +168,8 @@ private void setDistances(double clockRate) if (lastObject is Slider lastSlider) { - double lastTravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, min_delta_time); - MinimumJumpTime = Math.Max(StrainTime - lastTravelTime, min_delta_time); + double lastTravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, MIN_DELTA_TIME); + MinimumJumpTime = Math.Max(StrainTime - lastTravelTime, MIN_DELTA_TIME); // // There are two types of slider-to-object patterns to consider in order to better approximate the real movement a player will take to jump between the hitobjects. From 67cb4a2d02e47a2c8bfd493c4def3c19538057e8 Mon Sep 17 00:00:00 2001 From: StanR Date: Mon, 15 Jul 2024 22:54:25 +0500 Subject: [PATCH 02/29] InspectCode --- osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 39c7572c85a1..60bc53e7a134 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -172,6 +172,6 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) } - private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - multiplier * x))); + private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - (multiplier * x)))); } } From bae9625b0b4785b83124bfd38ccd8ff85d74947b Mon Sep 17 00:00:00 2001 From: StanR Date: Fri, 19 Jul 2024 10:13:50 +0500 Subject: [PATCH 03/29] Make repetition nerf harsher, buff initial rhythm ratio, small refactoring --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 60bc53e7a134..9c48af80a73a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -32,7 +32,14 @@ public void AddDelta(int delta, double epsilon) Deltas.Add(existingDelta == default ? delta : existingDelta); } - public double AverageDelta() => Math.Max(Deltas.Average(), OsuDifficultyHitObject.MIN_DELTA_TIME); + public double AverageDelta() => Deltas.Count > 0 ? Math.Max(Deltas.Average(), OsuDifficultyHitObject.MIN_DELTA_TIME) : 0; + + public bool IsSimilarPolarity(Island other, double epsilon) + { + // consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) + return Math.Abs(AverageDelta() - other.AverageDelta()) < epsilon && + Deltas.Count % 2 == other.Deltas.Count % 2; + } public override int GetHashCode() { @@ -53,7 +60,7 @@ public override bool Equals(object? obj) } private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. - private const double rhythm_multiplier = 1.14; + private const double rhythm_multiplier = 1.05; private const int max_island_size = 7; /// @@ -61,8 +68,6 @@ public override bool Equals(object? obj) /// public static double EvaluateDifficultyOf(DifficultyHitObject current) { - Dictionary islandCounts = new Dictionary(); - if (current.BaseObject is Spinner) return 0; @@ -70,6 +75,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) var island = new Island(); var previousIsland = new Island(); + Dictionary islandCounts = new Dictionary(); double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms @@ -97,7 +103,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 10.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); @@ -125,23 +131,19 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) if (prevObj.BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle effectiveRatio *= 0.25; - if (previousIsland.Deltas.Count % 2 == island.Deltas.Count % 2) // repeated island polartiy (2 -> 4, 3 -> 5) + if (island.IsSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) // repeated island polartiy (2 -> 4, 3 -> 5) effectiveRatio *= 0.50; if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. effectiveRatio *= 0.125; - if (islandCounts.ContainsKey(island)) + if (!islandCounts.TryAdd(island, 1)) { islandCounts[island]++; // repeated island (ex: triplet -> triplet) - double power = Math.Max(0.75, logistic(island.AverageDelta(), 3, 0.15, 9)); - effectiveRatio *= Math.Pow(1.0 / islandCounts[island], power); - } - else - { - islandCounts.Add(island, 1); + double power = logistic(island.AverageDelta(), 4, 0.165, 10); + effectiveRatio *= Math.Min(1.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); } rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay; From c1532bcb570ae36d7a73d5b42e451b8c7325b111 Mon Sep 17 00:00:00 2001 From: StanR Date: Fri, 19 Jul 2024 11:01:42 +0500 Subject: [PATCH 04/29] Reduce base ratio a bit --- osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 9c48af80a73a..ba77bc6a61f4 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -103,7 +103,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 10.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 8.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); From 3acd00b9b703a0a5a7445192eabac94bfe385594 Mon Sep 17 00:00:00 2001 From: StanR Date: Sat, 10 Aug 2024 22:30:24 +0500 Subject: [PATCH 05/29] Tweak some values --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index ba77bc6a61f4..d2f58925cd92 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -60,7 +60,7 @@ public override bool Equals(object? obj) } private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. - private const double rhythm_multiplier = 1.05; + private const double rhythm_multiplier = 1.1; private const int max_island_size = 7; /// @@ -103,7 +103,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 8.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 8.4 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); @@ -132,7 +132,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) effectiveRatio *= 0.25; if (island.IsSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) // repeated island polartiy (2 -> 4, 3 -> 5) - effectiveRatio *= 0.50; + effectiveRatio *= 0.35; if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. effectiveRatio *= 0.125; From f1adc6f98cc48024a0bb35811955fb5653c3fdf6 Mon Sep 17 00:00:00 2001 From: StanR Date: Thu, 22 Aug 2024 15:59:13 +0500 Subject: [PATCH 06/29] Don't cap max island size, make repetition nerf more lenient on high bpm, adjust balancing --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index d2f58925cd92..9ffb4fc3d75b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -60,8 +60,7 @@ public override bool Equals(object? obj) } private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. - private const double rhythm_multiplier = 1.1; - private const int max_island_size = 7; + private const double rhythm_multiplier = 1.05; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -103,7 +102,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 8.4 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 8.8 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); @@ -117,11 +116,8 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) { if (!(Math.Abs(prevDelta - currDelta) > deltaDifferenceEpsilon)) { - if (island.Deltas.Count < max_island_size) - { - // island is still progressing - island.AddDelta((int)currDelta, deltaDifferenceEpsilon); - } + // island is still progressing + island.AddDelta((int)currDelta, deltaDifferenceEpsilon); } else { @@ -143,7 +139,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // repeated island (ex: triplet -> triplet) double power = logistic(island.AverageDelta(), 4, 0.165, 10); - effectiveRatio *= Math.Min(1.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); + effectiveRatio *= Math.Min(2.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); } rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay; From ce8286d299f11a9e7c96baf67ca38d5a143239d5 Mon Sep 17 00:00:00 2001 From: StanR Date: Sat, 24 Aug 2024 04:37:58 +0500 Subject: [PATCH 07/29] Scale difficulty with doubletapness, make kicksliders not reduce the difficulty of the next object, adjust balancing --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 28 +++++++++++++------ .../Difficulty/Evaluators/SpeedEvaluator.cs | 14 +--------- .../Preprocessing/OsuDifficultyHitObject.cs | 18 ++++++++++++ 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 9ffb4fc3d75b..22b330bcaccd 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -60,7 +60,7 @@ public override bool Equals(object? obj) } private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. - private const double rhythm_multiplier = 1.05; + private const double rhythm_multiplier = 0.95; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -102,7 +102,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 8.8 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 9.8 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); @@ -121,16 +121,22 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) } else { - if (currObj.BaseObject is Slider) // bpm change is into slider, this is easy acc window + // bpm change is into slider, this is easy acc window + if (currObj.BaseObject is Slider) effectiveRatio *= 0.125; - if (prevObj.BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle - effectiveRatio *= 0.25; + // bpm change was from a slider, this is easier typically than circle -> circle + // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders + // therefore we're checking for quick sliders and don't lower the difficulty for them since they don't really make tapping easier (no time to adjust) + if (prevObj.BaseObject is Slider && prevObj.TravelTime > prevDelta * 1.5) + effectiveRatio *= 0.15; - if (island.IsSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) // repeated island polartiy (2 -> 4, 3 -> 5) - effectiveRatio *= 0.35; + // repeated island polartiy (2 -> 4, 3 -> 5) + if (island.IsSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) + effectiveRatio *= 0.3; - if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. + // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. + if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) effectiveRatio *= 0.125; if (!islandCounts.TryAdd(island, 1)) @@ -142,6 +148,10 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) effectiveRatio *= Math.Min(2.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); } + // scale down the difficulty if the object is doubletappable + double doubletapness = prevObj.GetDoubletapness((OsuDifficultyHitObject?)prevObj.Next(0)); + effectiveRatio *= 1 - doubletapness * 0.75; + rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay; startRatio = effectiveRatio; @@ -167,7 +177,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) prevObj = currObj; } - return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) + return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2.0; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) } private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - (multiplier * x)))); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index 2df383aaa891..3a264188f678 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -30,21 +30,9 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // derive strainTime for calculation var osuCurrObj = (OsuDifficultyHitObject)current; var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; - var osuNextObj = (OsuDifficultyHitObject?)current.Next(0); double strainTime = osuCurrObj.StrainTime; - double doubletapness = 1; - - // Nerf doubletappable doubles. - if (osuNextObj != null) - { - double currDeltaTime = Math.Max(1, osuCurrObj.DeltaTime); - double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime); - double deltaDifference = Math.Abs(nextDeltaTime - currDeltaTime); - double speedRatio = currDeltaTime / Math.Max(currDeltaTime, deltaDifference); - double windowRatio = Math.Pow(Math.Min(1, currDeltaTime / osuCurrObj.HitWindowGreat), 2); - doubletapness = Math.Pow(speedRatio, 1 - windowRatio); - } + double doubletapness = 1.0 - osuCurrObj.GetDoubletapness((OsuDifficultyHitObject?)osuCurrObj.Next(0)); // Cap deltatime to the OD 300 hitwindow. // 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap. diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 95535274c121..3eaf500ad7ab 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -137,6 +137,24 @@ public double OpacityAt(double time, bool hidden) return Math.Clamp((time - fadeInStartTime) / fadeInDuration, 0.0, 1.0); } + /// + /// Returns how possible is it to doubletap this object together with the next one and get perfect judgement in range from 0 to 1 + /// + public double GetDoubletapness(OsuDifficultyHitObject? osuNextObj) + { + if (osuNextObj != null) + { + double currDeltaTime = Math.Max(1, DeltaTime); + double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime); + double deltaDifference = Math.Abs(nextDeltaTime - currDeltaTime); + double speedRatio = currDeltaTime / Math.Max(currDeltaTime, deltaDifference); + double windowRatio = Math.Pow(Math.Min(1, currDeltaTime / HitWindowGreat), 2); + return 1.0 - Math.Pow(speedRatio, 1 - windowRatio); + } + + return 0; + } + private void setDistances(double clockRate) { if (BaseObject is Slider currentSlider) From ed45c947fca29fd07439e1004ce17ec3069f9021 Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 27 Aug 2024 15:50:08 +0500 Subject: [PATCH 08/29] Adjust max history by clockrate to make rhythm calculation more consistent between rates --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 24 ++++++++++--------- .../Difficulty/OsuDifficultyCalculator.cs | 2 +- .../Difficulty/Skills/Speed.cs | 6 +++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 22b330bcaccd..26f50efc721a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -60,12 +60,13 @@ public override bool Equals(object? obj) } private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. - private const double rhythm_multiplier = 0.95; + private const int history_objects_max = 32; + private const double rhythm_multiplier = 1.25; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . /// - public static double EvaluateDifficultyOf(DifficultyHitObject current) + public static double EvaluateDifficultyOf(DifficultyHitObject current, double clockRate) { if (current.BaseObject is Spinner) return 0; @@ -76,15 +77,18 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) var previousIsland = new Island(); Dictionary islandCounts = new Dictionary(); + int historyTimeMaxAdjusted = (int)Math.Ceiling(history_time_max / clockRate); + int historyObjectsMaxAdjusted = (int)Math.Ceiling(history_objects_max / clockRate); + double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms bool firstDeltaSwitch = false; - int historicalNoteCount = Math.Min(current.Index, 32); + int historicalNoteCount = Math.Min(current.Index, historyObjectsMaxAdjusted); int rhythmStart = 0; - while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max) + while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < historyTimeMaxAdjusted) rhythmStart++; OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(rhythmStart); @@ -94,7 +98,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) { OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); - double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now + double currHistoricalDecay = (historyTimeMaxAdjusted - (current.StartTime - currObj.StartTime)) / historyTimeMaxAdjusted; // scales note 0 to 1 from history to now currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count. @@ -102,16 +106,14 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 9.8 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 7.27 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. - double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3)); + double deltaDifferenceEpsilon = currObj.HitWindowGreat * 0.3; - windowPenalty = Math.Min(1, windowPenalty); + double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); double effectiveRatio = windowPenalty * currRatio; - double deltaDifferenceEpsilon = currObj.HitWindowGreat * 0.3; - if (firstDeltaSwitch) { if (!(Math.Abs(prevDelta - currDelta) > deltaDifferenceEpsilon)) @@ -145,7 +147,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // repeated island (ex: triplet -> triplet) double power = logistic(island.AverageDelta(), 4, 0.165, 10); - effectiveRatio *= Math.Min(2.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); + effectiveRatio *= Math.Min(3.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); } // scale down the difficulty if the object is doubletappable diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 007cd977e599..a5ef0764bbcd 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -134,7 +134,7 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo { new Aim(mods, true), new Aim(mods, false), - new Speed(mods) + new Speed(mods, clockRate) }; if (mods.Any(h => h is OsuModFlashlight)) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 40aac013ab8a..ae85980815fa 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Speed : OsuStrainSkill { + private readonly double clockRate; private double skillMultiplier => 1375; private double strainDecayBase => 0.3; @@ -27,9 +28,10 @@ public class Speed : OsuStrainSkill private readonly List objectStrains = new List(); - public Speed(Mod[] mods) + public Speed(Mod[] mods, double clockRate) : base(mods) { + this.clockRate = clockRate; } private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); @@ -41,7 +43,7 @@ protected override double StrainValueAt(DifficultyHitObject current) currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime); currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current) * skillMultiplier; - currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current); + currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, clockRate); double totalStrain = currentStrain * currentRhythm; From 7fda8bc95b8092124820306cab26561e66cda8fe Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 27 Aug 2024 23:48:15 +0500 Subject: [PATCH 09/29] Reduce repetition nerf for non-consecutive islands --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 26f50efc721a..9e851f11a634 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -14,19 +14,24 @@ public static class RhythmEvaluator { private readonly struct Island : IEquatable { - public Island() + private readonly double deltaDifferenceEpsilon; + + public Island(double epsilon) { + deltaDifferenceEpsilon = epsilon; } public Island(int firstDelta, double epsilon) { - AddDelta(firstDelta, epsilon); + deltaDifferenceEpsilon = epsilon; + AddDelta(firstDelta); } public List Deltas { get; } = new List(); - public void AddDelta(int delta, double epsilon) + public void AddDelta(int delta) { + double epsilon = deltaDifferenceEpsilon; int existingDelta = Deltas.FirstOrDefault(x => Math.Abs(x - delta) >= epsilon); Deltas.Add(existingDelta == default ? delta : existingDelta); @@ -34,10 +39,10 @@ public void AddDelta(int delta, double epsilon) public double AverageDelta() => Deltas.Count > 0 ? Math.Max(Deltas.Average(), OsuDifficultyHitObject.MIN_DELTA_TIME) : 0; - public bool IsSimilarPolarity(Island other, double epsilon) + public bool IsSimilarPolarity(Island other) { // consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) - return Math.Abs(AverageDelta() - other.AverageDelta()) < epsilon && + return Math.Abs(AverageDelta() - other.AverageDelta()) < deltaDifferenceEpsilon && Deltas.Count % 2 == other.Deltas.Count % 2; } @@ -61,7 +66,7 @@ public override bool Equals(object? obj) private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. private const int history_objects_max = 32; - private const double rhythm_multiplier = 1.25; + private const double rhythm_multiplier = 1.2; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -73,8 +78,10 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl double rhythmComplexitySum = 0; - var island = new Island(); - var previousIsland = new Island(); + double deltaDifferenceEpsilon = ((OsuDifficultyHitObject)current).HitWindowGreat * 0.3; + + var island = new Island(deltaDifferenceEpsilon); + var previousIsland = new Island(deltaDifferenceEpsilon); Dictionary islandCounts = new Dictionary(); int historyTimeMaxAdjusted = (int)Math.Ceiling(history_time_max / clockRate); @@ -106,9 +113,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 7.27 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. - - double deltaDifferenceEpsilon = currObj.HitWindowGreat * 0.3; + double currRatio = 1.0 + 5.8 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); @@ -119,7 +124,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl if (!(Math.Abs(prevDelta - currDelta) > deltaDifferenceEpsilon)) { // island is still progressing - island.AddDelta((int)currDelta, deltaDifferenceEpsilon); + island.AddDelta((int)currDelta); } else { @@ -131,10 +136,10 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders // therefore we're checking for quick sliders and don't lower the difficulty for them since they don't really make tapping easier (no time to adjust) if (prevObj.BaseObject is Slider && prevObj.TravelTime > prevDelta * 1.5) - effectiveRatio *= 0.15; + effectiveRatio *= 0.2; // repeated island polartiy (2 -> 4, 3 -> 5) - if (island.IsSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) + if (island.IsSimilarPolarity(previousIsland)) effectiveRatio *= 0.3; // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. @@ -143,7 +148,9 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl if (!islandCounts.TryAdd(island, 1)) { - islandCounts[island]++; + // only add island to island counts if they're going one after another + if (previousIsland.Equals(island)) + islandCounts[island]++; // repeated island (ex: triplet -> triplet) double power = logistic(island.AverageDelta(), 4, 0.165, 10); From 3398497d4b7ef41db750ba2b9db048528836ba18 Mon Sep 17 00:00:00 2001 From: StanR Date: Thu, 12 Sep 2024 01:04:07 +0500 Subject: [PATCH 10/29] Remove kickslider changes --- osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 9e851f11a634..ac38bc14e127 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -134,8 +134,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl // bpm change was from a slider, this is easier typically than circle -> circle // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders - // therefore we're checking for quick sliders and don't lower the difficulty for them since they don't really make tapping easier (no time to adjust) - if (prevObj.BaseObject is Slider && prevObj.TravelTime > prevDelta * 1.5) + if (prevObj.BaseObject is Slider) effectiveRatio *= 0.2; // repeated island polartiy (2 -> 4, 3 -> 5) From 5e8174faa881d5a54398ddd4c0226f9a18e40f92 Mon Sep 17 00:00:00 2001 From: StanR Date: Sat, 14 Sep 2024 22:03:01 +0500 Subject: [PATCH 11/29] Reduce ratio for island size 1 --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index ac38bc14e127..bd99799ee043 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -66,7 +66,7 @@ public override bool Equals(object? obj) private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. private const int history_objects_max = 32; - private const double rhythm_multiplier = 1.2; + private const double rhythm_multiplier = 1.3; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -113,7 +113,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 5.8 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); @@ -137,7 +137,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl if (prevObj.BaseObject is Slider) effectiveRatio *= 0.2; - // repeated island polartiy (2 -> 4, 3 -> 5) + // repeated island polarity (2 -> 4, 3 -> 5) if (island.IsSimilarPolarity(previousIsland)) effectiveRatio *= 0.3; @@ -145,6 +145,10 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) effectiveRatio *= 0.125; + // singletaps are easier to control + if (island.Deltas.Count == 1) + effectiveRatio *= 0.7; + if (!islandCounts.TryAdd(island, 1)) { // only add island to island counts if they're going one after another From db626f168ad294b90ea0fbb989b0fc681557b35c Mon Sep 17 00:00:00 2001 From: StanR Date: Sun, 15 Sep 2024 01:12:41 +0500 Subject: [PATCH 12/29] Refactor --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index bd99799ee043..fb1374eccf5d 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; @@ -12,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { public static class RhythmEvaluator { - private readonly struct Island : IEquatable + private struct Island : IEquatable { private readonly double deltaDifferenceEpsilon; @@ -21,41 +20,39 @@ public Island(double epsilon) deltaDifferenceEpsilon = epsilon; } - public Island(int firstDelta, double epsilon) + public Island(int delta, double epsilon) { deltaDifferenceEpsilon = epsilon; - AddDelta(firstDelta); + Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); } - public List Deltas { get; } = new List(); + public int Delta { get; private set; } + public int DeltaCount { get; private set; } public void AddDelta(int delta) { - double epsilon = deltaDifferenceEpsilon; - int existingDelta = Deltas.FirstOrDefault(x => Math.Abs(x - delta) >= epsilon); + if (Delta == default) + Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); - Deltas.Add(existingDelta == default ? delta : existingDelta); + DeltaCount++; } - public double AverageDelta() => Deltas.Count > 0 ? Math.Max(Deltas.Average(), OsuDifficultyHitObject.MIN_DELTA_TIME) : 0; - public bool IsSimilarPolarity(Island other) { // consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) - return Math.Abs(AverageDelta() - other.AverageDelta()) < deltaDifferenceEpsilon && - Deltas.Count % 2 == other.Deltas.Count % 2; + return DeltaCount % 2 == other.DeltaCount % 2 && + Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon; } public override int GetHashCode() { - // we need to compare all deltas and they must be in the exact same order we added them - string joinedDeltas = string.Join(string.Empty, Deltas); - return joinedDeltas.GetHashCode(); + return HashCode.Combine(Delta, DeltaCount); } public bool Equals(Island other) { - return other.GetHashCode() == GetHashCode(); + return Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon && + DeltaCount == other.DeltaCount; } public override bool Equals(object? obj) @@ -113,7 +110,10 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl double prevDelta = prevObj.StrainTime; double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + // calculate how much current delta difference deserves a rhythm bonus + // this function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e 100 and 200) + double deltaDifferenceRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta); + double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); @@ -121,7 +121,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl if (firstDeltaSwitch) { - if (!(Math.Abs(prevDelta - currDelta) > deltaDifferenceEpsilon)) + if (Math.Abs(prevDelta - currDelta) < deltaDifferenceEpsilon) { // island is still progressing island.AddDelta((int)currDelta); @@ -146,7 +146,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl effectiveRatio *= 0.125; // singletaps are easier to control - if (island.Deltas.Count == 1) + if (island.DeltaCount == 1) effectiveRatio *= 0.7; if (!islandCounts.TryAdd(island, 1)) @@ -156,7 +156,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl islandCounts[island]++; // repeated island (ex: triplet -> triplet) - double power = logistic(island.AverageDelta(), 4, 0.165, 10); + double power = logistic(island.Delta, 4, 0.165, 10); effectiveRatio *= Math.Min(3.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); } From 738d4bcb804e2641a73a774cdd6d329cae91a054 Mon Sep 17 00:00:00 2001 From: StanR Date: Sun, 15 Sep 2024 01:49:52 +0500 Subject: [PATCH 13/29] Reduce ratio if we're starting island counting after a slider --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index fb1374eccf5d..5732d924f9c8 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -98,6 +98,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(rhythmStart); OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(rhythmStart + 1); + // we go from the furthest object back to the current one for (int i = rhythmStart; i > 0; i--) { OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); @@ -171,15 +172,20 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl previousIsland = island; if (prevDelta + deltaDifferenceEpsilon < currDelta) // we're slowing down, stop counting - firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size. + firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size. island = new Island((int)currDelta, deltaDifferenceEpsilon); } } - else if (prevDelta > currDelta + deltaDifferenceEpsilon) // we want to be speeding up. + else if (prevDelta > currDelta + deltaDifferenceEpsilon) // we're speeding up { // Begin counting island until we change speed again. firstDeltaSwitch = true; + + // reduce ratio if we're starting after a slider + if (prevObj.BaseObject is Slider) + effectiveRatio *= 0.3; + startRatio = effectiveRatio; island = new Island((int)currDelta, deltaDifferenceEpsilon); From 863a74f9803f787872ddfec69c903d7e81be7d27 Mon Sep 17 00:00:00 2001 From: StanR Date: Sun, 15 Sep 2024 02:08:37 +0500 Subject: [PATCH 14/29] Balancing --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 5732d924f9c8..c01530194b22 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -63,7 +63,7 @@ public override bool Equals(object? obj) private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. private const int history_objects_max = 32; - private const double rhythm_multiplier = 1.3; + private const double rhythm_multiplier = 1.4; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -114,7 +114,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl // calculate how much current delta difference deserves a rhythm bonus // this function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e 100 and 200) double deltaDifferenceRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta); - double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); + double currRatio = 1.0 + 5.5 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); From 145731bdefe9b35fc89a685bbd1eca76c537d850 Mon Sep 17 00:00:00 2001 From: StanR Date: Sun, 15 Sep 2024 02:48:41 +0500 Subject: [PATCH 15/29] More balancing --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index c01530194b22..c4d78c79048e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -63,7 +63,7 @@ public override bool Equals(object? obj) private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. private const int history_objects_max = 32; - private const double rhythm_multiplier = 1.4; + private const double rhythm_multiplier = 1.32; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -114,7 +114,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl // calculate how much current delta difference deserves a rhythm bonus // this function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e 100 and 200) double deltaDifferenceRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta); - double currRatio = 1.0 + 5.5 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); + double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); From bee18b03e73ade94c43c8657ae9fa7d81887a06f Mon Sep 17 00:00:00 2001 From: StanR Date: Mon, 16 Sep 2024 00:49:36 +0500 Subject: [PATCH 16/29] Reduce history max overall instead of using clock rate --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 15 ++++++--------- .../Difficulty/OsuDifficultyCalculator.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 6 ++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index c4d78c79048e..09e90115969f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -61,14 +61,14 @@ public override bool Equals(object? obj) } } - private const int history_time_max = 5 * 1000; // 5 seconds of calculatingRhythmBonus max. - private const int history_objects_max = 32; + private const int history_time_max = 4 * 1000; // 5 seconds of calculatingRhythmBonus max. + private const int history_objects_max = 24; private const double rhythm_multiplier = 1.32; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . /// - public static double EvaluateDifficultyOf(DifficultyHitObject current, double clockRate) + public static double EvaluateDifficultyOf(DifficultyHitObject current) { if (current.BaseObject is Spinner) return 0; @@ -81,18 +81,15 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl var previousIsland = new Island(deltaDifferenceEpsilon); Dictionary islandCounts = new Dictionary(); - int historyTimeMaxAdjusted = (int)Math.Ceiling(history_time_max / clockRate); - int historyObjectsMaxAdjusted = (int)Math.Ceiling(history_objects_max / clockRate); - double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms bool firstDeltaSwitch = false; - int historicalNoteCount = Math.Min(current.Index, historyObjectsMaxAdjusted); + int historicalNoteCount = Math.Min(current.Index, history_objects_max); int rhythmStart = 0; - while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < historyTimeMaxAdjusted) + while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max) rhythmStart++; OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(rhythmStart); @@ -103,7 +100,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current, double cl { OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); - double currHistoricalDecay = (historyTimeMaxAdjusted - (current.StartTime - currObj.StartTime)) / historyTimeMaxAdjusted; // scales note 0 to 1 from history to now + double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count. diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 835f4ee196e4..e93475ecff04 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -134,7 +134,7 @@ protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clo { new Aim(mods, true), new Aim(mods, false), - new Speed(mods, clockRate) + new Speed(mods) }; if (mods.Any(h => h is OsuModFlashlight)) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index d0586662ff5f..f7f081b7eac3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -17,7 +17,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills public class Speed : OsuStrainSkill { private double skillMultiplier => 1.375; - private readonly double clockRate; private double strainDecayBase => 0.3; private double currentStrain; @@ -28,10 +27,9 @@ public class Speed : OsuStrainSkill private readonly List objectStrains = new List(); - public Speed(Mod[] mods, double clockRate) + public Speed(Mod[] mods) : base(mods) { - this.clockRate = clockRate; } private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); @@ -43,7 +41,7 @@ protected override double StrainValueAt(DifficultyHitObject current) currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime); currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current) * skillMultiplier; - currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, clockRate); + currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current); double totalStrain = currentStrain * currentRhythm; From c9ce7d29e66f8b25d4d7fad371cb78f6b88121bc Mon Sep 17 00:00:00 2001 From: StanR Date: Mon, 16 Sep 2024 01:04:46 +0500 Subject: [PATCH 17/29] Adjust multipliers --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 09e90115969f..9eae3c7a1036 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -63,7 +63,8 @@ public override bool Equals(object? obj) private const int history_time_max = 4 * 1000; // 5 seconds of calculatingRhythmBonus max. private const int history_objects_max = 24; - private const double rhythm_multiplier = 1.32; + private const double rhythm_overall_multiplier = 1.2; + private const double rhythm_ratio_multiplier = 10.0; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -111,7 +112,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // calculate how much current delta difference deserves a rhythm bonus // this function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e 100 and 200) double deltaDifferenceRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta); - double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); + double currRatio = 1.0 + rhythm_ratio_multiplier * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); @@ -192,7 +193,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) prevObj = currObj; } - return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2.0; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) + return Math.Sqrt(4 + rhythmComplexitySum * rhythm_overall_multiplier) / 2.0; // produces multiplier that can be applied to strain. range [1, infinity) (not really though) } private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - (multiplier * x)))); From 0bad5e468455ef2667015a0c0fea148143459d6d Mon Sep 17 00:00:00 2001 From: StanR Date: Thu, 19 Sep 2024 04:38:01 +0500 Subject: [PATCH 18/29] Move slider-related ratio multiplier out of the delta switch block, add nerf for ratios with delta difference fractions that are too big, adjust consts --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 9eae3c7a1036..80d75d5e6739 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -63,8 +63,8 @@ public override bool Equals(object? obj) private const int history_time_max = 4 * 1000; // 5 seconds of calculatingRhythmBonus max. private const int history_objects_max = 24; - private const double rhythm_overall_multiplier = 1.2; - private const double rhythm_ratio_multiplier = 10.0; + private const double rhythm_overall_multiplier = 1.25; + private const double rhythm_ratio_multiplier = 11.0; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -114,9 +114,22 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double deltaDifferenceRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta); double currRatio = 1.0 + rhythm_ratio_multiplier * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2)); + // reduce ratio bonus if delta difference is too big + double fraction = Math.Max(prevDelta / currDelta, currDelta / prevDelta); + double fractionMultiplier = Math.Clamp(2.0 - fraction / 8.0, 0.0, 1.0); + double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon); - double effectiveRatio = windowPenalty * currRatio; + double effectiveRatio = windowPenalty * currRatio * fractionMultiplier; + + // bpm change is into slider, this is easy acc window + if (currObj.BaseObject is Slider) + effectiveRatio *= 0.125; + + // bpm change was from a slider, this is easier typically than circle -> circle + // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders + if (prevObj.BaseObject is Slider) + effectiveRatio *= 0.2; if (firstDeltaSwitch) { @@ -127,15 +140,6 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) } else { - // bpm change is into slider, this is easy acc window - if (currObj.BaseObject is Slider) - effectiveRatio *= 0.125; - - // bpm change was from a slider, this is easier typically than circle -> circle - // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders - if (prevObj.BaseObject is Slider) - effectiveRatio *= 0.2; - // repeated island polarity (2 -> 4, 3 -> 5) if (island.IsSimilarPolarity(previousIsland)) effectiveRatio *= 0.3; @@ -180,10 +184,6 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // Begin counting island until we change speed again. firstDeltaSwitch = true; - // reduce ratio if we're starting after a slider - if (prevObj.BaseObject is Slider) - effectiveRatio *= 0.3; - startRatio = effectiveRatio; island = new Island((int)currDelta, deltaDifferenceEpsilon); From 732a114b9594d2a861709591cd74d3438afdc375 Mon Sep 17 00:00:00 2001 From: StanR Date: Thu, 19 Sep 2024 15:53:18 +0500 Subject: [PATCH 19/29] Slight refactoring --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 108 +++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 80d75d5e6739..87fc35adcd33 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -11,57 +11,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { public static class RhythmEvaluator { - private struct Island : IEquatable - { - private readonly double deltaDifferenceEpsilon; - - public Island(double epsilon) - { - deltaDifferenceEpsilon = epsilon; - } - - public Island(int delta, double epsilon) - { - deltaDifferenceEpsilon = epsilon; - Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); - } - - public int Delta { get; private set; } - public int DeltaCount { get; private set; } - - public void AddDelta(int delta) - { - if (Delta == default) - Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); - - DeltaCount++; - } - - public bool IsSimilarPolarity(Island other) - { - // consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) - return DeltaCount % 2 == other.DeltaCount % 2 && - Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon; - } - - public override int GetHashCode() - { - return HashCode.Combine(Delta, DeltaCount); - } - - public bool Equals(Island other) - { - return Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon && - DeltaCount == other.DeltaCount; - } - - public override bool Equals(object? obj) - { - return obj?.GetHashCode() == GetHashCode(); - } - } - - private const int history_time_max = 4 * 1000; // 5 seconds of calculatingRhythmBonus max. + private const int history_time_max = 4 * 1000; // 4 seconds private const int history_objects_max = 24; private const double rhythm_overall_multiplier = 1.25; private const double rhythm_ratio_multiplier = 11.0; @@ -101,9 +51,11 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) { OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); - double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now + // scales note 0 to 1 from history to now + double timeDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; + double noteDecay = (double)(historicalNoteCount - i) / historicalNoteCount; - currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count. + double currHistoricalDecay = Math.Min(noteDecay, timeDecay); // either we're limited by time or limited by object count. double currDelta = currObj.StrainTime; double prevDelta = prevObj.StrainTime; @@ -197,5 +149,55 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) } private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - (multiplier * x)))); + + private struct Island : IEquatable + { + private readonly double deltaDifferenceEpsilon; + + public Island(double epsilon) + { + deltaDifferenceEpsilon = epsilon; + } + + public Island(int delta, double epsilon) + { + deltaDifferenceEpsilon = epsilon; + Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); + } + + public int Delta { get; private set; } + public int DeltaCount { get; private set; } + + public void AddDelta(int delta) + { + if (Delta == default) + Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); + + DeltaCount++; + } + + public bool IsSimilarPolarity(Island other) + { + // consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) + return DeltaCount % 2 == other.DeltaCount % 2 && + Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon; + } + + public override int GetHashCode() + { + return HashCode.Combine(Delta, DeltaCount); + } + + public bool Equals(Island other) + { + return Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon && + DeltaCount == other.DeltaCount; + } + + public override bool Equals(object? obj) + { + return obj?.GetHashCode() == GetHashCode(); + } + } } } From 202364be5edc8f5126f12894f614a33533bc454f Mon Sep 17 00:00:00 2001 From: StanR Date: Thu, 19 Sep 2024 17:52:55 +0500 Subject: [PATCH 20/29] Use `List` instead of `Dictionary` for island counting, minor adjustments --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 35 +++++++++++++------ .../Difficulty/Skills/Speed.cs | 2 +- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 87fc35adcd33..d6ed60cc7751 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -3,6 +3,8 @@ using System; using System.Collections.Generic; +using System.Linq; +using osu.Framework.Lists; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; @@ -13,8 +15,8 @@ public static class RhythmEvaluator { private const int history_time_max = 4 * 1000; // 4 seconds private const int history_objects_max = 24; - private const double rhythm_overall_multiplier = 1.25; - private const double rhythm_ratio_multiplier = 11.0; + private const double rhythm_overall_multiplier = 1.0; + private const double rhythm_ratio_multiplier = 14.0; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -30,7 +32,10 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) var island = new Island(deltaDifferenceEpsilon); var previousIsland = new Island(deltaDifferenceEpsilon); - Dictionary islandCounts = new Dictionary(); + + // we can't use dictionary here because we need to compare island with a tolerance + // which is impossible to pass into the hash comparer + var islandCounts = new List<(Island Island, int Count)>(); double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms @@ -104,15 +109,21 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) if (island.DeltaCount == 1) effectiveRatio *= 0.7; - if (!islandCounts.TryAdd(island, 1)) + var islandCount = islandCounts.FirstOrDefault(x => x.Island.Equals(island)); + + if (islandCount != default) { // only add island to island counts if they're going one after another if (previousIsland.Equals(island)) - islandCounts[island]++; + islandCount.Count++; // repeated island (ex: triplet -> triplet) double power = logistic(island.Delta, 4, 0.165, 10); - effectiveRatio *= Math.Min(3.0 / islandCounts[island], Math.Pow(1.0 / islandCounts[island], power)); + effectiveRatio *= Math.Min(3.0 / islandCount.Count, Math.Pow(1.0 / islandCount.Count, power)); + } + else + { + islandCounts.Add((island, 1)); } // scale down the difficulty if the object is doubletappable @@ -150,7 +161,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - (multiplier * x)))); - private struct Island : IEquatable + private class Island : IEquatable { private readonly double deltaDifferenceEpsilon; @@ -163,6 +174,7 @@ public Island(int delta, double epsilon) { deltaDifferenceEpsilon = epsilon; Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); + DeltaCount++; } public int Delta { get; private set; } @@ -188,15 +200,18 @@ public override int GetHashCode() return HashCode.Combine(Delta, DeltaCount); } - public bool Equals(Island other) + public bool Equals(Island? other) { + if (other == null) + return false; + return Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon && DeltaCount == other.DeltaCount; } - public override bool Equals(object? obj) + public override string ToString() { - return obj?.GetHashCode() == GetHashCode(); + return $"{Delta}x{DeltaCount}"; } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index f7f081b7eac3..37420ed026ba 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Speed : OsuStrainSkill { - private double skillMultiplier => 1.375; + private double skillMultiplier => 1.38; private double strainDecayBase => 0.3; private double currentStrain; From e986a7dfe117ff8b0ed1bbd691404bc5be1b7dcf Mon Sep 17 00:00:00 2001 From: StanR Date: Thu, 19 Sep 2024 19:15:54 +0500 Subject: [PATCH 21/29] Fix repetition nerf not updating the counts --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index d6ed60cc7751..e34989f162b1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Lists; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; @@ -113,6 +112,8 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) if (islandCount != default) { + int countIndex = islandCounts.IndexOf(islandCount); + // only add island to island counts if they're going one after another if (previousIsland.Equals(island)) islandCount.Count++; @@ -120,6 +121,8 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // repeated island (ex: triplet -> triplet) double power = logistic(island.Delta, 4, 0.165, 10); effectiveRatio *= Math.Min(3.0 / islandCount.Count, Math.Pow(1.0 / islandCount.Count, power)); + + islandCounts[countIndex] = (islandCount.Island, islandCount.Count); } else { From e04b88a9b0093c0902e4f6ecf7e6ad2d64174a84 Mon Sep 17 00:00:00 2001 From: StanR Date: Mon, 23 Sep 2024 13:49:25 +0500 Subject: [PATCH 22/29] Replace speed buff with aim buff --- osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index e34989f162b1..9c7191dec5c1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -14,7 +14,7 @@ public static class RhythmEvaluator { private const int history_time_max = 4 * 1000; // 4 seconds private const int history_objects_max = 24; - private const double rhythm_overall_multiplier = 1.0; + private const double rhythm_overall_multiplier = 0.95; private const double rhythm_ratio_multiplier = 14.0; /// diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 3f6b22bbb199..7963e92c8dc2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -23,7 +23,7 @@ public Aim(Mod[] mods, bool withSliders) private double currentStrain; - private double skillMultiplier => 23.55; + private double skillMultiplier => 23.65; private double strainDecayBase => 0.15; private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 37420ed026ba..f7f081b7eac3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Speed : OsuStrainSkill { - private double skillMultiplier => 1.38; + private double skillMultiplier => 1.375; private double strainDecayBase => 0.3; private double currentStrain; From 08bded82fdfd1cf63d2a72b51cedb5be0de01c60 Mon Sep 17 00:00:00 2001 From: StanR Date: Mon, 23 Sep 2024 16:30:02 +0500 Subject: [PATCH 23/29] Remove GetHashCode --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 9c7191dec5c1..abf9dbe725ba 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -198,11 +198,6 @@ public bool IsSimilarPolarity(Island other) Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon; } - public override int GetHashCode() - { - return HashCode.Combine(Delta, DeltaCount); - } - public bool Equals(Island? other) { if (other == null) From 75dc822540c882ad2cfa867cba7ec687d3f3d814 Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 24 Sep 2024 17:57:31 +0500 Subject: [PATCH 24/29] Adjust some multipliers --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index abf9dbe725ba..7bda1c29a323 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -13,9 +13,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators public static class RhythmEvaluator { private const int history_time_max = 4 * 1000; // 4 seconds - private const int history_objects_max = 24; - private const double rhythm_overall_multiplier = 0.95; - private const double rhythm_ratio_multiplier = 14.0; + private const int history_objects_max = 32; + private const double rhythm_overall_multiplier = 0.9; + private const double rhythm_ratio_multiplier = 11.5; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -78,15 +78,6 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) double effectiveRatio = windowPenalty * currRatio * fractionMultiplier; - // bpm change is into slider, this is easy acc window - if (currObj.BaseObject is Slider) - effectiveRatio *= 0.125; - - // bpm change was from a slider, this is easier typically than circle -> circle - // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders - if (prevObj.BaseObject is Slider) - effectiveRatio *= 0.2; - if (firstDeltaSwitch) { if (Math.Abs(prevDelta - currDelta) < deltaDifferenceEpsilon) @@ -96,6 +87,15 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) } else { + // bpm change is into slider, this is easy acc window + if (currObj.BaseObject is Slider) + effectiveRatio *= 0.125; + + // bpm change was from a slider, this is easier typically than circle -> circle + // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders + if (prevObj.BaseObject is Slider) + effectiveRatio *= 0.15; + // repeated island polarity (2 -> 4, 3 -> 5) if (island.IsSimilarPolarity(previousIsland)) effectiveRatio *= 0.3; @@ -119,7 +119,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) islandCount.Count++; // repeated island (ex: triplet -> triplet) - double power = logistic(island.Delta, 4, 0.165, 10); + double power = logistic(island.Delta, 2, 0.165, 10); effectiveRatio *= Math.Min(3.0 / islandCount.Count, Math.Pow(1.0 / islandCount.Count, power)); islandCounts[countIndex] = (islandCount.Island, islandCount.Count); From 872628b8b87c73d21579a2ffd7aa26058cd6c551 Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 24 Sep 2024 18:24:00 +0500 Subject: [PATCH 25/29] Some extra tweaking --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 7bda1c29a323..edb67f37d9be 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -14,7 +14,7 @@ public static class RhythmEvaluator { private const int history_time_max = 4 * 1000; // 4 seconds private const int history_objects_max = 32; - private const double rhythm_overall_multiplier = 0.9; + private const double rhythm_overall_multiplier = 0.92; private const double rhythm_ratio_multiplier = 11.5; /// @@ -119,7 +119,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) islandCount.Count++; // repeated island (ex: triplet -> triplet) - double power = logistic(island.Delta, 2, 0.165, 10); + double power = logistic(island.Delta, 2.75, 0.24, 14); effectiveRatio *= Math.Min(3.0 / islandCount.Count, Math.Pow(1.0 / islandCount.Count, power)); islandCounts[countIndex] = (islandCount.Island, islandCount.Count); From fe8b9536ffa085326b889dce768ed2b035c3a67f Mon Sep 17 00:00:00 2001 From: StanR Date: Wed, 25 Sep 2024 18:58:24 +0500 Subject: [PATCH 26/29] Bring back some old nerfs as balancing factor --- .../Difficulty/Evaluators/RhythmEvaluator.cs | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index edb67f37d9be..08efb187fef7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -12,10 +12,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { public static class RhythmEvaluator { - private const int history_time_max = 4 * 1000; // 4 seconds + private const int history_time_max = 5 * 1000; // 5 seconds private const int history_objects_max = 32; - private const double rhythm_overall_multiplier = 0.92; - private const double rhythm_ratio_multiplier = 11.5; + private const double rhythm_overall_multiplier = 0.95; + private const double rhythm_ratio_multiplier = 12.0; /// /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . @@ -94,19 +94,20 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // bpm change was from a slider, this is easier typically than circle -> circle // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders if (prevObj.BaseObject is Slider) - effectiveRatio *= 0.15; + effectiveRatio *= 0.3; // repeated island polarity (2 -> 4, 3 -> 5) if (island.IsSimilarPolarity(previousIsland)) - effectiveRatio *= 0.3; + effectiveRatio *= 0.5; // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon) effectiveRatio *= 0.125; - // singletaps are easier to control - if (island.DeltaCount == 1) - effectiveRatio *= 0.7; + // repeated island size (ex: triplet -> triplet) + // TODO: remove this nerf since its staying here only for balancing purposes because of the flawed ratio calculation + if (previousIsland.DeltaCount == island.DeltaCount) + effectiveRatio *= 0.5; var islandCount = islandCounts.FirstOrDefault(x => x.Island.Equals(island)); @@ -150,6 +151,15 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) // Begin counting island until we change speed again. firstDeltaSwitch = true; + // bpm change is into slider, this is easy acc window + if (currObj.BaseObject is Slider) + effectiveRatio *= 0.6; + + // bpm change was from a slider, this is easier typically than circle -> circle + // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders + if (prevObj.BaseObject is Slider) + effectiveRatio *= 0.6; + startRatio = effectiveRatio; island = new Island((int)currDelta, deltaDifferenceEpsilon); @@ -180,12 +190,12 @@ public Island(int delta, double epsilon) DeltaCount++; } - public int Delta { get; private set; } + public int Delta { get; private set; } = int.MaxValue; public int DeltaCount { get; private set; } public void AddDelta(int delta) { - if (Delta == default) + if (Delta == int.MaxValue) Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME); DeltaCount++; @@ -193,9 +203,9 @@ public void AddDelta(int delta) public bool IsSimilarPolarity(Island other) { - // consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) - return DeltaCount % 2 == other.DeltaCount % 2 && - Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon; + // TODO: consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple) + // naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation + return DeltaCount % 2 == other.DeltaCount % 2; } public bool Equals(Island? other) From f4055d923f7fe28e0aed4947ca2d66cc5e8bd0c6 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Wed, 25 Sep 2024 18:14:15 +0100 Subject: [PATCH 27/29] increase aim skill multiplier --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 1fbe03395c90..faf91e46520b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -23,7 +23,7 @@ public Aim(Mod[] mods, bool withSliders) private double currentStrain; - private double skillMultiplier => 24.963; + private double skillMultiplier => 25.18; private double strainDecayBase => 0.15; private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); From d4a00d75e80de49a72a8fdf20e623e437f4bbeb5 Mon Sep 17 00:00:00 2001 From: StanR Date: Fri, 4 Oct 2024 17:42:15 +0500 Subject: [PATCH 28/29] Update osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs Co-authored-by: James Wilson --- osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 08efb187fef7..d10d2c5c05a4 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -131,7 +131,7 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current) } // scale down the difficulty if the object is doubletappable - double doubletapness = prevObj.GetDoubletapness((OsuDifficultyHitObject?)prevObj.Next(0)); + double doubletapness = prevObj.GetDoubletapness(currObj); effectiveRatio *= 1 - doubletapness * 0.75; rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay; From 9508b0ecab62a5e93b41b3b240e5617a6b82dc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 7 Oct 2024 09:32:23 +0200 Subject: [PATCH 29/29] Fix tests --- .../OsuDifficultyCalculatorTest.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index 17b51085da87..efda3fa369f1 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -15,21 +15,21 @@ public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu.Tests"; - [TestCase(6.7154251995274938d, 239, "diffcalc-test")] - [TestCase(1.4430610657612626d, 54, "zero-length-sliders")] + [TestCase(6.7171144000821119d, 239, "diffcalc-test")] + [TestCase(1.4485749025771304d, 54, "zero-length-sliders")] [TestCase(0.42630400627180914d, 4, "very-fast-slider")] [TestCase(0.14143808967817237d, 2, "nan-slider")] public void Test(double expectedStarRating, int expectedMaxCombo, string name) => base.Test(expectedStarRating, expectedMaxCombo, name); - [TestCase(8.9808183779700208d, 239, "diffcalc-test")] - [TestCase(1.7483507893412422d, 54, "zero-length-sliders")] + [TestCase(8.9825709931204205d, 239, "diffcalc-test")] + [TestCase(1.7550169162648608d, 54, "zero-length-sliders")] [TestCase(0.55231632896800109d, 4, "very-fast-slider")] public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime()); - [TestCase(6.7154251995274938d, 239, "diffcalc-test")] - [TestCase(1.4430610657612626d, 54, "zero-length-sliders")] + [TestCase(6.7171144000821119d, 239, "diffcalc-test")] + [TestCase(1.4485749025771304d, 54, "zero-length-sliders")] [TestCase(0.42630400627180914d, 4, "very-fast-slider")] public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic());