From 46b379899e0d7299ff8ebb37d3de83701414b9aa Mon Sep 17 00:00:00 2001 From: Ivan Pavluk Date: Fri, 11 Jun 2021 14:07:38 +0700 Subject: [PATCH 01/16] add taiko hd mod (2nd attempt) --- .../Mods/TaikoModHidden.cs | 76 ++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 7739ecaf5b..eeebe66b77 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -1,23 +1,95 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Configuration; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Objects.Drawables; namespace osu.Game.Rulesets.Taiko.Mods { - public class TaikoModHidden : ModHidden + public class TaikoModHidden : ModHidden, IApplicableToDifficulty { public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; - public override bool HasImplementation => false; + + // In stable Taiko, hit position is 160, so playfield is essentially 160 pixels shorter + // than actual screen width. Normalized screen height is 480, so on a 4:3 screen the + // playfield ratio will actually be (640 - 160) / 480 = 1 + // For 16:9 resolutions, screen width with normalized height becomes 853.33333 instead, + // meaning 16:9 playfield ratio is (853.333 - 160) / 480 = 1.444444. + // Thus, 4:3 ratio / 16:9 ratio = 1 / 1.4444 = 9 / 13 + private const double hd_sv_scale = 9.0 / 13.0; + private BeatmapDifficulty difficulty; + private ControlPointInfo controlPointInfo; + + [SettingSource("Hide Time", "Multiplies the time the note stays hidden")] + public BindableNumber VisibilityMod { get; } = new BindableDouble + { + MinValue = 0.5, + // Max visibility is only to be used with max playfield size + MaxValue = 1.5, + Default = 1.0, + Value = 1.0, + Precision = 0.01, + }; protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) { + ApplyNormalVisibilityState(hitObject, state); + } + + protected double MultiplierAt(double position) + { + var beatLength = controlPointInfo.TimingPointAt(position)?.BeatLength; + var speedMultiplier = controlPointInfo.DifficultyPointAt(position)?.SpeedMultiplier; + return difficulty.SliderMultiplier * (speedMultiplier ?? 1.0) * TimingControlPoint.DEFAULT_BEAT_LENGTH / (beatLength ?? TimingControlPoint.DEFAULT_BEAT_LENGTH); } protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) { + switch (hitObject) + { + case DrawableDrumRollTick _: + break; + + case DrawableHit _: + break; + + default: + return; + } + + // I *think* it's like this because stable's default velocity multiplier is 1.4 + var preempt = 14000 / MultiplierAt(hitObject.HitObject.StartTime) * VisibilityMod.Value; + var start = hitObject.HitObject.StartTime - preempt * 0.6; + var duration = preempt * 0.3; + + using (hitObject.BeginAbsoluteSequence(start)) + { + // With 0 opacity the object is dying, and if I set a lifetime other issues appear... + // Ideally these need to be fixed, but I lack the knowledge to do it, and this is good enough anyway. + hitObject.FadeTo(0.0005f, duration); + } + } + + public void ReadFromDifficulty(BeatmapDifficulty difficulty) + { + } + + public void ApplyToDifficulty(BeatmapDifficulty difficulty) + { + this.difficulty = difficulty; + difficulty.SliderMultiplier /= hd_sv_scale; + } + + public override void ApplyToBeatmap(IBeatmap beatmap) + { + controlPointInfo = beatmap.ControlPointInfo; } } } From 09df23e2a6f275893f8996f01b89682c7bbbdf9c Mon Sep 17 00:00:00 2001 From: Ivan Pavluk Date: Fri, 11 Jun 2021 15:07:41 +0700 Subject: [PATCH 02/16] improve reasoning for hd_sv_scale --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index eeebe66b77..58125d4a65 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -20,10 +20,10 @@ namespace osu.Game.Rulesets.Taiko.Mods // In stable Taiko, hit position is 160, so playfield is essentially 160 pixels shorter // than actual screen width. Normalized screen height is 480, so on a 4:3 screen the // playfield ratio will actually be (640 - 160) / 480 = 1 - // For 16:9 resolutions, screen width with normalized height becomes 853.33333 instead, - // meaning 16:9 playfield ratio is (853.333 - 160) / 480 = 1.444444. - // Thus, 4:3 ratio / 16:9 ratio = 1 / 1.4444 = 9 / 13 - private const double hd_sv_scale = 9.0 / 13.0; + // For custom resolutions (x:y), screen width with normalized height becomes 480 * x / y instead, + // and the playfield ratio becomes (480 * x / y - 160) / 480 = x / y - 1/3 + // The following is 4:3 playfield ratio divided by 16:9 playfield ratio + private const double hd_sv_scale = (4 / 3 - 1/3) / (16 / 9 - 1/3); private BeatmapDifficulty difficulty; private ControlPointInfo controlPointInfo; From e34e26ae521de2bff25a27d9362476dccdd6e3f7 Mon Sep 17 00:00:00 2001 From: Ivan Pavluk Date: Fri, 11 Jun 2021 15:12:05 +0700 Subject: [PATCH 03/16] remove outdated comment --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 58125d4a65..e04d617e3c 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Taiko.Mods public BindableNumber VisibilityMod { get; } = new BindableDouble { MinValue = 0.5, - // Max visibility is only to be used with max playfield size MaxValue = 1.5, Default = 1.0, Value = 1.0, From 6d06066ddee137a2f5f3c930bbc7cdda6d397497 Mon Sep 17 00:00:00 2001 From: Ivan Pavluk Date: Fri, 11 Jun 2021 15:54:30 +0700 Subject: [PATCH 04/16] forgot to run code inspection --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index e04d617e3c..b837866c4d 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Mods // For custom resolutions (x:y), screen width with normalized height becomes 480 * x / y instead, // and the playfield ratio becomes (480 * x / y - 160) / 480 = x / y - 1/3 // The following is 4:3 playfield ratio divided by 16:9 playfield ratio - private const double hd_sv_scale = (4 / 3 - 1/3) / (16 / 9 - 1/3); + private const double hd_sv_scale = (4.0 / 3.0 - 1.0 / 3.0) / (16.0 / 9.0 - 1.0 / 3.0); private BeatmapDifficulty difficulty; private ControlPointInfo controlPointInfo; From 7bb27bfd0e34a20f0beeb19a86f97fc0faa92a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 11 Jun 2021 12:14:28 +0200 Subject: [PATCH 05/16] Add test scene for hidden mod --- .../Mods/TaikoModTestScene.cs | 12 ++++++++++ .../Mods/TestSceneTaikoModHidden.cs | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs create mode 100644 osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs new file mode 100644 index 0000000000..3090facf8c --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs @@ -0,0 +1,12 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Taiko.Tests.Mods +{ + public abstract class TaikoModTestScene : ModTestScene + { + protected sealed override Ruleset CreatePlayerRuleset() => new TaikoRuleset(); + } +} diff --git a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs new file mode 100644 index 0000000000..7abbb9d186 --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs @@ -0,0 +1,24 @@ +// 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.Game.Rulesets.Taiko.Mods; + +namespace osu.Game.Rulesets.Taiko.Tests.Mods +{ + public class TestSceneTaikoModHidden : TaikoModTestScene + { + [Test] + public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData + { + Mod = new TaikoModHidden(), + Autoplay = true, + PassCondition = checkSomeAutoplayHits + }); + + private bool checkSomeAutoplayHits() + => Player.ScoreProcessor.JudgedHits >= 4 + && Player.Results.All(result => result.Type == result.Judgement.MaxResult); + } +} From e194f8b34a4dcd8402d717afa0435cedf35d5235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 11 Jun 2021 12:09:40 +0200 Subject: [PATCH 06/16] Replace lifetime workaround with explicit set --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index b837866c4d..bf028fa007 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -7,7 +7,9 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Objects.Drawables; namespace osu.Game.Rulesets.Taiko.Mods @@ -70,9 +72,13 @@ namespace osu.Game.Rulesets.Taiko.Mods using (hitObject.BeginAbsoluteSequence(start)) { - // With 0 opacity the object is dying, and if I set a lifetime other issues appear... - // Ideally these need to be fixed, but I lack the knowledge to do it, and this is good enough anyway. - hitObject.FadeTo(0.0005f, duration); + hitObject.FadeOut(duration); + + // DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed. + // in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly. + hitObject.LifetimeEnd = state == ArmedState.Idle + ? hitObject.HitObject.GetEndTime() + hitObject.HitObject.HitWindows.WindowFor(HitResult.Miss) + : hitObject.HitStateUpdateTime; } } From 6d2b5252c63540260104891ad31e829fd05e56c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 11 Jun 2021 13:07:09 +0200 Subject: [PATCH 07/16] Attempt to reword setting to be more understandable --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index bf028fa007..00fcf5fa59 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Taiko.Mods private BeatmapDifficulty difficulty; private ControlPointInfo controlPointInfo; - [SettingSource("Hide Time", "Multiplies the time the note stays hidden")] + [SettingSource("Fade-out Time", "The bigger this multiplier is, the sooner the notes will start fading out")] public BindableNumber VisibilityMod { get; } = new BindableDouble { MinValue = 0.5, From a549aebb3fbe9aa28b3b10dbd911c79f2e40d50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 15 Jun 2021 22:32:26 +0200 Subject: [PATCH 08/16] Reword HD scale multiplier comment --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 00fcf5fa59..8a764a21bb 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -19,13 +19,16 @@ namespace osu.Game.Rulesets.Taiko.Mods public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; - // In stable Taiko, hit position is 160, so playfield is essentially 160 pixels shorter - // than actual screen width. Normalized screen height is 480, so on a 4:3 screen the - // playfield ratio will actually be (640 - 160) / 480 = 1 - // For custom resolutions (x:y), screen width with normalized height becomes 480 * x / y instead, - // and the playfield ratio becomes (480 * x / y - 160) / 480 = x / y - 1/3 - // The following is 4:3 playfield ratio divided by 16:9 playfield ratio + /// + /// In stable taiko, the hit position is 160, so the active playfield is essentially 160 pixels shorter + /// than the actual screen width. The normalized playfield height is 480, so on a 4:3 screen the + /// playfield ratio of the active area up to the hit position will actually be (640 - 160) / 480 = 1. + /// For custom resolutions/aspect ratios (x:y), the screen width given the normalized height becomes 480 * x / y instead, + /// and the playfield ratio becomes (480 * x / y - 160) / 480 = x / y - 1/3. + /// This constant is equal to the playfield ratio on 4:3 screens divided by the playfield ratio on 16:9 screens. + /// private const double hd_sv_scale = (4.0 / 3.0 - 1.0 / 3.0) / (16.0 / 9.0 - 1.0 / 3.0); + private BeatmapDifficulty difficulty; private ControlPointInfo controlPointInfo; From 259e6cad4dd5e14111765d89b7030d834d2dae82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 15 Jun 2021 22:33:27 +0200 Subject: [PATCH 09/16] Rearrange and rename member --- .../Mods/TaikoModHidden.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 8a764a21bb..fd076b8765 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -19,6 +19,16 @@ namespace osu.Game.Rulesets.Taiko.Mods public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; + [SettingSource("Fade-out Time", "The bigger this multiplier is, the sooner the notes will start fading out")] + public BindableNumber FadeOutTimeMultiplier { get; } = new BindableDouble + { + MinValue = 0.5, + MaxValue = 1.5, + Default = 1.0, + Value = 1.0, + Precision = 0.01, + }; + /// /// In stable taiko, the hit position is 160, so the active playfield is essentially 160 pixels shorter /// than the actual screen width. The normalized playfield height is 480, so on a 4:3 screen the @@ -32,16 +42,6 @@ namespace osu.Game.Rulesets.Taiko.Mods private BeatmapDifficulty difficulty; private ControlPointInfo controlPointInfo; - [SettingSource("Fade-out Time", "The bigger this multiplier is, the sooner the notes will start fading out")] - public BindableNumber VisibilityMod { get; } = new BindableDouble - { - MinValue = 0.5, - MaxValue = 1.5, - Default = 1.0, - Value = 1.0, - Precision = 0.01, - }; - protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) { ApplyNormalVisibilityState(hitObject, state); @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Mods } // I *think* it's like this because stable's default velocity multiplier is 1.4 - var preempt = 14000 / MultiplierAt(hitObject.HitObject.StartTime) * VisibilityMod.Value; + var preempt = 14000 / MultiplierAt(hitObject.HitObject.StartTime) * FadeOutTimeMultiplier.Value; var start = hitObject.HitObject.StartTime - preempt * 0.6; var duration = preempt * 0.3; From b0549187df1339998fbf48267e74ae81c6233b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 15 Jun 2021 22:57:20 +0200 Subject: [PATCH 10/16] Apply pre-empt formula which is closer to stable --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index fd076b8765..613c16baa2 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Mods /// private const double hd_sv_scale = (4.0 / 3.0 - 1.0 / 3.0) / (16.0 / 9.0 - 1.0 / 3.0); - private BeatmapDifficulty difficulty; + private double originalSliderMultiplier; private ControlPointInfo controlPointInfo; protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Mods { var beatLength = controlPointInfo.TimingPointAt(position)?.BeatLength; var speedMultiplier = controlPointInfo.DifficultyPointAt(position)?.SpeedMultiplier; - return difficulty.SliderMultiplier * (speedMultiplier ?? 1.0) * TimingControlPoint.DEFAULT_BEAT_LENGTH / (beatLength ?? TimingControlPoint.DEFAULT_BEAT_LENGTH); + return originalSliderMultiplier * (speedMultiplier ?? 1.0) * TimingControlPoint.DEFAULT_BEAT_LENGTH / (beatLength ?? TimingControlPoint.DEFAULT_BEAT_LENGTH); } protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) @@ -68,8 +68,7 @@ namespace osu.Game.Rulesets.Taiko.Mods return; } - // I *think* it's like this because stable's default velocity multiplier is 1.4 - var preempt = 14000 / MultiplierAt(hitObject.HitObject.StartTime) * FadeOutTimeMultiplier.Value; + var preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime) * FadeOutTimeMultiplier.Value; var start = hitObject.HitObject.StartTime - preempt * 0.6; var duration = preempt * 0.3; @@ -91,7 +90,7 @@ namespace osu.Game.Rulesets.Taiko.Mods public void ApplyToDifficulty(BeatmapDifficulty difficulty) { - this.difficulty = difficulty; + originalSliderMultiplier = difficulty.SliderMultiplier; difficulty.SliderMultiplier /= hd_sv_scale; } From 57f0c47dedb97d9fdce434ced9f1f8942baafd2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 15 Jun 2021 23:00:09 +0200 Subject: [PATCH 11/16] Ezplain slider multiplier adjustment --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 613c16baa2..5b7dca09a5 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -91,6 +91,11 @@ namespace osu.Game.Rulesets.Taiko.Mods public void ApplyToDifficulty(BeatmapDifficulty difficulty) { originalSliderMultiplier = difficulty.SliderMultiplier; + + // the hidden mod on stable had an added playfield cover that essentially forced a 4:3 playfield ratio, by cutting off all objects past that size. + // lazer currently uses a playfield adjustment container which keeps a 16:9 ratio. + // therefore, increase the slider multiplier proportionally so that the notes stay on the screen for the same amount of time as on stable. + // note that this will means that the notes will scroll faster as they have a longer distance to travel on the screen in that same amount of time. difficulty.SliderMultiplier /= hd_sv_scale; } From 8c558610abe06b6ed6f23eb91bd83f16f390fc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 16 Jun 2021 00:34:39 +0200 Subject: [PATCH 12/16] Fix hitobjects expiring before fully judged with hidden --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 5b7dca09a5..15fc8c130e 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.Mods // DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed. // in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly. - hitObject.LifetimeEnd = state == ArmedState.Idle + hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged ? hitObject.HitObject.GetEndTime() + hitObject.HitObject.HitWindows.WindowFor(HitResult.Miss) : hitObject.HitStateUpdateTime; } From a5c09454e61814c8bf3b05aff6f80ff4f1d29003 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Jun 2021 16:16:18 +0900 Subject: [PATCH 13/16] Remove unnecessary configuration --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 15fc8c130e..aeb71ccaf1 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -1,11 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Configuration; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; @@ -19,16 +17,6 @@ namespace osu.Game.Rulesets.Taiko.Mods public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; - [SettingSource("Fade-out Time", "The bigger this multiplier is, the sooner the notes will start fading out")] - public BindableNumber FadeOutTimeMultiplier { get; } = new BindableDouble - { - MinValue = 0.5, - MaxValue = 1.5, - Default = 1.0, - Value = 1.0, - Precision = 0.01, - }; - /// /// In stable taiko, the hit position is 160, so the active playfield is essentially 160 pixels shorter /// than the actual screen width. The normalized playfield height is 480, so on a 4:3 screen the @@ -68,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.Mods return; } - var preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime) * FadeOutTimeMultiplier.Value; + var preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime); var start = hitObject.HitObject.StartTime - preempt * 0.6; var duration = preempt * 0.3; From 5944c45f55314f962fc207dff1ae89448252dafa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Jun 2021 16:24:30 +0900 Subject: [PATCH 14/16] Specify types explicitly and don't handle non-nullable values with fallbacks --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 13 +++++++------ osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index aeb71ccaf1..f787a75c51 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -37,9 +37,10 @@ namespace osu.Game.Rulesets.Taiko.Mods protected double MultiplierAt(double position) { - var beatLength = controlPointInfo.TimingPointAt(position)?.BeatLength; - var speedMultiplier = controlPointInfo.DifficultyPointAt(position)?.SpeedMultiplier; - return originalSliderMultiplier * (speedMultiplier ?? 1.0) * TimingControlPoint.DEFAULT_BEAT_LENGTH / (beatLength ?? TimingControlPoint.DEFAULT_BEAT_LENGTH); + double beatLength = controlPointInfo.TimingPointAt(position).BeatLength; + double speedMultiplier = controlPointInfo.DifficultyPointAt(position).SpeedMultiplier; + + return originalSliderMultiplier * speedMultiplier * TimingControlPoint.DEFAULT_BEAT_LENGTH / beatLength; } protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) @@ -56,9 +57,9 @@ namespace osu.Game.Rulesets.Taiko.Mods return; } - var preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime); - var start = hitObject.HitObject.StartTime - preempt * 0.6; - var duration = preempt * 0.3; + double preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime); + double start = hitObject.HitObject.StartTime - preempt * 0.6; + double duration = preempt * 0.3; using (hitObject.BeginAbsoluteSequence(start)) { diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index d3a4b635f5..25d0843a71 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Framework.Lists; @@ -66,6 +67,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. + [NotNull] public DifficultyControlPoint DifficultyPointAt(double time) => binarySearchWithFallback(DifficultyPoints, time, DifficultyControlPoint.DEFAULT); /// @@ -73,6 +75,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the effect control point at. /// The effect control point. + [NotNull] public EffectControlPoint EffectPointAt(double time) => binarySearchWithFallback(EffectPoints, time, EffectControlPoint.DEFAULT); /// @@ -80,6 +83,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the sound control point at. /// The sound control point. + [NotNull] public SampleControlPoint SamplePointAt(double time) => binarySearchWithFallback(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : SampleControlPoint.DEFAULT); /// @@ -87,6 +91,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the timing control point at. /// The timing control point. + [NotNull] public TimingControlPoint TimingPointAt(double time) => binarySearchWithFallback(TimingPoints, time, TimingPoints.Count > 0 ? TimingPoints[0] : TimingControlPoint.DEFAULT); /// From 18343160cfee4f5a1d7dde5296d1b4502ce655df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Jun 2021 16:28:57 +0900 Subject: [PATCH 15/16] Reword comments slightly --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index f787a75c51..434069291c 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Mods public override double ScoreMultiplier => 1.06; /// - /// In stable taiko, the hit position is 160, so the active playfield is essentially 160 pixels shorter + /// In osu-stable, the hit position is 160, so the active playfield is essentially 160 pixels shorter /// than the actual screen width. The normalized playfield height is 480, so on a 4:3 screen the /// playfield ratio of the active area up to the hit position will actually be (640 - 160) / 480 = 1. /// For custom resolutions/aspect ratios (x:y), the screen width given the normalized height becomes 480 * x / y instead, @@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Mods private const double hd_sv_scale = (4.0 / 3.0 - 1.0 / 3.0) / (16.0 / 9.0 - 1.0 / 3.0); private double originalSliderMultiplier; + private ControlPointInfo controlPointInfo; protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) @@ -79,12 +80,13 @@ namespace osu.Game.Rulesets.Taiko.Mods public void ApplyToDifficulty(BeatmapDifficulty difficulty) { + // needs to be read after all processing has been run (TaikoBeatmapConverter applies an adjustment which would otherwise be omitted). originalSliderMultiplier = difficulty.SliderMultiplier; - // the hidden mod on stable had an added playfield cover that essentially forced a 4:3 playfield ratio, by cutting off all objects past that size. - // lazer currently uses a playfield adjustment container which keeps a 16:9 ratio. - // therefore, increase the slider multiplier proportionally so that the notes stay on the screen for the same amount of time as on stable. - // note that this will means that the notes will scroll faster as they have a longer distance to travel on the screen in that same amount of time. + // osu-stable has an added playfield cover that essentially forces a 4:3 playfield ratio, by cutting off all objects past that size. + // This is not yet implemented; instead a playfield adjustment container is present which maintains a 16:9 ratio. + // For now, increase the slider multiplier proportionally so that the notes stay on the screen for the same amount of time as on stable. + // Note that this means that the notes will scroll faster as they have a longer distance to travel on the screen in that same amount of time. difficulty.SliderMultiplier /= hd_sv_scale; } From 98e0e89d3f9a2358312a56d23046759e43bb180b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Jun 2021 16:32:59 +0900 Subject: [PATCH 16/16] Nest adjustments for readability --- .../Mods/TaikoModHidden.cs | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 434069291c..0fd3625a93 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -49,28 +49,23 @@ namespace osu.Game.Rulesets.Taiko.Mods switch (hitObject) { case DrawableDrumRollTick _: - break; - case DrawableHit _: + double preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime); + double start = hitObject.HitObject.StartTime - preempt * 0.6; + double duration = preempt * 0.3; + + using (hitObject.BeginAbsoluteSequence(start)) + { + hitObject.FadeOut(duration); + + // DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed. + // in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly. + hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged + ? hitObject.HitObject.GetEndTime() + hitObject.HitObject.HitWindows.WindowFor(HitResult.Miss) + : hitObject.HitStateUpdateTime; + } + break; - - default: - return; - } - - double preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime); - double start = hitObject.HitObject.StartTime - preempt * 0.6; - double duration = preempt * 0.3; - - using (hitObject.BeginAbsoluteSequence(start)) - { - hitObject.FadeOut(duration); - - // DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed. - // in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly. - hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged - ? hitObject.HitObject.GetEndTime() + hitObject.HitObject.HitWindows.WindowFor(HitResult.Miss) - : hitObject.HitStateUpdateTime; } }