1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:22:56 +08:00

refactored speed skill, implemented better acc pp

This commit is contained in:
Xexxar 2021-08-19 14:12:03 +00:00
parent 9cd82ea75f
commit 0effc8f5d8
3 changed files with 84 additions and 86 deletions

View File

@ -161,6 +161,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
// Scale the speed value with accuracy and OD // Scale the speed value with accuracy and OD
speedValue *= (0.95 + Math.Pow(Attributes.OverallDifficulty, 2) / 750) * Math.Pow(accuracy, (14.5 - Math.Max(Attributes.OverallDifficulty, 8)) / 2); speedValue *= (0.95 + Math.Pow(Attributes.OverallDifficulty, 2) / 750) * Math.Pow(accuracy, (14.5 - Math.Max(Attributes.OverallDifficulty, 8)) / 2);
// Punish low OD severely prevent OD abuse on rhythmically complex songs.
speedValue *= Math.Max(0.75, (Math.Min(8, Attributes.OverallDifficulty) / 8));
// Scale the speed value with # of 50s to punish doubletapping. // Scale the speed value with # of 50s to punish doubletapping.
speedValue *= Math.Pow(0.98, countMeh < totalHits / 500.0 ? 0 : countMeh - totalHits / 500.0); speedValue *= Math.Pow(0.98, countMeh < totalHits / 500.0 ? 0 : countMeh - totalHits / 500.0);
@ -169,25 +171,31 @@ namespace osu.Game.Rulesets.Osu.Difficulty
private double computeAccuracyValue() private double computeAccuracyValue()
{ {
// This percentage only considers HitCircles of any value - in this part of the calculation we focus on hitting the timing hit window
double betterAccuracyPercentage;
int amountHitObjectsWithAccuracy = Attributes.HitCircleCount; int amountHitObjectsWithAccuracy = Attributes.HitCircleCount;
if (amountHitObjectsWithAccuracy > 0) // This section should be documented by Tr3, but effectively we're calculating the exact same way as before, but
betterAccuracyPercentage = ((countGreat - (totalHits - amountHitObjectsWithAccuracy)) * 6 + countOk * 2 + countMeh) / (double)(amountHitObjectsWithAccuracy * 6); // we calculate a variance based on the object count and # of 50s, 100s, etc. This prevents us from having cases
else // where an SS on lower OD is actually worth more than a 95% on OD11, even though the OD11 requires a greater
betterAccuracyPercentage = 0; // window of precision.
// It is possible to reach a negative accuracy with this formula. Cap it at zero - zero points double p100 = (2 * (double)countOk) / amountHitObjectsWithAccuracy; // this is multiplied by two to encourage better accuracy. (scales better)
if (betterAccuracyPercentage < 0) double p50 = (1 * (double)countMeh) / amountHitObjectsWithAccuracy;
betterAccuracyPercentage = 0; double pm = (1 * (double)countMiss) / amountHitObjectsWithAccuracy;
double p300 = 1.0 - pm - p100 - p50;
// Lots of arbitrary values from testing. double m300 = 79.5 - 6.0 * Attributes.OverallDifficulty;
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution double m100 = 139.5 - 8.0 * Attributes.OverallDifficulty;
double accuracyValue = Math.Pow(1.52163, Attributes.OverallDifficulty) * Math.Pow(betterAccuracyPercentage, 24) * 2.83; double m50 = 199.5 - 10.0 * Attributes.OverallDifficulty;
double acc = p300 + 1.0 / 3.0 * p100 + 1.0 / 6.0 * p50;
double variance = p300 * Math.Pow(m300 / 2.0, 2.0) +
p100 * Math.Pow((m300 + m100) / 2.0, 2.0) +
p50 * Math.Pow((m100 + m50) / 2.0, 2.0) +
pm * Math.Pow(229.5 - 11 * Attributes.OverallDifficulty, 2.0);
double accuracyValue = 2.83 * Math.Pow(1.52163, (79.5 - 2 * Math.Sqrt(variance)) / 6.0)
* Math.Pow(Math.Log(1.0 + (Math.E - 1.0) * (Math.Min(amountHitObjectsWithAccuracy, 1600) / 1000.0)), 0.5);
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
accuracyValue *= Math.Min(1.15, Math.Pow(amountHitObjectsWithAccuracy / 1000.0, 0.3));
if (mods.Any(m => m is OsuModHidden)) if (mods.Any(m => m is OsuModHidden))
accuracyValue *= 1.08; accuracyValue *= 1.08;

View File

@ -74,8 +74,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
currentStrain *= strainDecay(current.DeltaTime); currentStrain *= strainDecay(current.DeltaTime);
currentStrain += aimStrain * skillMultiplier; currentStrain += aimStrain * skillMultiplier;
// Console.WriteLine(currentStrain);
return currentStrain; return currentStrain;
} }
} }

