Merge pull request #25695 from smoogipoo/fix-osu-conversion

Fix last tick handling in osu beatmap conversion tests
This commit is contained in:
Bartłomiej Dach 2023-12-07 09:09:12 +01:00 committed by GitHub
commit 73a491216c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1746 additions and 406 deletions

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects;
@ -15,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestFixture]
public class OsuBeatmapConversionTest : BeatmapConversionTest<ConvertValue>
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu.Tests";
[TestCase("basic")]
[TestCase("colinear-perfect-curve")]
@ -27,6 +26,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestCase("old-stacking")]
[TestCase("multi-segment-slider")]
[TestCase("nan-slider")]
[TestCase("1124896")]
public void Test(string name) => base.Test(name);
protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
@ -34,21 +34,8 @@ namespace osu.Game.Rulesets.Osu.Tests
switch (hitObject)
{
case Slider slider:
var objects = new List<ConvertValue>();
foreach (var nested in slider.NestedHitObjects)
objects.Add(createConvertValue((OsuHitObject)nested, slider));
// stable does slider tail leniency by offsetting the last tick 36ms back.
// based on player feedback, we're doing this a little different in lazer,
// and the lazer method does not require offsetting the last tick
// (see `DrawableSliderTail.CheckForResult()`).
// however, in conversion tests, just so the output matches, we're bringing
// the 36ms offset back locally.
// in particular, on some sliders, this may rearrange nested objects,
// so we sort them again by start time to prevent test failures.
foreach (var obj in objects.OrderBy(cv => cv.StartTime))
yield return obj;
yield return createConvertValue((OsuHitObject)nested, slider);
break;
@ -63,9 +50,8 @@ namespace osu.Game.Rulesets.Osu.Tests
double startTime = obj.StartTime;
double endTime = obj.GetEndTime();
// as stated in the inline comment above, this is locally bringing back
// the stable treatment of the "legacy last tick" just to make sure
// that the conversion output matches.
// this is locally bringing back the stable treatment of the "legacy last tick"
// just to make sure that the conversion output matches.
// compare: `SliderEventGenerator.Generate()`, and the calculation of `legacyLastTickTime`.
if (obj is SliderTailCircle && parent is Slider slider)
{

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestFixture]
public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu.Tests";
[TestCase(6.710442985146793d, 239, "diffcalc-test")]
[TestCase(1.4386882251130073d, 54, "zero-length-sliders")]

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,27 @@
osu file format v14
[Difficulty]
HPDrainRate:6
CircleSize:4
OverallDifficulty:7
ApproachRate:8.3
SliderMultiplier:1.6
SliderTickRate:1
[TimingPoints]
500,500,4,2,1,50,1,0
13426,-100,4,3,1,45,0,0
14884,-100,4,2,1,50,0,0
[HitObjects]
96,192,500,6,0,L|416:192,2,320
256,192,3000,12,0,4000,0:0:0:0:
256,192,4500,12,0,5500,0:0:0:0:
256,192,6000,12,0,6500,0:0:0:0:
256,128,7000,6,0,L|352:128,4,80
32,192,8500,6,0,B|32:384|256:384|256:192|256:192|256:0|512:0|512:192,1,800
256,192,11500,12,0,12000,0:0:0:0:
512,320,12500,6,0,B|0:256|0:256|512:96|512:96|256:32,1,1280
256,256,17000,6,0,L|160:256,4,80
256,192,18500,12,0,19450,0:0:0:0:
216,231,19875,6,0,B|216:135|280:135|344:135|344:199|344:263|248:327|248:327|120:327|120:327|56:39|408:39|408:39|472:150|408:342,1,1280
osu file format v14
[Difficulty]
HPDrainRate:6
CircleSize:4
OverallDifficulty:7
ApproachRate:8.3
SliderMultiplier:1.6
SliderTickRate:1
[TimingPoints]
500,500,4,2,1,50,1,0
13426,-100,4,3,1,45,0,0
14884,-100,4,2,1,50,0,0
[HitObjects]
96,192,500,6,0,L|416:192,2,320
256,192,3000,12,0,4000,0:0:0:0:
256,192,4500,12,0,5500,0:0:0:0:
256,192,6000,12,0,6500,0:0:0:0:
256,128,7000,6,0,L|352:128,4,80
32,192,8500,6,0,B|32:384|256:384|256:192|256:192|256:0|512:0|512:192,1,800
256,192,11500,12,0,12000,0:0:0:0:
512,320,12500,6,0,B|0:256|0:256|512:96|512:96|256:32,1,1280
256,256,17000,6,0,L|160:256,4,80
256,192,18500,12,0,19450,0:0:0:0:
216,231,19875,6,0,B|216:135|280:135|344:135|344:199|344:263|248:327|248:327|120:327|120:327|56:39|408:39|408:39|472:150|408:342,1,1280

View File

@ -13,16 +13,6 @@
"Y": 0.0
}
},
{
"StartTime": 7817.0,
"EndTime": 7817.0,
"X": 30.9946651,
"Y": 208.5157,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 7843.0,
"EndTime": 7843.0,
@ -32,8 +22,18 @@
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 7817.0,
"EndTime": 7817.0,
"X": 30.9946651,
"Y": 208.5157,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
}
]
}
]
}
}

