From cda9440a296304bd710c1787436ea1a948f6c999 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 11 Dec 2023 14:39:50 +0900 Subject: [PATCH 1/4] Fix JuiceStream velocity calculation --- .../Beatmaps/CatchBeatmapConverter.cs | 2 +- .../Objects/JuiceStream.cs | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 8c460586b0..f5c5ffb529 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps LegacyConvertedY = yPositionData?.Y ?? CatchHitObject.DEFAULT_LEGACY_CONVERT_Y, // prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance. // this results in more (or less) ticks being generated in SliderVelocityMultiplierBindable { get; } = new BindableDouble(1) { - Precision = 0.01, MinValue = 0.1, MaxValue = 10 }; @@ -48,16 +48,10 @@ namespace osu.Game.Rulesets.Catch.Objects public double TickDistanceMultiplier = 1; [JsonIgnore] - private double velocityFactor; + public double Velocity { get; private set; } [JsonIgnore] - private double tickDistanceFactor; - - [JsonIgnore] - public double Velocity => velocityFactor * SliderVelocityMultiplier; - - [JsonIgnore] - public double TickDistance => tickDistanceFactor * TickDistanceMultiplier; + public double TickDistance { get; private set; } /// /// The length of one span of this . @@ -70,8 +64,13 @@ namespace osu.Game.Rulesets.Catch.Objects TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime); - velocityFactor = base_scoring_distance * difficulty.SliderMultiplier / timingPoint.BeatLength; - tickDistanceFactor = base_scoring_distance * difficulty.SliderMultiplier / difficulty.SliderTickRate; + Velocity = base_scoring_distance * difficulty.SliderMultiplier / LegacyRulesetExtensions.GetPrecisionAdjustedBeatLength(this, timingPoint, CatchRuleset.SHORT_NAME); + + // WARNING: this is intentionally not computed as `BASE_SCORING_DISTANCE * difficulty.SliderMultiplier` + // for backwards compatibility reasons (intentionally introducing floating point errors to match stable). + double scoringDistance = Velocity * timingPoint.BeatLength; + + TickDistance = scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier; } protected override void CreateNestedHitObjects(CancellationToken cancellationToken) From 55b80f70f68f1c4040fb6f3e4558de79907c9b27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2024 18:12:20 +0900 Subject: [PATCH 2/4] Change "playfield" skin layer to respect shifting playfield border in osu! ruleset --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index b39fc34d5d..df7f279656 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -8,6 +8,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; @@ -47,6 +48,8 @@ namespace osu.Game.Rulesets.Osu.UI protected override GameplayCursorContainer? CreateCursor() => new OsuCursorContainer(); + public override Quad SkinnableComponentScreenSpaceDrawQuad => playfieldBorder.ScreenSpaceDrawQuad; + private readonly Container judgementAboveHitObjectLayer; public OsuPlayfield() From deeb2e99a2711ab9e9ef7bbd06249fb1723eab01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 28 Jun 2024 10:46:17 +0200 Subject: [PATCH 3/4] Add test for correct juice stream tick counts in editor cda9440a296304bd710c1787436ea1a948f6c999 inadvertently fixes this in the most frequent case by inverting the `TickDistanceMultiplier` from being not-1 to 1 on beatmap versions above v8. This can still potentially go wrong if a beatmap from a version below v8 is edited, because upon save it will be reencoded at the latest version, meaning that the multiplier will change from not-1 to 1 - but this can be handled separately. --- .../Editor/TestSceneCatchEditorSaving.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchEditorSaving.cs diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchEditorSaving.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchEditorSaving.cs new file mode 100644 index 0000000000..53ef24e02c --- /dev/null +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchEditorSaving.cs @@ -0,0 +1,66 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Testing; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Tests.Visual; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Rulesets.Catch.Tests.Editor +{ + public partial class TestSceneCatchEditorSaving : EditorSavingTestScene + { + protected override Ruleset CreateRuleset() => new CatchRuleset(); + + [Test] + public void TestCatchJuiceStreamTickCorrect() + { + AddStep("enter timing mode", () => InputManager.Key(Key.F3)); + AddStep("add timing point", () => EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint())); + AddStep("enter compose mode", () => InputManager.Key(Key.F1)); + + Vector2 startPoint = Vector2.Zero; + float increment = 0; + + AddUntilStep("wait for playfield", () => this.ChildrenOfType().FirstOrDefault()?.IsLoaded == true); + AddStep("move to centre", () => + { + var playfield = this.ChildrenOfType().Single(); + startPoint = playfield.ScreenSpaceDrawQuad.Centre + new Vector2(0, playfield.ScreenSpaceDrawQuad.Height / 3); + increment = playfield.ScreenSpaceDrawQuad.Height / 10; + InputManager.MoveMouseTo(startPoint); + }); + AddStep("choose juice stream placing tool", () => InputManager.Key(Key.Number3)); + AddStep("start placement", () => InputManager.Click(MouseButton.Left)); + + AddStep("move to next", () => InputManager.MoveMouseTo(startPoint + new Vector2(2 * increment, -increment))); + AddStep("add node", () => InputManager.Click(MouseButton.Left)); + + AddStep("move to next", () => InputManager.MoveMouseTo(startPoint + new Vector2(-2 * increment, -2 * increment))); + AddStep("add node", () => InputManager.Click(MouseButton.Left)); + + AddStep("move to next", () => InputManager.MoveMouseTo(startPoint + new Vector2(0, -3 * increment))); + AddStep("end placement", () => InputManager.Click(MouseButton.Right)); + + AddUntilStep("juice stream placed", () => EditorBeatmap.HitObjects, () => Has.Count.EqualTo(1)); + + int largeDropletCount = 0, tinyDropletCount = 0; + AddStep("store droplet count", () => + { + largeDropletCount = EditorBeatmap.HitObjects[0].NestedHitObjects.Count(t => t.GetType() == typeof(Droplet)); + tinyDropletCount = EditorBeatmap.HitObjects[0].NestedHitObjects.Count(t => t.GetType() == typeof(TinyDroplet)); + }); + + SaveEditor(); + ReloadEditorToSameBeatmap(); + + AddAssert("large droplet count is the same", () => EditorBeatmap.HitObjects[0].NestedHitObjects.Count(t => t.GetType() == typeof(Droplet)), () => Is.EqualTo(largeDropletCount)); + AddAssert("tiny droplet count is the same", () => EditorBeatmap.HitObjects[0].NestedHitObjects.Count(t => t.GetType() == typeof(TinyDroplet)), () => Is.EqualTo(tinyDropletCount)); + } + } +} From 8bb51d5a4f08e8750dbad5ee0f97ba221be81fd2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Jun 2024 20:32:16 +0900 Subject: [PATCH 4/4] Fix summary timeline not correctly updating after changes to breaks Closes https://github.com/ppy/osu/issues/28678. Oops. --- .../Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs index 50062e8465..ed42ade490 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs @@ -25,6 +25,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts breaks.BindTo(beatmap.Breaks); breaks.BindCollectionChanged((_, _) => { + Clear(); foreach (var breakPeriod in beatmap.Breaks) Add(new BreakVisualisation(breakPeriod)); }, true);