Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate autoplay input frames instead of force perfect judgements #130

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneBreakNote.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Graphics;
using System.Collections.Generic;

namespace osu.Game.Rulesets.Sentakki.Tests.Objects
{
[TestFixture]
public class TestSceneBreakNote : OsuTestScene
public class TestSceneBreakNote : TestSceneSentakkiHitObject
{
private readonly Container content;
protected override Container<Drawable> Content => content;

private int depthIndex;

public TestSceneBreakNote()
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{
base.Content.Add(content = new SentakkiInputManager(new RulesetInfo { ID = 0 }));

AddStep("Miss Single", () => testSingle());
AddStep("Hit Single", () => testSingle(true));
AddUntilStep("Wait for object despawn", () => !Children.Any(h => (h is DrawableSentakkiHitObject) && (h as DrawableSentakkiHitObject).AllJudged == false));
}

private void testSingle(bool auto = false)
{
var circle = new Tap
var beatmap = new Beatmap<SentakkiHitObject>()
{
Break = true,
StartTime = Time.Current + 1000,
BeatmapInfo =
{
Ruleset = CreateRuleset()?.RulesetInfo ?? ruleset
},
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });

Add(new DrawableTap(circle)
for (int i = 0; i < 8; ++i)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = depthIndex++,
Auto = auto
});
beatmap.HitObjects.Add(new Tap
{
Break = true,
StartTime = 500,
Lane = i
});
beatmap.HitObjects.Add(new Hold
{
Break = true,
StartTime = 1000,
Duration = 300,
Lane = (i + 3).NormalizePath()
});
beatmap.HitObjects.Add(new Slide
{
Break = true,
SlideInfoList = new List<SentakkiSlideInfo>
{
new SentakkiSlideInfo {
ID = 1,
Duration = 500,
}
},
StartTime = 1500,
Lane = (i + 7).NormalizePath()
});
}

return beatmap;
}
}
}
32 changes: 32 additions & 0 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneHitObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using NUnit.Framework;
using osu.Game.Tests.Visual;
using System.Linq;

namespace osu.Game.Rulesets.Sentakki.Tests.Objects
{
public abstract class TestSceneSentakkiHitObject : PlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new SentakkiRuleset();

protected override bool HasCustomSteps => true;

private bool auto = false;
protected override bool Autoplay => auto;

[Test]
public void TestMisses()
{
AddStep("Turn off auto", () => auto = false);
CreateTest(null);
AddUntilStep("Wait until all hitobjects are judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.AllJudged));
}

[Test]
public void TestHits()
{
AddStep("Turn on auto", () => auto = true);
CreateTest(null);
AddUntilStep("Wait until all hitobjects are judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.AllJudged));
}
}
}
62 changes: 16 additions & 46 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneHoldNote.cs
Original file line number Diff line number Diff line change
@@ -1,59 +1,29 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Sentakki.Tests.Objects
{
[TestFixture]
public class TestSceneHoldNote : OsuTestScene
public class TestSceneHoldNote : TestSceneSentakkiHitObject
{
private readonly Container content;
protected override Container<Drawable> Content => content;

private int depthIndex;

public TestSceneHoldNote()
{
base.Content.Add(content = new SentakkiInputManager(new RulesetInfo { ID = 0 }));

AddStep("Miss Insane Short", () => testSingle(100));
AddStep("Hit Insane Short", () => testSingle(100, true));
AddStep("Miss Very Short", () => testSingle(200));
AddStep("Hit Very Short", () => testSingle(200, true));
AddStep("Miss Short", () => testSingle(500));
AddStep("Hit Short", () => testSingle(500, true));
AddStep("Miss Medium", () => testSingle(750));
AddStep("Hit Medium", () => testSingle(750, true));
AddStep("Miss Long", () => testSingle(1000));
AddStep("Hit Long", () => testSingle(1000, true));
AddStep("Miss Very Long", () => testSingle(3000));
AddStep("Hit Very Long", () => testSingle(3000, true));
AddUntilStep("Wait for object despawn", () => !Children.Any(h => (h is DrawableSentakkiHitObject) && (h as DrawableSentakkiHitObject).AllJudged == false));
}

private void testSingle(double duration, bool auto = false)
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{
var circle = new Hold
var beatmap = new Beatmap<SentakkiHitObject>()
{
StartTime = Time.Current + 1000,
EndTime = Time.Current + 1000 + duration,
BeatmapInfo =
{
Ruleset = CreateRuleset()?.RulesetInfo ?? ruleset
},
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });

Add(new DrawableHold(circle)
for (int i = 0; i < 8; ++i)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = depthIndex++,
Auto = auto
});
beatmap.HitObjects.Add(new Hold
{
StartTime = 500 + (200 * i),
Duration = 100 + (200 * i),
Lane = i
});
}
return beatmap;
}
}
}
58 changes: 13 additions & 45 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneSlideNote.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Tests.Visual;
using System.Collections.Generic;

