mirror of
https://github.com/ppy/osu.git
synced 2025-03-03 23:23:25 +08:00
Consider aggregate peaks
This commit is contained in:
parent
68725dc005
commit
9cce9ce97c
@ -33,15 +33,44 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
{
|
{
|
||||||
var maniaAttributes = (ManiaDifficultyAttributes)attributes;
|
var maniaAttributes = (ManiaDifficultyAttributes)attributes;
|
||||||
|
|
||||||
var overallStrain = skills.OfType<Overall>().Single().DifficultyValue();
|
maniaAttributes.StarRating = difficultyValue(skills) * star_scaling_factor;
|
||||||
var highestIndividual = skills.OfType<Individual>().Max(s => s.DifficultyValue());
|
|
||||||
|
|
||||||
maniaAttributes.StarRating = (overallStrain + highestIndividual) * star_scaling_factor;
|
|
||||||
|
|
||||||
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
||||||
maniaAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate;
|
maniaAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double difficultyValue(Skill[] skills)
|
||||||
|
{
|
||||||
|
// Preprocess the strains to find the maximum overall + individual (aggregate) strain from each section
|
||||||
|
var overall = skills.OfType<Overall>().Single();
|
||||||
|
var aggregatePeaks = new List<double>(Enumerable.Repeat(0.0, overall.StrainPeaks.Count));
|
||||||
|
|
||||||
|
foreach (var individual in skills.OfType<Individual>())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < individual.StrainPeaks.Count; i++)
|
||||||
|
{
|
||||||
|
double aggregate = individual.StrainPeaks[i] + overall.StrainPeaks[i];
|
||||||
|
|
||||||
|
if (aggregate > aggregatePeaks[i])
|
||||||
|
aggregatePeaks[i] = aggregate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aggregatePeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
||||||
|
|
||||||
|
double difficulty = 0;
|
||||||
|
double weight = 1;
|
||||||
|
|
||||||
|
// Difficulty is the weighted sum of the highest strains from every section.
|
||||||
|
foreach (double strain in aggregatePeaks)
|
||||||
|
{
|
||||||
|
difficulty += strain * weight;
|
||||||
|
weight *= 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
return difficulty;
|
||||||
|
}
|
||||||
|
|
||||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate)
|
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate)
|
||||||
{
|
{
|
||||||
columnCount = ((ManiaBeatmap)beatmap).TotalColumns;
|
columnCount = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||||
|
@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.Difficulty.Skills
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class Skill
|
public abstract class Skill
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The peak strain for each <see cref="DifficultyCalculator.SectionLength"/> section of the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public IList<double> StrainPeaks => strainPeaks;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other.
|
/// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,6 +42,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills
|
|||||||
|
|
||||||
private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap.
|
private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap.
|
||||||
private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section.
|
private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section.
|
||||||
|
|
||||||
private readonly List<double> strainPeaks = new List<double>();
|
private readonly List<double> strainPeaks = new List<double>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user