From 010078778e67e4b4c133f39c7ba5b96221f5f1dc Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 25 Sep 2021 03:27:07 +0000 Subject: [PATCH 01/17] velocity buff isolation + small refactor --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 677d3c06aa..f02c11a0a3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.0; private const double acute_angle_multiplier = 1.0; private const double rhythm_variance_multiplier = 1.0; + private const double vel_change_multiplier = 2.0; protected override double StrainValueOf(DifficultyHitObject current) { @@ -73,6 +74,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills // add in angle velocity. aimStrain += angleBonus; } + + if (prevVector.Length > currVector.Length) + { + double velChangeBonus = Math.Max(0, Math.Sqrt((prevVector.Length - currVector.Length) * currVector.Length) - Math.Max(0, currVector.Length - 100 / osuCurrObj.StrainTime)) * Math.Min(1, osuCurrObj.JumpDistance / 100); + + aimStrain += velChangeBonus * vel_change_multiplier; + } } else // There is a rhythm change { From 9802f4fc908de47ffa59be01f770bd3df32c9f34 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 25 Sep 2021 03:37:19 +0000 Subject: [PATCH 02/17] added wide angle buff to velchange --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index f02c11a0a3..5ee984350e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -73,13 +73,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills // add in angle velocity. aimStrain += angleBonus; - } - if (prevVector.Length > currVector.Length) - { - double velChangeBonus = Math.Max(0, Math.Sqrt((prevVector.Length - currVector.Length) * currVector.Length) - Math.Max(0, currVector.Length - 100 / osuCurrObj.StrainTime)) * Math.Min(1, osuCurrObj.JumpDistance / 100); + if (prevVector.Length > currVector.Length) + { + double velChangeBonus = Math.Max(0, Math.Sqrt((prevVector.Length - currVector.Length) * currVector.Length) - Math.Max(0, currVector.Length - 100 / osuCurrObj.StrainTime)) * Math.Min(1, osuCurrObj.JumpDistance / 100); - aimStrain += velChangeBonus * vel_change_multiplier; + aimStrain += velChangeBonus * (1 + wideAngleBonus)* vel_change_multiplier; + } } } else // There is a rhythm change From ffa0fac5ebdc183f9e3eb48c6941a9c30653f24a Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 25 Sep 2021 04:08:05 +0000 Subject: [PATCH 03/17] refactored to clean up issues with streams --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 5ee984350e..af7e9900c1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.0; private const double acute_angle_multiplier = 1.0; private const double rhythm_variance_multiplier = 1.0; - private const double vel_change_multiplier = 2.0; + private const double vel_change_multiplier = 1.0; protected override double StrainValueOf(DifficultyHitObject current) { @@ -76,9 +76,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (prevVector.Length > currVector.Length) { - double velChangeBonus = Math.Max(0, Math.Sqrt((prevVector.Length - currVector.Length) * currVector.Length) - Math.Max(0, currVector.Length - 100 / osuCurrObj.StrainTime)) * Math.Min(1, osuCurrObj.JumpDistance / 100); + double velChangeBonus = Math.Max(0, (prevVector.Length - currVector.Length) - Math.Min(0, currVector.Length - 100 / osuCurrObj.StrainTime)) + * Math.Min(1, osuCurrObj.JumpDistance / 100) + * Math.Min(1, (osuPrevObj.JumpDistance - osuCurrObj.JumpDistance) / 100); - aimStrain += velChangeBonus * (1 + wideAngleBonus)* vel_change_multiplier; + aimStrain += velChangeBonus * Math.Sqrt(100 / osuCurrObj.StrainTime) * (1 + wideAngleBonus) * vel_change_multiplier; } } } From b7444ee9eb7970fd35e1b307bdeb49fa927be388 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 25 Sep 2021 04:20:35 +0000 Subject: [PATCH 04/17] replaced original velocity alg --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index af7e9900c1..beedb64af2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -29,7 +29,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.0; private const double acute_angle_multiplier = 1.0; private const double rhythm_variance_multiplier = 1.0; - private const double vel_change_multiplier = 1.0; + private const double vel_change_multiplier = 6.5; + private const double slider_multiplier = 6.5; + private const double slider_jump_multiplier = 0.875; protected override double StrainValueOf(DifficultyHitObject current) { @@ -76,11 +78,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (prevVector.Length > currVector.Length) { - double velChangeBonus = Math.Max(0, (prevVector.Length - currVector.Length) - Math.Min(0, currVector.Length - 100 / osuCurrObj.StrainTime)) - * Math.Min(1, osuCurrObj.JumpDistance / 100) - * Math.Min(1, (osuPrevObj.JumpDistance - osuCurrObj.JumpDistance) / 100); + double velChangeBonus = Math.Max(0, Math.Sqrt((prevVector.Length - currVector.Length) * currVector.Length) - currVector.Length) * Math.Min(1, osuCurrObj.JumpDistance / 100); - aimStrain += velChangeBonus * Math.Sqrt(100 / osuCurrObj.StrainTime) * (1 + wideAngleBonus) * vel_change_multiplier; + aimStrain += velChangeBonus * Math.Sqrt(100 / osuCurrObj.StrainTime) * vel_change_multiplier; } } } From a23330c49b15623946a760f4ed8c38e0c0437264 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Thu, 21 Oct 2021 17:21:03 +0000 Subject: [PATCH 05/17] removed comment --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 7eabc29a99..2f9940f6f3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills { } -private int count = 1; - protected override int HistoryLength => 2; private const double wide_angle_multiplier = 1.5; @@ -36,11 +34,9 @@ private int count = 1; private double strainValueOf(DifficultyHitObject current) { - if (current.BaseObject is Spinner || Previous.Count <= 1 || Previous[0].BaseObject is Spinner) + if (current.BaseObject is Spinner || Previous.Count <= 1) return 0; - count++; - var osuCurrObj = (OsuDifficultyHitObject)current; var osuPrevObj = (OsuDifficultyHitObject)Previous[0]; var osuLastObj = (OsuDifficultyHitObject)Previous[1]; From b9748399c49528cd6da68df92c96415abdf33d43 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Fri, 22 Oct 2021 17:18:34 +0000 Subject: [PATCH 06/17] added velocity adjustment for sliders --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index f71d33758d..369756458f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -96,6 +96,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (Math.Max(prevVelocity, currVelocity) != 0) { + prevVelocity = (osuPrevObj.JumpDistance + osuPrevObj.TravelDistance) / osuPrevObj.StrainTime; // We want to use the average velocity when awarding differences, not necessarily combined. + currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; + velChangeBonus = Math.Max(Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, osuCurrObj.JumpDistance / 100)), 2) // do not award overlap * Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2), // scale with ratio of difference compared to max From b6e7d898f1a1640d5c062b61b5fd058efc524470 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Fri, 22 Oct 2021 17:21:34 +0000 Subject: [PATCH 07/17] constant didnt update during last merge --- 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 369756458f..664af291fb 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.5; private const double acute_angle_multiplier = 1.5; - private const double slider_multiplier = 1.75; + private const double slider_multiplier = 1.5; private const double vel_change_multiplier = 0.75; private double currentStrain = 1; From d74e18153108cb893c027c44ea3b8373844aaf32 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Wed, 3 Nov 2021 15:54:49 +0000 Subject: [PATCH 08/17] renamed prev to last --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 8f6a92a3a9..3bdb397909 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -102,16 +102,16 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (Math.Max(prevVelocity, currVelocity) != 0) { - prevVelocity = (osuPrevObj.JumpDistance + osuPrevObj.TravelDistance) / osuPrevObj.StrainTime; // We want to use the average velocity when awarding differences, not necessarily combined. + prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; // We want to use the average velocity when awarding differences, not necessarily combined. currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; velChangeBonus = Math.Max(Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, osuCurrObj.JumpDistance / 100)), 2) // do not award overlap * Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2), // scale with ratio of difference compared to max - Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuPrevObj.StrainTime), Math.Abs(prevVelocity - currVelocity)) // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. + Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)) // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. * Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2)); // scale with ratio of difference compared to max - velChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuPrevObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuPrevObj.StrainTime), 2); // penalize for rhythm changes. + velChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2); // penalize for rhythm changes. } if (osuCurrObj.TravelTime != 0) From 7af1a0bf12abcc119a2f78a828e44c6b653ff2cc Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 6 Nov 2021 21:11:37 +0000 Subject: [PATCH 09/17] buffed velocity constant --- 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 915673f890..ae7e783c6a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.5; private const double acute_angle_multiplier = 2.0; private const double slider_multiplier = 1.5; - private const double vel_change_multiplier = 0.75; + private const double vel_change_multiplier = 1.0; private double currentStrain = 1; From bd58d2873e5ee8a0d50db3c4a43bf0ccdae82c0d Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 6 Nov 2021 21:55:47 +0000 Subject: [PATCH 10/17] revert velocity multiplier to 0.75 --- 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 ae7e783c6a..915673f890 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.5; private const double acute_angle_multiplier = 2.0; private const double slider_multiplier = 1.5; - private const double vel_change_multiplier = 1.0; + private const double vel_change_multiplier = 0.75; private double currentStrain = 1; From f135a98d69205bce9073d9ebeaef1b15dd80f7dc Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sat, 6 Nov 2021 22:27:58 +0000 Subject: [PATCH 11/17] updated for review, adding wide angle buff for velchanges --- .../Difficulty/Skills/Aim.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 915673f890..df0105f32f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -63,7 +63,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills prevVelocity = Math.Max(prevVelocity, movementVelocity + travelVelocity); } - double angleBonus = 0; + double wideAngleBonus = 0; + double acuteAngleBonus = 0; double sliderBonus = 0; double velChangeBonus = 0; @@ -78,10 +79,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double lastLastAngle = osuLastLastObj.Angle.Value; // Rewarding angles, take the smaller velocity as base. - angleBonus = Math.Min(currVelocity, prevVelocity); + double angleBonus = Math.Min(currVelocity, prevVelocity); - double wideAngleBonus = calcWideAngleBonus(currAngle); - double acuteAngleBonus = calcAcuteAngleBonus(currAngle); + wideAngleBonus = calcWideAngleBonus(currAngle); + acuteAngleBonus = calcAcuteAngleBonus(currAngle); if (osuCurrObj.StrainTime > 100) // Only buff deltaTime exceeding 300 bpm 1/2. acuteAngleBonus = 0; @@ -95,21 +96,20 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse. - - angleBonus = Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier); // Take the max of the multipliers. } } if (Math.Max(prevVelocity, currVelocity) != 0) { - prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; // We want to use the average velocity when awarding differences, not necessarily combined. + prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; - velChangeBonus = Math.Max(Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, osuCurrObj.JumpDistance / 100)), 2) // do not award overlap - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2), // scale with ratio of difference compared to max - Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)) // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2)); // scale with ratio of difference compared to max + double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); // scale with ratio of difference compared to max + double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. + double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap + * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, osuCurrObj.JumpDistance / 100)), 2); // do not award overlap + + velChangeBonus = Math.Max(overlapVelocityBuff, nonOverlapVelocityBuff) * distRatio; // choose larger distance, multiplied by ratio. velChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2); // penalize for rhythm changes. } @@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.TravelTime; // add some slider rewards } - aimStrain += Math.Max(angleBonus, velChangeBonus * vel_change_multiplier); // Add in angle bonus or velchange bonus, whichever is larger. + aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velChangeBonus * vel_change_multiplier); // Add in acute angle bonus or wide angle bonus + velchange bonus, whichever is larger. aimStrain += sliderBonus * slider_multiplier; // Add in additional slider velocity. return aimStrain; From adeebd954a4822852e52ab87da81299d5ca8e54e Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sun, 7 Nov 2021 00:13:13 +0000 Subject: [PATCH 12/17] update to fix velocity change oversight --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index df0105f32f..ab7a392b1b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -104,10 +104,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; - double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); // scale with ratio of difference compared to max + double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Abs(prevVelocity - currVelocity) / (0.5 * Math.Max(prevVelocity, currVelocity)))), 2); // scale with ratio of difference compared to 0.5 * max dist. double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, osuCurrObj.JumpDistance / 100)), 2); // do not award overlap + * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.JumpDistance, osuLastObj.JumpDistance) / 100)), 2); // do not award overlap velChangeBonus = Math.Max(overlapVelocityBuff, nonOverlapVelocityBuff) * distRatio; // choose larger distance, multiplied by ratio. From 26ff292337e710b3415dfec66ba72d3152b4e7ef Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sun, 7 Nov 2021 01:08:51 +0000 Subject: [PATCH 13/17] revert velchangetest change --- 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 ab7a392b1b..44fff88202 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; - double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Abs(prevVelocity - currVelocity) / (0.5 * Math.Max(prevVelocity, currVelocity)))), 2); // scale with ratio of difference compared to 0.5 * max dist. + double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); // scale with ratio of difference compared to 0.5 * max dist. double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.JumpDistance, osuLastObj.JumpDistance) / 100)), 2); // do not award overlap From 86b635cdd33c06ed591b3e96c3ca64be4214b65f Mon Sep 17 00:00:00 2001 From: Xexxar Date: Sun, 7 Nov 2021 14:56:23 +0000 Subject: [PATCH 14/17] refactor comments to be on previous line for readability --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 44fff88202..cf983a5fc2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -94,18 +94,23 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills * Math.Pow(Math.Sin(Math.PI / 2 * (Math.Clamp(osuCurrObj.JumpDistance, 50, 100) - 50) / 50), 2); // Buff distance exceeding 50 (radius) up to 100 (diameter). } - wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. - acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse. + // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. + wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); + // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse. + acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); } } if (Math.Max(prevVelocity, currVelocity) != 0) { - prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. + // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. + prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; - double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); // scale with ratio of difference compared to 0.5 * max dist. - double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. + // scale with ratio of difference compared to 0.5 * max dist. + double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); + // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. + double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.JumpDistance, osuLastObj.JumpDistance) / 100)), 2); // do not award overlap @@ -119,7 +124,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.TravelTime; // add some slider rewards } - aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velChangeBonus * vel_change_multiplier); // Add in acute angle bonus or wide angle bonus + velchange bonus, whichever is larger. + // Add in acute angle bonus or wide angle bonus + velchange bonus, whichever is larger. + aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velChangeBonus * vel_change_multiplier); aimStrain += sliderBonus * slider_multiplier; // Add in additional slider velocity. return aimStrain; From 366583c8e24bc3b7f2e533e8ea4623641507c5bd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Nov 2021 00:33:57 +0900 Subject: [PATCH 15/17] Update tests --- .../OsuDifficultyCalculatorTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index 79d575ab3f..c88f70021b 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -15,13 +15,13 @@ namespace osu.Game.Rulesets.Osu.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; - [TestCase(6.531832890435525d, "diffcalc-test")] - [TestCase(1.4644923495008817d, "zero-length-sliders")] + [TestCase(6.6975550434910005d, "diffcalc-test")] + [TestCase(1.4673500058356748d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); - [TestCase(8.8067616302940852d, "diffcalc-test")] - [TestCase(1.7763214959309293d, "zero-length-sliders")] + [TestCase(8.938989502378238d, "diffcalc-test")] + [TestCase(1.779323508403831d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); From 84f3168a6c1fbb276ed12542158bd5257658b7eb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Nov 2021 00:46:35 +0900 Subject: [PATCH 16/17] More comment refactorings --- .../Difficulty/Skills/Aim.cs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index cf983a5fc2..89a6fb87d7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double wideAngleBonus = 0; double acuteAngleBonus = 0; double sliderBonus = 0; - double velChangeBonus = 0; + double velocityChangeBonus = 0; double aimStrain = currVelocity; // Start strain with regular velocity. @@ -107,26 +107,35 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills prevVelocity = (osuLastObj.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.TravelDistance) / osuCurrObj.StrainTime; - // scale with ratio of difference compared to 0.5 * max dist. + // Scale with ratio of difference compared to 0.5 * max dist. double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); - // reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. + + // Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); - double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) // reward for % distance slowed down compared to previous, paying attention to not award overlap - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.JumpDistance, osuLastObj.JumpDistance) / 100)), 2); // do not award overlap - velChangeBonus = Math.Max(overlapVelocityBuff, nonOverlapVelocityBuff) * distRatio; // choose larger distance, multiplied by ratio. + // Reward for % distance slowed down compared to previous, paying attention to not award overlap + double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) + // do not award overlap + * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.JumpDistance, osuLastObj.JumpDistance) / 100)), 2); - velChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2); // penalize for rhythm changes. + // Choose the largest bonus, multiplied by ratio. + velocityChangeBonus = Math.Max(overlapVelocityBuff, nonOverlapVelocityBuff) * distRatio; + + // Penalize for rhythm changes. + velocityChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2); } if (osuCurrObj.TravelTime != 0) { - sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.TravelTime; // add some slider rewards + // Reward sliders based on velocity. + sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.TravelTime; } - // Add in acute angle bonus or wide angle bonus + velchange bonus, whichever is larger. - aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velChangeBonus * vel_change_multiplier); - aimStrain += sliderBonus * slider_multiplier; // Add in additional slider velocity. + // Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger. + aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * vel_change_multiplier); + + // Add in additional slider velocity bonus. + aimStrain += sliderBonus * slider_multiplier; return aimStrain; } From 480a1604fab5263b5ee2cf1acb3f64920b65a0cd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Nov 2021 00:47:22 +0900 Subject: [PATCH 17/17] Rename constant --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 89a6fb87d7..aebc73f108 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double wide_angle_multiplier = 1.5; private const double acute_angle_multiplier = 2.0; private const double slider_multiplier = 1.5; - private const double vel_change_multiplier = 0.75; + private const double velocity_change_multiplier = 0.75; private double currentStrain = 1; @@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills } // Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger. - aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * vel_change_multiplier); + aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * velocity_change_multiplier); // Add in additional slider velocity bonus. aimStrain += sliderBonus * slider_multiplier;