mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Merge pull request #14846 from emu1337/aim-refactor-slider
osu! Difficulty Aim Overhaul: slider change
This commit is contained in:
@ -15,13 +15,13 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
|
||||||
|
|
||||||
[TestCase(6.5295339534769958d, "diffcalc-test")]
|
[TestCase(6.531832890435525d, "diffcalc-test")]
|
||||||
[TestCase(1.1514260533755143d, "zero-length-sliders")]
|
[TestCase(1.4644923495008817d, "zero-length-sliders")]
|
||||||
public void Test(double expected, string name)
|
public void Test(double expected, string name)
|
||||||
=> base.Test(expected, name);
|
=> base.Test(expected, name);
|
||||||
|
|
||||||
[TestCase(9.047752485219954d, "diffcalc-test")]
|
[TestCase(8.8067616302940852d, "diffcalc-test")]
|
||||||
[TestCase(1.3985711787077566d, "zero-length-sliders")]
|
[TestCase(1.7763214959309293d, "zero-length-sliders")]
|
||||||
public void TestClockRateAdjusted(double expected, string name)
|
public void TestClockRateAdjusted(double expected, string name)
|
||||||
=> Test(expected, name, new OsuModDoubleTime());
|
=> Test(expected, name, new OsuModDoubleTime());
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -14,6 +13,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
|||||||
{
|
{
|
||||||
private const int normalized_radius = 50; // Change radius to 50 to make 100 the diameter. Easier for mental maths.
|
private const int normalized_radius = 50; // Change radius to 50 to make 100 the diameter. Easier for mental maths.
|
||||||
private const int min_delta_time = 25;
|
private const int min_delta_time = 25;
|
||||||
|
private const float maximum_slider_radius = normalized_radius * 2.4f;
|
||||||
|
private const float assumed_slider_radius = normalized_radius * 1.65f;
|
||||||
|
|
||||||
protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject;
|
protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject;
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
|||||||
if (lastObject is Slider lastSlider)
|
if (lastObject is Slider lastSlider)
|
||||||
{
|
{
|
||||||
computeSliderCursorPosition(lastSlider);
|
computeSliderCursorPosition(lastSlider);
|
||||||
TravelDistance = lastSlider.LazyTravelDistance * scalingFactor;
|
TravelDistance = lastSlider.LazyTravelDistance;
|
||||||
TravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, min_delta_time);
|
TravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, min_delta_time);
|
||||||
MovementTime = Math.Max(StrainTime - TravelTime, min_delta_time);
|
MovementTime = Math.Max(StrainTime - TravelTime, min_delta_time);
|
||||||
|
|
||||||
@ -99,7 +100,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
|||||||
// For hitobjects which continue in the direction of the slider, the player will normally follow through the slider,
|
// For hitobjects which continue in the direction of the slider, the player will normally follow through the slider,
|
||||||
// such that they're not jumping from the lazy position but rather from very close to (or the end of) the slider.
|
// such that they're not jumping from the lazy position but rather from very close to (or the end of) the slider.
|
||||||
// In such cases, a leniency is applied by also considering the jump distance from the tail of the slider, and taking the minimum jump distance.
|
// In such cases, a leniency is applied by also considering the jump distance from the tail of the slider, and taking the minimum jump distance.
|
||||||
MovementDistance = Math.Min(JumpDistance, tailJumpDistance);
|
// Additional distance is removed based on position of jump relative to slider follow circle radius.
|
||||||
|
// JumpDistance is the leniency distance beyond the assumed_slider_radius. tailJumpDistance is maximum_slider_radius since the full distance of radial leniency is still possible.
|
||||||
|
MovementDistance = Math.Max(0, Math.Min(JumpDistance - (maximum_slider_radius - assumed_slider_radius), tailJumpDistance - maximum_slider_radius));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -126,37 +129,60 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
|||||||
if (slider.LazyEndPosition != null)
|
if (slider.LazyEndPosition != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
slider.LazyEndPosition = slider.StackedPosition;
|
slider.LazyTravelTime = slider.NestedHitObjects[^1].StartTime - slider.StartTime;
|
||||||
|
|
||||||
float followCircleRadius = (float)(slider.Radius * 2.4);
|
double endTimeMin = slider.LazyTravelTime / slider.SpanDuration;
|
||||||
var computeVertex = new Action<double>(t =>
|
if (endTimeMin % 2 >= 1)
|
||||||
|
endTimeMin = 1 - endTimeMin % 1;
|
||||||
|
else
|
||||||
|
endTimeMin %= 1;
|
||||||
|
|
||||||
|
slider.LazyEndPosition = slider.StackedPosition + slider.Path.PositionAt(endTimeMin); // temporary lazy end position until a real result can be derived.
|
||||||
|
var currCursorPosition = slider.StackedPosition;
|
||||||
|
double scalingFactor = normalized_radius / slider.Radius; // lazySliderDistance is coded to be sensitive to scaling, this makes the maths easier with the thresholds being used.
|
||||||
|
|
||||||
|
for (int i = 1; i < slider.NestedHitObjects.Count; i++)
|
||||||
{
|
{
|
||||||
double progress = (t - slider.StartTime) / slider.SpanDuration;
|
var currMovementObj = (OsuHitObject)slider.NestedHitObjects[i];
|
||||||
if (progress % 2 >= 1)
|
|
||||||
progress = 1 - progress % 1;
|
|
||||||
else
|
|
||||||
progress %= 1;
|
|
||||||
|
|
||||||
// ReSharper disable once PossibleInvalidOperationException (bugged in current r# version)
|
Vector2 currMovement = Vector2.Subtract(currMovementObj.StackedPosition, currCursorPosition);
|
||||||
var diff = slider.StackedPosition + slider.Path.PositionAt(progress) - slider.LazyEndPosition.Value;
|
double currMovementLength = scalingFactor * currMovement.Length;
|
||||||
float dist = diff.Length;
|
|
||||||
|
|
||||||
slider.LazyTravelTime = t - slider.StartTime;
|
// Amount of movement required so that the cursor position needs to be updated.
|
||||||
|
double requiredMovement = assumed_slider_radius;
|
||||||
|
|
||||||
if (dist > followCircleRadius)
|
if (i == slider.NestedHitObjects.Count - 1)
|
||||||
{
|
{
|
||||||
// The cursor would be outside the follow circle, we need to move it
|
// The end of a slider has special aim rules due to the relaxed time constraint on position.
|
||||||
diff.Normalize(); // Obtain direction of diff
|
// There is both a lazy end position as well as the actual end slider position. We assume the player takes the simpler movement.
|
||||||
dist -= followCircleRadius;
|
// For sliders that are circular, the lazy end position may actually be farther away than the sliders true end.
|
||||||
slider.LazyEndPosition += diff * dist;
|
// This code is designed to prevent buffing situations where lazy end is actually a less efficient movement.
|
||||||
slider.LazyTravelDistance += dist;
|
Vector2 lazyMovement = Vector2.Subtract((Vector2)slider.LazyEndPosition, currCursorPosition);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Skip the head circle
|
if (lazyMovement.Length < currMovement.Length)
|
||||||
var scoringTimes = slider.NestedHitObjects.Skip(1).Select(t => t.StartTime);
|
currMovement = lazyMovement;
|
||||||
foreach (double time in scoringTimes)
|
|
||||||
computeVertex(time);
|
currMovementLength = scalingFactor * currMovement.Length;
|
||||||
|
}
|
||||||
|
else if (currMovementObj is SliderRepeat)
|
||||||
|
{
|
||||||
|
// For a slider repeat, assume a tighter movement threshold to better assess repeat sliders.
|
||||||
|
requiredMovement = normalized_radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currMovementLength > requiredMovement)
|
||||||
|
{
|
||||||
|
// this finds the positional delta from the required radius and the current position, and updates the currCursorPosition accordingly, as well as rewarding distance.
|
||||||
|
currCursorPosition = Vector2.Add(currCursorPosition, Vector2.Multiply(currMovement, (float)((currMovementLength - requiredMovement) / currMovementLength)));
|
||||||
|
currMovementLength *= (currMovementLength - requiredMovement) / currMovementLength;
|
||||||
|
slider.LazyTravelDistance += (float)currMovementLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == slider.NestedHitObjects.Count - 1)
|
||||||
|
slider.LazyEndPosition = currCursorPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
slider.LazyTravelDistance *= (float)Math.Pow(1 + slider.RepeatCount / 2.5, 1.0 / 2.5); // Bonus for repeat sliders until a better per nested object strain system can be achieved.
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 getEndCursorPosition(OsuHitObject hitObject)
|
private Vector2 getEndCursorPosition(OsuHitObject hitObject)
|
||||||
|
@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
|||||||
|
|
||||||
private const double wide_angle_multiplier = 1.5;
|
private const double wide_angle_multiplier = 1.5;
|
||||||
private const double acute_angle_multiplier = 2.0;
|
private const double acute_angle_multiplier = 2.0;
|
||||||
|
private const double slider_multiplier = 1.5;
|
||||||
|
|
||||||
private double currentStrain = 1;
|
private double currentStrain = 1;
|
||||||
|
|
||||||
@ -62,6 +63,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
|||||||
}
|
}
|
||||||
|
|
||||||
double angleBonus = 0;
|
double angleBonus = 0;
|
||||||
|
double sliderBonus = 0;
|
||||||
|
|
||||||
double aimStrain = currVelocity; // Start strain with regular velocity.
|
double aimStrain = currVelocity; // Start strain with regular velocity.
|
||||||
|
|
||||||
if (Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime) < 1.25 * Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime)) // If rhythms are the same.
|
if (Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime) < 1.25 * Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime)) // If rhythms are the same.
|
||||||
@ -91,11 +94,17 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
|||||||
wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute.
|
wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute.
|
||||||
acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse.
|
acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse.
|
||||||
|
|
||||||
angleBonus = acuteAngleBonus * acute_angle_multiplier + wideAngleBonus * wide_angle_multiplier; // add the angle buffs together.
|
angleBonus = Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier); // Take the max of the multipliers.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (osuCurrObj.TravelTime != 0)
|
||||||
|
{
|
||||||
|
sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.TravelTime; // add some slider rewards
|
||||||
|
}
|
||||||
|
|
||||||
aimStrain += angleBonus; // Add in angle bonus.
|
aimStrain += angleBonus; // Add in angle bonus.
|
||||||
|
aimStrain += sliderBonus * slider_multiplier; // Add in additional slider velocity.
|
||||||
|
|
||||||
return aimStrain;
|
return aimStrain;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user