Skip to content

Commit

Permalink
Remove aim scaling, penalize speed differently
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr0stium committed Jul 18, 2024
1 parent 46c9edb commit 36d3d0f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
4 changes: 4 additions & 0 deletions osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class OsuDifficultyAttributes : DifficultyAttributes
[JsonProperty("speed_note_count")]
public double SpeedNoteCount { get; set; }

[JsonProperty("avg_delta_time")]
public double AverageDeltaTime { get; set; }

/// <summary>
/// The difficulty corresponding to the flashlight skill.
/// </summary>
Expand Down Expand Up @@ -114,6 +117,7 @@ public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> val
FlashlightDifficulty = values.GetValueOrDefault(ATTRIB_ID_FLASHLIGHT);
SliderFactor = values[ATTRIB_ID_SLIDER_FACTOR];
SpeedNoteCount = values[ATTRIB_ID_SPEED_NOTE_COUNT];
AverageDeltaTime = values[ATTRIB_ID_AVG_DELTA_TIME];

DrainRate = onlineInfo.DrainRate;
HitCircleCount = onlineInfo.CircleCount;
Expand Down
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier;
double speedNotes = ((Speed)skills[2]).RelevantNoteCount();
double avgDeltaTime = ((Speed)skills[2]).WeightedAverageDeltaTime();

double flashlightRating = 0.0;

Expand Down Expand Up @@ -99,6 +100,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
AimDifficulty = aimRating,
SpeedDifficulty = speedRating,
SpeedNoteCount = speedNotes,
AverageDeltaTime = avgDeltaTime,
FlashlightDifficulty = flashlightRating,
SliderFactor = sliderFactor,
ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5,
Expand Down
5 changes: 3 additions & 2 deletions osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ private double computeAimValue(ScoreInfo score, OsuDifficultyAttributes attribut
}

aimValue *= 0.98 + Math.Pow(100.0 / 9, 2) / 2500; // OD 11 SS stays the same.
aimValue *= 1 / (1 + Math.Pow((double)deviation / 30, 4)); // Scale the aim value with deviation.

return aimValue;
}
Expand Down Expand Up @@ -180,8 +179,10 @@ private double computeSpeedValue(ScoreInfo score, OsuDifficultyAttributes attrib
speedValue *= 1.0 + 0.04 * (12.0 - attributes.ApproachRate);
}

double avgDeltaTime = attributes.AverageDeltaTime;

speedValue *= 0.95 + Math.Pow(100.0 / 9, 2) / 750; // OD 11 SS stays the same.
speedValue *= 1 / (1 + Math.Pow(speedDeviation / 20, 4)); // Scale the speed value with speed deviation.
speedValue *= 1 / (1 + Math.Pow(4 * speedDeviation / avgDeltaTime, 4));

return speedValue;
}
Expand Down
21 changes: 21 additions & 0 deletions osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Speed : OsuStrainSkill
protected override double DifficultyMultiplier => 1.04;

private readonly List<double> objectStrainsNoDistance = new List<double>();
private readonly List<double> deltaTimes = new List<double>();

public Speed(Mod[] mods)
: base(mods)
Expand Down Expand Up @@ -56,6 +57,7 @@ protected override double StrainValueAt(DifficultyHitObject current)
double totalStrainNoDistance = currentStrainNoDistance * currentRhythm;

objectStrainsNoDistance.Add(totalStrainNoDistance);
deltaTimes.Add(((OsuDifficultyHitObject)current).StrainTime);

return totalStrain;
}
Expand All @@ -72,5 +74,24 @@ public double RelevantNoteCount()

return objectStrainsNoDistance.Sum(strain => strain / maxStrain);
}

public double WeightedAverageDeltaTime()
{
if (objectStrainsNoDistance.Count == 0)
return double.PositiveInfinity;

double weight = 0;
double sum = 0;

for (int i = 0; i < deltaTimes.Count; i++)
{
double objectStrainNoDistance = objectStrainsNoDistance[i];
weight += objectStrainNoDistance;
sum += objectStrainNoDistance * deltaTimes[i];
}

sum /= weight;
return sum;
}
}
}
1 change: 1 addition & 0 deletions osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class DifficultyAttributes
protected const int ATTRIB_ID_FLASHLIGHT = 17;
protected const int ATTRIB_ID_SLIDER_FACTOR = 19;
protected const int ATTRIB_ID_SPEED_NOTE_COUNT = 21;
protected const int ATTRIB_ID_AVG_DELTA_TIME = 23;

/// <summary>
/// The mods which were applied to the beatmap.
Expand Down

0 comments on commit 36d3d0f

Please sign in to comment.