namespace osu.Game.Rulesets.Sentakki.Tests.Objects
{
[TestFixture]
public class TestSceneSlideNote : OsuTestScene
public class TestSceneSlideNote : TestSceneSentakkiHitObject
{
private readonly Container content;
protected override Container<Drawable> Content => content;

protected override Ruleset CreateRuleset() => new SentakkiRuleset();

private int depthIndex;

public TestSceneSlideNote()
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{
base.Content.Add(content = new SentakkiInputManager(new RulesetInfo { ID = 0 }));

AddStep("Miss Single", () => testSingle(2000));
AddStep("Hit Single", () => testSingle(2000, true));
AddUntilStep("Wait for object despawn", () => !Children.Any(h => (h is DrawableSentakkiHitObject) && (h as DrawableSentakkiHitObject).AllJudged == false));
}

private void testSingle(double duration, bool auto = false)
{
var slide = new Slide
var beatmap = new Beatmap<SentakkiHitObject>()
{
BeatmapInfo =
{
Ruleset = CreateRuleset()?.RulesetInfo ?? ruleset
},
};
beatmap.HitObjects.Add(new Slide
{
//Break = true,
SlideInfoList = new List<SentakkiSlideInfo>
{
new SentakkiSlideInfo {
Expand All @@ -50,23 +32,9 @@ private void testSingle(double duration, bool auto = false)
Duration = 2000,
}
},
StartTime = Time.Current + 1000,
};

slide.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });

DrawableSlide dSlide;

Add(dSlide = new DrawableSlide(slide)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = depthIndex++,
Auto = auto
StartTime = 500,
});

foreach (DrawableSentakkiHitObject nested in dSlide.NestedHitObjects)
nested.Auto = auto;
return beatmap;
}
}
}
49 changes: 14 additions & 35 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTapNote.cs
Original file line number Diff line number Diff line change
@@ -1,48 +1,27 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Sentakki.Tests.Objects
{
[TestFixture]
public class TestSceneTapNote : OsuTestScene
public class TestSceneTapNote : TestSceneSentakkiHitObject
{
private readonly Container content;
protected override Container<Drawable> Content => content;

private int depthIndex;

public TestSceneTapNote()
{
base.Content.Add(content = new SentakkiInputManager(new RulesetInfo { ID = 0 }));

AddStep("Miss Single", () => testSingle());
AddStep("Hit Single", () => testSingle(true));
AddUntilStep("Wait for object despawn", () => !Children.Any(h => (h is DrawableSentakkiHitObject) && (h as DrawableSentakkiHitObject).AllJudged == false));
}

private void testSingle(bool auto = false)
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{
var circle = new Tap
var beatmap = new Beatmap<SentakkiHitObject>()
{
StartTime = Time.Current + 1000,
BeatmapInfo =
{
Ruleset = CreateRuleset()?.RulesetInfo ?? ruleset
},
};
for (int i = 0; i < 8; ++i)
beatmap.HitObjects.Add(new Tap
{
StartTime = 500 + (100 * i),
Lane = i
});

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });

Add(new DrawableTap(circle)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = depthIndex++,
Auto = auto
});
return beatmap;
}
}
}
Loading