View File

@ -0,0 +1,579 @@
{
"Mappings": [
{
"StartTime": 369.0,
"Objects": [
{
"StartTime": 369.0,
"EndTime": 369.0,
"X": 127.0,
"Y": 194.0,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 450.0,
"EndTime": 450.0,
"X": 166.53389,
"Y": 193.8691,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 532.0,
"EndTime": 532.0,
"X": 206.555847,
"Y": 193.736572,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 614.0,
"EndTime": 614.0,
"X": 246.57782,
"Y": 193.60405,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 696.0,
"EndTime": 696.0,
"X": 286.5998,
"Y": 193.471527,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 778.0,
"EndTime": 778.0,
"X": 326.621765,
"Y": 193.339,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 860.0,
"EndTime": 860.0,
"X": 366.6437,
"Y": 193.206482,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 942.0,
"EndTime": 942.0,
"X": 406.66568,
"Y": 193.073959,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 970.0,
"EndTime": 970.0,
"X": 420.331726,
"Y": 193.0287,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 997.0,
"EndTime": 997.0,
"X": 407.153748,
"Y": 193.072342,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1079.0,
"EndTime": 1079.0,
"X": 367.131775,
"Y": 193.204865,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1161.0,
"EndTime": 1161.0,
"X": 327.1098,
"Y": 193.337387,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1243.0,
"EndTime": 1243.0,
"X": 287.08783,
"Y": 193.46991,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1325.0,
"EndTime": 1325.0,
"X": 247.0659,
"Y": 193.602432,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1407.0,
"EndTime": 1407.0,
"X": 207.043915,
"Y": 193.734955,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1489.0,
"EndTime": 1489.0,
"X": 167.021988,
"Y": 193.867477,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1571.0,
"EndTime": 1571.0,
"X": 127.0,
"Y": 194.0,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1653.0,
"EndTime": 1653.0,
"X": 167.021988,
"Y": 193.867477,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1735.0,
"EndTime": 1735.0,
"X": 207.043976,
"Y": 193.734955,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1817.0,
"EndTime": 1817.0,
"X": 247.065887,
"Y": 193.602432,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1899.0,
"EndTime": 1899.0,
"X": 287.08783,
"Y": 193.46991,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 1981.0,
"EndTime": 1981.0,
"X": 327.1098,
"Y": 193.337387,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2062.0,
"EndTime": 2062.0,
"X": 366.643738,
"Y": 193.206482,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2144.0,
"EndTime": 2144.0,
"X": 406.665649,
"Y": 193.073959,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2172.0,
"EndTime": 2172.0,
"X": 420.331726,
"Y": 193.0287,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2199.0,
"EndTime": 2199.0,
"X": 407.153748,
"Y": 193.072342,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2281.0,
"EndTime": 2281.0,
"X": 367.1318,
"Y": 193.204865,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2363.0,
"EndTime": 2363.0,
"X": 327.1098,
"Y": 193.337387,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2445.0,
"EndTime": 2445.0,
"X": 287.08783,
"Y": 193.46991,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2527.0,
"EndTime": 2527.0,
"X": 247.065887,
"Y": 193.602432,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2609.0,
"EndTime": 2609.0,
"X": 207.043976,
"Y": 193.734955,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2691.0,
"EndTime": 2691.0,
"X": 167.021988,
"Y": 193.867477,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2773.0,
"EndTime": 2773.0,
"X": 127.0,
"Y": 194.0,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2855.0,
"EndTime": 2855.0,
"X": 167.021988,
"Y": 193.867477,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 2937.0,
"EndTime": 2937.0,
"X": 207.043976,
"Y": 193.734955,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3019.0,
"EndTime": 3019.0,
"X": 247.065948,
"Y": 193.602432,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3101.0,
"EndTime": 3101.0,
"X": 287.087952,
"Y": 193.46991,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3183.0,
"EndTime": 3183.0,
"X": 327.109772,
"Y": 193.337387,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3265.0,
"EndTime": 3265.0,
"X": 367.131775,
"Y": 193.204865,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3347.0,
"EndTime": 3347.0,
"X": 407.153748,
"Y": 193.072342,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3374.0,
"EndTime": 3374.0,
"X": 420.331726,
"Y": 193.0287,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3401.0,
"EndTime": 3401.0,
"X": 407.153748,
"Y": 193.072342,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3483.0,
"EndTime": 3483.0,
"X": 367.131775,
"Y": 193.204865,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3565.0,
"EndTime": 3565.0,
"X": 327.109772,
"Y": 193.337387,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3647.0,
"EndTime": 3647.0,
"X": 287.087952,
"Y": 193.46991,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3729.0,
"EndTime": 3729.0,
"X": 247.065948,
"Y": 193.602432,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3811.0,
"EndTime": 3811.0,
"X": 207.043976,
"Y": 193.734955,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3893.0,
"EndTime": 3893.0,
"X": 167.021988,
"Y": 193.867477,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 3975.0,
"EndTime": 3975.0,
"X": 127.0,
"Y": 194.0,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4057.0,
"EndTime": 4057.0,
"X": 167.021988,
"Y": 193.867477,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4139.0,
"EndTime": 4139.0,
"X": 207.043976,
"Y": 193.734955,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4221.0,
"EndTime": 4221.0,
"X": 247.065948,
"Y": 193.602432,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4303.0,
"EndTime": 4303.0,
"X": 287.087952,
"Y": 193.46991,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4385.0,
"EndTime": 4385.0,
"X": 327.109772,
"Y": 193.337387,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4467.0,
"EndTime": 4467.0,
"X": 367.131775,
"Y": 193.204865,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4549.0,
"EndTime": 4549.0,
"X": 407.153748,
"Y": 193.072342,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
},
{
"StartTime": 4540.0,
"EndTime": 4540.0,
"X": 420.331726,
"Y": 193.0287,
"StackOffset": {
"X": 0.0,
"Y": 0.0
}
}
]
}
]
}

