mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 03:02:56 +08:00
optimisation
This commit is contained in:
parent
6ec5bb5dca
commit
c4af2bbf69
@ -192,7 +192,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
||||
if (current.BaseObject is Spinner || current.Index == 0)
|
||||
return 0;
|
||||
|
||||
double difficulty = Math.Pow(4 * Math.Log(Math.Max(1, EvaluateDensityOf(current))), 2.5);
|
||||
double difficulty = Math.Pow(4 * Math.Log(Math.Max(1, ((OsuDifficultyHitObject)current).Density)), 2.5);
|
||||
|
||||
double overlapBonus = EvaluateOverlapDifficultyOf(current) * difficulty;
|
||||
difficulty += overlapBonus;
|
||||
@ -202,7 +202,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
||||
|
||||
public static double EvaluateAimingDensityFactorOf(DifficultyHitObject current)
|
||||
{
|
||||
double difficulty = EvaluateDensityOf(current);
|
||||
double difficulty = ((OsuDifficultyHitObject)current).Density;
|
||||
|
||||
double overlapBonus = EvaluateOverlapDifficultyOf(current) * difficulty;
|
||||
difficulty += overlapBonus * 0.1; // Overlaps should affect aiming part much less
|
||||
@ -330,10 +330,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
||||
{
|
||||
var currObj = (OsuDifficultyHitObject)current;
|
||||
|
||||
double density = ReadingEvaluator.EvaluateDensityOf(current, false);
|
||||
|
||||
// Consider that density matters only starting from 3rd note on the screen
|
||||
double densityFactor = Math.Max(0, density - 1) / 4;
|
||||
double densityFactor = Math.Max(0, currObj.Density - 1) / 4;
|
||||
|
||||
// This is kinda wrong cuz it returns value bigger than preempt
|
||||
// double timeSpentInvisible = getDurationSpentInvisible(currObj) / 1000 / currObj.ClockRate;
|
||||
|
@ -90,6 +90,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
/// </summary>
|
||||
public double RhythmDifficulty { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Density of the object for given preempt. Saved for optimization, density calculation is expensive.
|
||||
/// </summary>
|
||||
public double Density { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Objects that was visible after the note was hit together with cumulative overlapping difficulty. Saved for optimization to avoid O(x^4) time complexity.
|
||||
/// </summary>
|
||||
@ -140,8 +145,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
setDistances(clockRate);
|
||||
|
||||
RhythmDifficulty = RhythmEvaluator.EvaluateDifficultyOf(this);
|
||||
Density = ReadingEvaluator.EvaluateDensityOf(this);
|
||||
OverlapObjects = getOverlapObjects();
|
||||
}
|
||||
|
||||
OverlapObjects = new List<OverlapObject>();
|
||||
private List<OverlapObject> getOverlapObjects()
|
||||
{
|
||||
List<OverlapObject> overlapObjects = new List<OverlapObject>();
|
||||
|
||||
double totalOverlapnessDifficulty = 0;
|
||||
double currentTime = DeltaTime;
|
||||
@ -204,9 +214,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
}
|
||||
|
||||
totalOverlapnessDifficulty += currentOverlapness;
|
||||
OverlapObjects.Add(new OverlapObject(loopObj, totalOverlapnessDifficulty));
|
||||
overlapObjects.Add(new OverlapObject(loopObj, totalOverlapnessDifficulty));
|
||||
prevObject = loopObj;
|
||||
}
|
||||
|
||||
return overlapObjects;
|
||||
}
|
||||
|
||||
private static double getSimilarity(double timeA, double timeB)
|
||||
|
Loading…
Reference in New Issue
Block a user