mirror of
https://github.com/ppy/osu
synced 2025-01-20 04:50:50 +00:00
Merge pull request #11849 from Syriiin/diffcalc/fix/clockrate-adjusted-decay
Fix clockrate adjusted difficulty calculations bug in strain decay
This commit is contained in:
commit
0c35128ead
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
[TestCase(5.0565038923984691d, "diffcalc-test")]
|
||||
[TestCase(5.169743871843191d, "diffcalc-test")]
|
||||
public void TestClockRateAdjusted(double expected, string name)
|
||||
=> Test(expected, name, new CatchModDoubleTime());
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
[TestCase(2.7646128945056723d, "diffcalc-test")]
|
||||
[TestCase(2.7879104989252959d, "diffcalc-test")]
|
||||
public void TestClockRateAdjusted(double expected, string name)
|
||||
=> Test(expected, name, new ManiaModDoubleTime());
|
||||
|
||||
|
@ -73,8 +73,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
||||
}
|
||||
|
||||
protected override double GetPeakStrain(double offset)
|
||||
=> applyDecay(individualStrain, offset - Previous[0].BaseObject.StartTime, individual_decay_base)
|
||||
+ applyDecay(overallStrain, offset - Previous[0].BaseObject.StartTime, overall_decay_base);
|
||||
=> applyDecay(individualStrain, offset - Previous[0].StartTime, individual_decay_base)
|
||||
+ applyDecay(overallStrain, offset - Previous[0].StartTime, overall_decay_base);
|
||||
|
||||
private double applyDecay(double value, double deltaTime, double decayBase)
|
||||
=> value * Math.Pow(decayBase, deltaTime / 1000);
|
||||
|
@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
[TestCase(8.6228371119271454d, "diffcalc-test")]
|
||||
[TestCase(1.2864585280364178d, "zero-length-sliders")]
|
||||
[TestCase(8.7212283220412345d, "diffcalc-test")]
|
||||
[TestCase(1.3212137158641493d, "zero-length-sliders")]
|
||||
public void TestClockRateAdjusted(double expected, string name)
|
||||
=> Test(expected, name, new OsuModDoubleTime());
|
||||
|
||||
|
@ -19,8 +19,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
[TestCase(3.1473940254109078d, "diffcalc-test")]
|
||||
[TestCase(3.1473940254109078d, "diffcalc-test-strong")]
|
||||
[TestCase(3.1704781712282624d, "diffcalc-test")]
|
||||
[TestCase(3.1704781712282624d, "diffcalc-test-strong")]
|
||||
public void TestClockRateAdjusted(double expected, string name)
|
||||
=> Test(expected, name, new TaikoModDoubleTime());
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
foreach (Skill s in skills)
|
||||
{
|
||||
s.SaveCurrentPeak();
|
||||
s.StartNewSectionFrom(currentSectionEnd);
|
||||
s.StartNewSectionFrom(currentSectionEnd / clockRate);
|
||||
}
|
||||
|
||||
currentSectionEnd += sectionLength;
|
||||
|
@ -25,6 +25,16 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
/// </summary>
|
||||
public readonly double DeltaTime;
|
||||
|
||||
/// <summary>
|
||||
/// Clockrate adjusted start time of <see cref="BaseObject"/>.
|
||||
/// </summary>
|
||||
public readonly double StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// Clockrate adjusted end time of <see cref="BaseObject"/>.
|
||||
/// </summary>
|
||||
public readonly double EndTime;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DifficultyHitObject"/>.
|
||||
/// </summary>
|
||||
@ -36,6 +46,8 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
BaseObject = hitObject;
|
||||
LastObject = lastObject;
|
||||
DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate;
|
||||
StartTime = hitObject.StartTime / clockRate;
|
||||
EndTime = hitObject.GetEndTime() / clockRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills
|
||||
/// <summary>
|
||||
/// Sets the initial strain level for a new section.
|
||||
/// </summary>
|
||||
/// <param name="time">The beginning of the new section in milliseconds.</param>
|
||||
/// <param name="time">The beginning of the new section in milliseconds, adjusted by clockrate.</param>
|
||||
public void StartNewSectionFrom(double time)
|
||||
{
|
||||
// The maximum strain of the new section is not zero by default, strain decays as usual regardless of section boundaries.
|
||||
@ -100,9 +100,9 @@ namespace osu.Game.Rulesets.Difficulty.Skills
|
||||
/// <summary>
|
||||
/// Retrieves the peak strain at a point in time.
|
||||
/// </summary>
|
||||
/// <param name="time">The time to retrieve the peak strain at.</param>
|
||||
/// <param name="time">The time to retrieve the peak strain at, adjusted by clockrate.</param>
|
||||
/// <returns>The peak strain.</returns>
|
||||
protected virtual double GetPeakStrain(double time) => CurrentStrain * strainDecay(time - Previous[0].BaseObject.StartTime);
|
||||
protected virtual double GetPeakStrain(double time) => CurrentStrain * strainDecay(time - Previous[0].StartTime);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the calculated difficulty value representing all processed <see cref="DifficultyHitObject"/>s.
|
||||
|
Loading…
Reference in New Issue
Block a user