From b737ffe4eab1da66a80dcc1eadd10edefad360de Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 27 Mar 2026 14:18:57 +0900 Subject: [PATCH 1/2] Ranked Play: Simplify track handling + fix song preview (#37111) - Simplifies track handling by not attaching to the global beatmap, not looping, and moving into `GameplayWarmupScreen` where the beatmap is set. - The main idea here is that the transition period until gameplay is so short (~10 seconds) that we don't need to account for the track ever looping in the first place. - Fixes the track not playing from its preview point (feedback item mentioned in some meeting a while back). This is definitely going to conflict with @nekodex 's work, sorry about that. It's a bit of a much-of-a-muchness change (imo) if the conclusion is to wait for ongoing work first. --- .../RankedPlay/GameplayWarmupScreen.cs | 7 +++ .../RankedPlay/RankedPlayScreen.cs | 48 +------------------ 2 files changed, 9 insertions(+), 46 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/GameplayWarmupScreen.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/GameplayWarmupScreen.cs index a67fbab55b3b..2ebf7767c338 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/GameplayWarmupScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/GameplayWarmupScreen.cs @@ -53,6 +53,9 @@ public partial class GameplayWarmupScreen : RankedPlaySubScreen [Resolved] private RulesetStore rulesets { get; set; } = null!; + [Resolved] + private MusicController musicController { get; set; } = null!; + [Resolved] private Bindable globalBeatmap { get; set; } = null!; @@ -164,6 +167,10 @@ protected override void LoadComplete() globalRuleset.Value = ruleset; globalMods.Value = item.RequiredMods.Select(m => m.ToMod(rulesetInstance)).ToArray(); + // Play the new track from its preview point. + globalBeatmap.Value.PrepareTrackForPreview(false); + musicController.Play(true); + Client.ChangeState(MultiplayerUserState.Ready).FireAndForget(); } diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/RankedPlayScreen.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/RankedPlayScreen.cs index 8ecce26075ee..ee4556e1b824 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/RankedPlayScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/RankedPlayScreen.cs @@ -66,9 +66,6 @@ public partial class RankedPlayScreen : OsuScreen, IPreviewTrackOwner, IHandlePr [Resolved] private PreviewTrackManager previewTrackManager { get; set; } = null!; - [Resolved] - private MusicController music { get; set; } = null!; - [Resolved] private QueueController? controller { get; set; } @@ -285,16 +282,9 @@ private void onStageChanged(RankedPlayStage stage) } } - public override void OnEntering(ScreenTransitionEvent e) - { - base.OnEntering(e); - - beginHandlingTrack(); - } - public override void OnSuspending(ScreenTransitionEvent e) { - endHandlingTrack(); + previewTrackManager.StopAnyPlaying(this); base.OnSuspending(e); } @@ -312,7 +302,7 @@ public override bool OnExiting(ScreenExitEvent e) return true; } - endHandlingTrack(); + previewTrackManager.StopAnyPlaying(this); client.LeaveRoom().FireAndForget(); @@ -341,8 +331,6 @@ public override void OnResuming(ScreenTransitionEvent e) { base.OnResuming(e); - beginHandlingTrack(); - if (e.Last is not MultiplayerPlayerLoader playerLoader) return; @@ -355,38 +343,6 @@ public override void OnResuming(ScreenTransitionEvent e) client.ChangeState(MultiplayerUserState.Idle).FireAndForget(); } - /// - /// Handles changes in the track to keep it looping while active. - /// - private void beginHandlingTrack() - { - Beatmap.BindValueChanged(applyLoopingToTrack, true); - } - - /// - /// Stops looping the current track and stops handling further changes to the track. - /// - private void endHandlingTrack() - { - Beatmap.ValueChanged -= applyLoopingToTrack; - Beatmap.Value.Track.Looping = false; - - previewTrackManager.StopAnyPlaying(this); - } - - /// - /// Invoked on changes to the beatmap to loop the track. See: . - /// - /// The beatmap change event. - private void applyLoopingToTrack(ValueChangedEvent beatmap) - { - if (!this.IsCurrentScreen()) - return; - - beatmap.NewValue.PrepareTrackForPreview(true); - music.EnsurePlayingSomething(); - } - public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset) { // Do nothing to prevent the user from potentially being kicked out From 522d2bd896edecfa0a770564d748dd58c9e7bf8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 27 Mar 2026 06:36:33 +0100 Subject: [PATCH 2/2] Fix editor showing no background at all if storyboard that does not replace background is disabled (#37112) Man this "storyboard replaces background" baloney has taken hours of bugfixing alone. So many forehead indentations from stepping onto this stupid rake. This still fails in one more case: when you download a no-video variant of a beatmap that has video, but then edit it, all of the flags on storyboard will claim that the beatmap has a storyboard that replaces a background, but the video asset is missing, so the background will still be black. There's currently no way to check for this and the simplest way to address this as far as I can see would be reverting https://github.com/ppy/osu/pull/37038 and going with the non-refactor route to fix https://github.com/ppy/osu/issues/36875 instead. The alternative is adding all sorts of weird jingles and checks in the storyboard machinery that can be used to be able to tell that a video was supposed to be present in the storyboard but is missing. Also when entering editor on a map that has background video and storyboard enabled the background will be black until you hit play. Something to do with `Video` idiosyncrasies for sure. Closes https://github.com/ppy/osu/issues/37104 maybe? Kind of? Partially? I don't know. This is all very low effort because I'm not confident about digging this ditch any deeper, but just PRing a direct revert would feel pretty offensive I guess? --- osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs b/osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs index b2fa05ae1bd7..f44cbbea819d 100644 --- a/osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs +++ b/osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs @@ -111,6 +111,9 @@ public void RefreshBackgroundAsync() private void updateState(bool withAnimation = true) { background?.Storyboard.FadeTo(showStoryboard.Value ? 1 : 0, withAnimation ? 500 : 0, Easing.OutQuint); + // if the storyboard is disabled, in some cases (e.g. involving `StoryboardReplacesBackground`) + // we still need to show the background sprite, because if we don't, then there will be no background shown at all + background?.Sprite.FadeTo(showStoryboard.Value ? 0 : 1, withAnimation ? 500 : 0, Easing.OutQuint); } public override bool Equals(BackgroundScreen? other)