View File

@ -1,348 +0,0 @@
{
"Mappings": [{
"StartTime": 369,
"Objects": [{
"StartTime": 369,
"EndTime": 369,
"X": 127,
"Y": 194
},
{
"StartTime": 450,
"EndTime": 450,
"X": 166.53389,
"Y": 193.8691
},
{
"StartTime": 532,
"EndTime": 532,
"X": 206.555847,
"Y": 193.736572
},
{
"StartTime": 614,
"EndTime": 614,
"X": 246.57782,
"Y": 193.60405
},
{
"StartTime": 696,
"EndTime": 696,
"X": 286.5998,
"Y": 193.471527
},
{
"StartTime": 778,
"EndTime": 778,
"X": 326.621765,
"Y": 193.339
},
{
"StartTime": 860,
"EndTime": 860,
"X": 366.6437,
"Y": 193.206482
},
{
"StartTime": 942,
"EndTime": 942,
"X": 406.66568,
"Y": 193.073959
},
{
"StartTime": 970,
"EndTime": 970,
"X": 420.331726,
"Y": 193.0287
},
{
"StartTime": 997,
"EndTime": 997,
"X": 407.153748,
"Y": 193.072342
},
{
"StartTime": 1079,
"EndTime": 1079,
"X": 367.131775,
"Y": 193.204865
},
{
"StartTime": 1161,
"EndTime": 1161,
"X": 327.1098,
"Y": 193.337387
},
{
"StartTime": 1243,
"EndTime": 1243,
"X": 287.08783,
"Y": 193.46991
},
{
"StartTime": 1325,
"EndTime": 1325,
"X": 247.0659,
"Y": 193.602432
},
{
"StartTime": 1407,
"EndTime": 1407,
"X": 207.043915,
"Y": 193.734955
},
{
"StartTime": 1489,
"EndTime": 1489,
"X": 167.021988,
"Y": 193.867477
},
{
"StartTime": 1571,
"EndTime": 1571,
"X": 127,
"Y": 194
},
{
"StartTime": 1653,
"EndTime": 1653,
"X": 167.021988,
"Y": 193.867477
},
{
"StartTime": 1735,
"EndTime": 1735,
"X": 207.043976,
"Y": 193.734955
},
{
"StartTime": 1817,
"EndTime": 1817,
"X": 247.065887,
"Y": 193.602432
},
{
"StartTime": 1899,
"EndTime": 1899,
"X": 287.08783,
"Y": 193.46991
},
{
"StartTime": 1981,
"EndTime": 1981,
"X": 327.1098,
"Y": 193.337387
},
{
"StartTime": 2062,
"EndTime": 2062,
"X": 366.643738,
"Y": 193.206482
},
{
"StartTime": 2144,
"EndTime": 2144,
"X": 406.665649,
"Y": 193.073959
},
{
"StartTime": 2172,
"EndTime": 2172,
"X": 420.331726,
"Y": 193.0287
},
{
"StartTime": 2199,
"EndTime": 2199,
"X": 407.153748,
"Y": 193.072342
},
{
"StartTime": 2281,
"EndTime": 2281,
"X": 367.1318,
"Y": 193.204865
},
{
"StartTime": 2363,
"EndTime": 2363,
"X": 327.1098,
"Y": 193.337387
},
{
"StartTime": 2445,
"EndTime": 2445,
"X": 287.08783,
"Y": 193.46991
},
{
"StartTime": 2527,
"EndTime": 2527,
"X": 247.065887,
"Y": 193.602432
},
{
"StartTime": 2609,
"EndTime": 2609,
"X": 207.043976,
"Y": 193.734955
},
{
"StartTime": 2691,
"EndTime": 2691,
"X": 167.021988,
"Y": 193.867477
},
{
"StartTime": 2773,
"EndTime": 2773,
"X": 127,
"Y": 194
},
{
"StartTime": 2855,
"EndTime": 2855,
"X": 167.021988,
"Y": 193.867477
},
{
"StartTime": 2937,
"EndTime": 2937,
"X": 207.043976,
"Y": 193.734955
},
{
"StartTime": 3019,
"EndTime": 3019,
"X": 247.065948,
"Y": 193.602432
},
{
"StartTime": 3101,
"EndTime": 3101,
"X": 287.087952,
"Y": 193.46991
},
{
"StartTime": 3183,
"EndTime": 3183,
"X": 327.109772,
"Y": 193.337387
},
{
"StartTime": 3265,
"EndTime": 3265,
"X": 367.131775,
"Y": 193.204865
},
{
"StartTime": 3347,
"EndTime": 3347,
"X": 407.153748,
"Y": 193.072342
},
{
"StartTime": 3374,
"EndTime": 3374,
"X": 420.331726,
"Y": 193.0287
},
{
"StartTime": 3401,
"EndTime": 3401,
"X": 407.153748,
"Y": 193.072342
},
{
"StartTime": 3483,
"EndTime": 3483,
"X": 367.131775,
"Y": 193.204865
},
{
"StartTime": 3565,
"EndTime": 3565,
"X": 327.109772,
"Y": 193.337387
},
{
"StartTime": 3647,
"EndTime": 3647,
"X": 287.087952,
"Y": 193.46991
},
{
"StartTime": 3729,
"EndTime": 3729,
"X": 247.065948,
"Y": 193.602432
},
{
"StartTime": 3811,
"EndTime": 3811,
"X": 207.043976,
"Y": 193.734955
},
{
"StartTime": 3893,
"EndTime": 3893,
"X": 167.021988,
"Y": 193.867477
},
{
"StartTime": 3975,
"EndTime": 3975,
"X": 127,
"Y": 194
},
{
"StartTime": 4057,
"EndTime": 4057,
"X": 167.021988,
"Y": 193.867477
},
{
"StartTime": 4139,
"EndTime": 4139,
"X": 207.043976,
"Y": 193.734955
},
{
"StartTime": 4221,
"EndTime": 4221,
"X": 247.065948,
"Y": 193.602432
},
{
"StartTime": 4303,
"EndTime": 4303,
"X": 287.087952,
"Y": 193.46991
},
{
"StartTime": 4385,
"EndTime": 4385,
"X": 327.109772,
"Y": 193.337387
},
{
"StartTime": 4467,
"EndTime": 4467,
"X": 367.131775,
"Y": 193.204865
},
{
"StartTime": 4540,
"EndTime": 4540,
"X": 420.331726,
"Y": 193.0287
},
{
"StartTime": 4549,
"EndTime": 4549,
"X": 407.153748,
"Y": 193.072342
}
]
}]
}