1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-20 12:00:11 +08:00

Standardize difficulty variable naming (#37460)

All occurrences of a difficulty variable in an evaluator are now called
evalNameDifficulty, of the raw output of this in a skill are now
referred to as difficulty, and of the strain adjusted versions are
referred to as strain.

Co-authored-by: StanR <8269193+stanriders@users.noreply.github.com>
This commit is contained in:
Natelytle
2026-04-24 11:54:43 -04:00
committed by GitHub
Unverified
parent 8d079a6790
commit 5b073e6528
7 changed files with 36 additions and 36 deletions
@@ -28,13 +28,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators.Aim
double distanceScaled = Math.Min(distance, distance_cap) / distance_cap;
double strain = distanceScaled * 1000 / osuCurrObj.AdjustedDeltaTime;
double agilityDifficulty = distanceScaled * 1000 / osuCurrObj.AdjustedDeltaTime;
strain *= Math.Pow(osuCurrObj.SmallCircleBonus, 1.5);
agilityDifficulty *= Math.Pow(osuCurrObj.SmallCircleBonus, 1.5);
strain *= highBpmBonus(osuCurrObj.AdjustedDeltaTime);
agilityDifficulty *= highBpmBonus(osuCurrObj.AdjustedDeltaTime);
return strain;
return agilityDifficulty;
}
private static double highBpmBonus(double ms) => 1 / (1 - Math.Pow(0.2, ms / 1000));
@@ -55,10 +55,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators.Aim
double prevDistance = withSliderTravelDistance ? osuLastObj.LazyJumpDistance : osuLastObj.JumpDistance;
double prevVelocity = prevDistance / osuLastObj.AdjustedDeltaTime;
double aimStrain = currVelocity; // Start strain with regular velocity.
double snapDifficulty = currVelocity; // Start difficulty with regular velocity.
// Penalize angle repetition.
aimStrain *= vectorAngleRepetition(osuCurrObj, osuLastObj);
snapDifficulty *= vectorAngleRepetition(osuCurrObj, osuLastObj);
if (osuCurrObj.Angle != null && osuLastObj.Angle != null)
{
@@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators.Aim
}
// Add in acute angle bonus or wide angle bonus, whichever is larger.
aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier);
snapDifficulty += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier);
// Apply wiggle bonus for jumps that are [radius, 3*diameter] in distance, with < 110 angle
// https://www.desmos.com/calculator/dp0v0nvowc
@@ -128,7 +128,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators.Aim
* Math.Pow(DifficultyCalculationUtils.ReverseLerp(prevDistance, diameter * 3, diameter), 1.8)
* DifficultyCalculationUtils.Smootherstep(lastAngle, double.DegreesToRadians(110), double.DegreesToRadians(60));
aimStrain += wiggleBonus * wiggle_multiplier;
snapDifficulty += wiggleBonus * wiggle_multiplier;
}
if (Math.Max(prevVelocity, currVelocity) != 0)
@@ -150,22 +150,22 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators.Aim
// Penalize for rhythm changes.
velocityChangeBonus *= Math.Pow(Math.Min(osuCurrObj.AdjustedDeltaTime, osuLastObj.AdjustedDeltaTime) / Math.Max(osuCurrObj.AdjustedDeltaTime, osuLastObj.AdjustedDeltaTime), 2);
aimStrain += velocityChangeBonus * velocity_change_multiplier;
snapDifficulty += velocityChangeBonus * velocity_change_multiplier;
}
// Reward sliders based on velocity.
if (osuCurrObj.BaseObject is Slider && withSliderTravelDistance)
{
double sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.TravelTime;
aimStrain += (sliderBonus < 1 ? sliderBonus : Math.Pow(sliderBonus, 0.75)) * slider_multiplier;
snapDifficulty += (sliderBonus < 1 ? sliderBonus : Math.Pow(sliderBonus, 0.75)) * slider_multiplier;
}
// Apply high circle size bonus
aimStrain *= osuCurrObj.SmallCircleBonus;
snapDifficulty *= osuCurrObj.SmallCircleBonus;
aimStrain *= highBpmBonus(osuCurrObj.AdjustedDeltaTime);
snapDifficulty *= highBpmBonus(osuCurrObj.AdjustedDeltaTime);
return aimStrain;
return snapDifficulty;
}
private static double highBpmBonus(double ms) => 1 / (1 - Math.Pow(0.03, Math.Pow(ms / 1000, 0.65)));
@@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
double smallDistNerf = 1.0;
double cumulativeStrainTime = 0.0;
double result = 0.0;
double flashlightDifficulty = 0.0;
OsuDifficultyHitObject lastObj = osuCurrent;
@@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
// Bonus based on how visible the object is.
double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, mods.OfType<OsuModHidden>().Any(m => !m.OnlyFadeApproachCircles.Value)));
result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;
flashlightDifficulty += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;
if (currentObj.Angle != null && osuCurrent.Angle != null)
{
@@ -85,14 +85,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
lastObj = currentObj;
}
result = Math.Pow(smallDistNerf * result, 2.0);
flashlightDifficulty = Math.Pow(smallDistNerf * flashlightDifficulty, 2.0);
// Additional bonus for Hidden due to there being no approach circles.
if (mods.OfType<OsuModHidden>().Any())
result *= 1.0 + hidden_bonus;
flashlightDifficulty *= 1.0 + hidden_bonus;
// Nerf patterns with repeated angles.
result *= min_angle_multiplier + (1.0 - min_angle_multiplier) / (angleRepeatCount + 1.0);
flashlightDifficulty *= min_angle_multiplier + (1.0 - min_angle_multiplier) / (angleRepeatCount + 1.0);
double sliderBonus = 0.0;
@@ -112,9 +112,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
sliderBonus /= (osuSlider.RepeatCount + 1);
}
result += sliderBonus * slider_multiplier;
flashlightDifficulty += sliderBonus * slider_multiplier;
return result;
return flashlightDifficulty;
}
}
}
@@ -46,12 +46,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
double preemptDifficulty = calculatePreemptDifficulty(velocity, constantAngleNerfFactor, currObj.Preempt);
double difficulty = DifficultyCalculationUtils.Norm(1.5, preemptDifficulty, hiddenDifficulty, noteDensityDifficulty);
double readingDifficulty = DifficultyCalculationUtils.Norm(1.5, preemptDifficulty, hiddenDifficulty, noteDensityDifficulty);
// Having less time to process information is harder
difficulty *= highBpmBonus(currObj.AdjustedDeltaTime);
readingDifficulty *= highBpmBonus(currObj.AdjustedDeltaTime);
return difficulty;
return readingDifficulty;
}
/// <summary>
@@ -44,12 +44,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators.Speed
speedBonus = 0.75 * Math.Pow((DifficultyCalculationUtils.BPMToMilliseconds(min_speed_bonus) - strainTime) / speed_balancing_factor, 2);
// Base difficulty with all bonuses
double difficulty = (1 + speedBonus) * 1000 / strainTime;
double speedDifficulty = (1 + speedBonus) * 1000 / strainTime;
difficulty *= highBpmBonus(osuCurrObj.AdjustedDeltaTime);
speedDifficulty *= highBpmBonus(osuCurrObj.AdjustedDeltaTime);
// Apply penalty if there's doubletappable doubles
return difficulty * doubletapness;
return speedDifficulty * doubletapness;
}
private static double highBpmBonus(double ms) => 1 / (1 - Math.Pow(0.3, ms / 1000));
@@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
hasHiddenMod = mods.OfType<OsuModHidden>().Any(m => !m.OnlyFadeApproachCircles.Value);
}
private double currentDifficulty;
private double currentStrain;
private double skillMultiplier => 2.5;
private double strainDecayBase => 0.8;
@@ -39,11 +39,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
double decay = strainDecay(current.DeltaTime);
currentDifficulty *= decay;
currentStrain *= decay;
currentDifficulty += ReadingEvaluator.EvaluateDifficultyOf(current, hasHiddenMod) * (1 - decay) * skillMultiplier;
currentStrain += ReadingEvaluator.EvaluateDifficultyOf(current, hasHiddenMod) * (1 - decay) * skillMultiplier;
return currentDifficulty;
return currentStrain;
}
protected override void ApplyDifficultyTransformation(double[] difficulties)
@@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
private readonly List<double> sliderStrains = new List<double>();
private double currentDifficulty;
private double currentStrain;
private double strainDecayBase => 0.3;
@@ -41,17 +41,17 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
{
double decay = strainDecay(((OsuDifficultyHitObject)current).AdjustedDeltaTime);
currentDifficulty *= decay;
currentDifficulty += SpeedEvaluator.EvaluateDifficultyOf(current) * (1 - decay) * skillMultiplier;
currentStrain *= decay;
currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current) * (1 - decay) * skillMultiplier;
double currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current);
double totalDifficulty = currentDifficulty * currentRhythm;
double totalStrain = currentStrain * currentRhythm;
if (current.BaseObject is Slider)
sliderStrains.Add(totalDifficulty);
sliderStrains.Add(totalStrain);
return totalDifficulty;
return totalStrain;
}
public double RelevantNoteCount()