-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix 1 million score being unachievable on some mania beatmaps #23917
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ccf6ed1
Add failing test cases
bdach 04e812b
Make `JudgementProcessor.SimulateAutoplay()` non-virtual
bdach 3295294
Reorder autoplay-related virtual methods closer together
bdach 4625708
Introduce new method for enumeration of objects during autoplay simul…
bdach e46b420
Remove no-longer-needed local method
bdach 0065334
Fix mania autoplay simulation judging objects in different order to g…
bdach 47a65f8
Merge branch 'master' into fix-imperfect-simulation
smoogipoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Screens; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Beatmaps.ControlPoints; | ||
using osu.Game.Replays; | ||
using osu.Game.Rulesets.Judgements; | ||
using osu.Game.Rulesets.Mania.Objects; | ||
using osu.Game.Rulesets.Mania.Replays; | ||
using osu.Game.Rulesets.Replays; | ||
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Scoring; | ||
using osu.Game.Screens.Play; | ||
using osu.Game.Tests.Visual; | ||
|
||
namespace osu.Game.Rulesets.Mania.Tests | ||
{ | ||
public partial class TestSceneMaximumScore : RateAdjustedBeatmapTestScene | ||
{ | ||
private ScoreAccessibleReplayPlayer currentPlayer = null!; | ||
|
||
private List<JudgementResult> judgementResults = new List<JudgementResult>(); | ||
|
||
[Test] | ||
public void TestSimultaneousTickAndNote() | ||
{ | ||
performTest( | ||
new List<ManiaHitObject> | ||
{ | ||
new HoldNote | ||
{ | ||
StartTime = 1000, | ||
Duration = 2000, | ||
Column = 0, | ||
}, | ||
new Note | ||
{ | ||
StartTime = 2000, | ||
Column = 1 | ||
} | ||
}, | ||
new List<ReplayFrame> | ||
{ | ||
new ManiaReplayFrame(1000, ManiaAction.Key1), | ||
new ManiaReplayFrame(2000, ManiaAction.Key1, ManiaAction.Key2), | ||
new ManiaReplayFrame(2001, ManiaAction.Key1), | ||
new ManiaReplayFrame(3000) | ||
}); | ||
|
||
AddAssert("all objects perfectly judged", | ||
() => judgementResults.Select(result => result.Type), | ||
() => Is.EquivalentTo(judgementResults.Select(result => result.Judgement.MaxResult))); | ||
AddAssert("score is 1 million", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_000)); | ||
} | ||
|
||
[Test] | ||
public void TestSimultaneousLongNotes() | ||
{ | ||
performTest( | ||
new List<ManiaHitObject> | ||
{ | ||
new HoldNote | ||
{ | ||
StartTime = 1000, | ||
Duration = 2000, | ||
Column = 0, | ||
}, | ||
new HoldNote | ||
{ | ||
StartTime = 2000, | ||
Duration = 2000, | ||
Column = 1 | ||
} | ||
}, | ||
new List<ReplayFrame> | ||
{ | ||
new ManiaReplayFrame(1000, ManiaAction.Key1), | ||
new ManiaReplayFrame(2000, ManiaAction.Key1, ManiaAction.Key2), | ||
new ManiaReplayFrame(3000, ManiaAction.Key2), | ||
new ManiaReplayFrame(4000) | ||
}); | ||
|
||
AddAssert("all objects perfectly judged", | ||
() => judgementResults.Select(result => result.Type), | ||
() => Is.EquivalentTo(judgementResults.Select(result => result.Judgement.MaxResult))); | ||
AddAssert("score is 1 million", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_000)); | ||
} | ||
|
||
private void performTest(List<ManiaHitObject> hitObjects, List<ReplayFrame> frames) | ||
{ | ||
var beatmap = new Beatmap<ManiaHitObject> | ||
{ | ||
HitObjects = hitObjects, | ||
BeatmapInfo = | ||
{ | ||
Difficulty = new BeatmapDifficulty { SliderTickRate = 4 }, | ||
Ruleset = new ManiaRuleset().RulesetInfo | ||
}, | ||
}; | ||
|
||
beatmap.ControlPointInfo.Add(0, new EffectControlPoint { ScrollSpeed = 0.1f }); | ||
|
||
AddStep("load player", () => | ||
{ | ||
Beatmap.Value = CreateWorkingBeatmap(beatmap); | ||
|
||
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }); | ||
|
||
p.OnLoadComplete += _ => | ||
{ | ||
p.ScoreProcessor.NewJudgement += result => | ||
{ | ||
if (currentPlayer == p) judgementResults.Add(result); | ||
}; | ||
}; | ||
|
||
LoadScreen(currentPlayer = p); | ||
judgementResults = new List<JudgementResult>(); | ||
}); | ||
|
||
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0); | ||
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen()); | ||
|
||
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value); | ||
} | ||
|
||
private partial class ScoreAccessibleReplayPlayer : ReplayPlayer | ||
{ | ||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; | ||
|
||
protected override bool PauseOnFocusLost => false; | ||
|
||
public ScoreAccessibleReplayPlayer(Score score) | ||
: base(score, new PlayerConfiguration | ||
{ | ||
AllowPause = false, | ||
ShowResults = false, | ||
}) | ||
{ | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone reported on discord that a graved osu! map also has an issue where 1M score is unachievable, and it's because this implementation is still naive (relies on no concurrent objects to work correctly). I could go and fix that case here by partially mirroring the mania implementation (flatten all objects, sort by end time) but honestly not sure it's worth the performance hit for a graved map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't be against this since it's to guarantee correctness. The performance hit shouldn't be noticeable. But the current changeset is also fine for now.