View File

@ -20,10 +20,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
private const double pi_over_4 = Math.PI / 4; private const double pi_over_4 = Math.PI / 4;
private const double pi_over_2 = Math.PI / 2; private const double pi_over_2 = Math.PI / 2;
private const double rhythmMultiplier = 1.5; private const double rhythmMultiplier = 2.5;
private const int HistoryTimeMax = 3000; // 3 seconds of calculatingRhythmBonus max. private const int HistoryTimeMax = 3000; // 3 seconds of calculatingRhythmBonus max.
private double skillMultiplier => 1400; private double skillMultiplier => 1375;
private double strainDecayBase => 0.3; private double strainDecayBase => 0.3;
private double currentTapStrain = 1; private double currentTapStrain = 1;
@ -57,75 +57,70 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
if (current.BaseObject is Spinner) if (current.BaseObject is Spinner)
return 0; return 0;
// {doubles, triplets, quads, quints, 6-tuplets, 7 Tuplets, greater}
int previousIslandSize = -1; int previousIslandSize = -1;
double[] islandTimes = {0, 0, 0, 0, 0, 0, 0}; double rhythmComplexitySum = 0;
int islandSize = 0; int islandSize = 0;
bool firstDeltaSwitch = false; bool firstDeltaSwitch = false;
for (int i = Previous.Count - 1; i > 0; i--) for (int i = Previous.Count - 1; i > 0; i--)
{ {
double currDelta = ((OsuDifficultyHitObject)Previous[i - 1]).StrainTime; double currHistoricalDecay = Math.Max(0, (HistoryTimeMax - (current.StartTime - Previous[i - 1].StartTime))) / HistoryTimeMax; // scales note 0 to 1 from history to now
double prevDelta = ((OsuDifficultyHitObject)Previous[i]).StrainTime;
double effectiveRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta);
effectiveRatio *= Math.Sqrt(100 / ((currDelta + prevDelta) / 2)); // scale with bpm slightly if (currHistoricalDecay != 0)
if (effectiveRatio > 0.5)
effectiveRatio = 0.5 + (effectiveRatio - 0.5) * 10; // extra buff for 1/3 -> 1/4 etc transitions.
double currHistoricalDecay = Math.Max(0, (HistoryTimeMax - (current.StartTime - Previous[i - 1].StartTime))) / HistoryTimeMax;
if (firstDeltaSwitch)
{ {
if (isRatioEqual(1.0, prevDelta, currDelta)) currHistoricalDecay = Math.Max(currHistoricalDecay, (Previous.Count - i) / Previous.Count); // either we're limited by time or limited by object count.
double currDelta = ((OsuDifficultyHitObject)Previous[i - 1]).StrainTime;
double prevDelta = ((OsuDifficultyHitObject)Previous[i]).StrainTime;
double effectiveRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta);
if (effectiveRatio > 0.5)
effectiveRatio = 0.5 + (effectiveRatio - 0.5) * 10; // large buff for 1/3 -> 1/4 type transitions.
effectiveRatio *= Math.Sqrt(100 / ((currDelta + prevDelta) / 2)) * currHistoricalDecay; // scale with bpm slightly and with time
if (firstDeltaSwitch)
{ {
islandSize++; // island is still progressing, count size. if (isRatioEqual(1.0, prevDelta, currDelta))
{
islandSize++; // island is still progressing, count size.
}
else
{
if (islandSize > 6)
islandSize = 6;
if (Previous[i - 1].BaseObject is Slider) // bpm change is into slider, this is easy acc window
effectiveRatio *= 0.25;
if (Previous[i].BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
effectiveRatio *= 0.5;
if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet)
effectiveRatio *= 0.25;
rhythmComplexitySum += effectiveRatio * currHistoricalDecay;
previousIslandSize = islandSize; // log the last island size.
if (prevDelta * 1.25 < currDelta) // we're slowing down, stop counting
firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size.
islandSize = 0;
}
} }
else if (prevDelta > 1.25 * currDelta) // we want to be speeding up.
else
{ {
if (islandSize > 6) // Begin counting island until we change speed again.
islandSize = 6; firstDeltaSwitch = true;
if (Previous[i - 1].BaseObject is Slider) // bpm change is into slider, this is easy acc window
effectiveRatio *= 0.5;
if (Previous[i].BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
effectiveRatio *= 0.75;
if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet)
effectiveRatio *= 0.5;
islandTimes[islandSize] = islandTimes[islandSize] + effectiveRatio * currHistoricalDecay;
previousIslandSize = islandSize; // log the last island size.
if (prevDelta * 1.25 < currDelta) // we're slowing down, stop counting
firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size.
islandSize = 0; islandSize = 0;
} }
} }
else if (prevDelta > 1.25 * currDelta) // we want to be speeding up.
{
// Begin counting island until we change speed again.
firstDeltaSwitch = true;
islandSize = 0;
}
} }
double rhythmComplexitySum = 0.0; return Math.Sqrt(4 + rhythmComplexitySum * rhythmMultiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity)
for (int i = 0; i < islandTimes.Length; i++)
{
rhythmComplexitySum += islandTimes[i] * ((double)(i + islandTimes.Length) / (2 * islandTimes.Length)); // sum the total amount of rhythm variance
}
// Console.WriteLine(Math.Sqrt(4 + rhythmComplexitySum * rhythmMultiplier) / 2);
return Math.Sqrt(4 + rhythmComplexitySum * rhythmMultiplier) / 2;
} }
private double tapStrainOf(DifficultyHitObject current, double speedBonus) private double tapStrainOf(DifficultyHitObject current, double speedBonus)
@ -133,9 +128,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
if (current.BaseObject is Spinner) if (current.BaseObject is Spinner)
return 0; return 0;
var osuCurrent = (OsuDifficultyHitObject)current; var osuCurrObj = (OsuDifficultyHitObject)current;
return ((1 + (speedBonus - 1) * 0.75) * 0.95) / osuCurrent.StrainTime; return speedBonus / osuCurrObj.StrainTime;
} }
private double movementStrainOf(DifficultyHitObject current, double speedBonus) private double movementStrainOf(DifficultyHitObject current, double speedBonus)
@ -143,27 +138,24 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
if (current.BaseObject is Spinner) if (current.BaseObject is Spinner)
return 0; return 0;
var osuCurrent = (OsuDifficultyHitObject)current; var osuCurrObj = (OsuDifficultyHitObject)current;
double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance); double distance = Math.Min(single_spacing_threshold, osuCurrObj.TravelDistance + osuCurrObj.JumpDistance);
double angleBonus = 1.0; double angleBonus = 1.0;
if (osuCurrent.Angle != null && osuCurrent.Angle.Value < angle_bonus_begin) if (osuCurrObj.Angle != null)
{ {
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - osuCurrent.Angle.Value)), 2) / 3.57; double angle = osuCurrObj.Angle.Value;
if (angle < pi_over_2)
angleBonus = 1.25;
else if (angle < angle_bonus_begin)
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - angle)), 2) / 4;
if (osuCurrent.Angle.Value < pi_over_2)
{
angleBonus = 1.28;
if (distance < 90 && osuCurrent.Angle.Value < pi_over_4)
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1);
else if (distance < 90)
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - osuCurrent.Angle.Value) / pi_over_4);
}
} }
return ((1 + (speedBonus - 1) * 0.75) * angleBonus * speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / osuCurrent.StrainTime; return (angleBonus * speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / osuCurrObj.StrainTime;
} }
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
@ -176,7 +168,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
double deltaTime = Math.Max(max_speed_bonus, current.DeltaTime); double deltaTime = Math.Max(max_speed_bonus, current.DeltaTime);
if (deltaTime < min_speed_bonus) if (deltaTime < min_speed_bonus)
speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2); speedBonus = 1 + 0.75 * Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2);
currentRhythm = calculateRhythmBonus(current); currentRhythm = calculateRhythmBonus(current);