1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-29 06:09:59 +08:00

Fix multiplayer spectator potentially taking too long to start

When watching from the middle of gameplay, due to a series of failures,
`SpectatorClock` would not get seeked to the current time, causing all
clients to look like they were out of sync.

This is a hotfix for the issue. A better fix will require framework
changes or considerable restructuring.

I'd recommend testing this works in practice and agreeing that while it
is a hack, it's likely not going to cause issues and is something we
want to see fixed sooner rather than later.
This commit is contained in:
Dean Herbert
2023-08-02 18:26:36 +09:00
Unverified
parent dc9c68b642
commit 87fee001c7
2 changed files with 9 additions and 0 deletions
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Logging;
using osu.Framework.Timing;
using osu.Game.Screens.Play;
@@ -59,6 +60,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
public bool Seek(double position)
{
Logger.Log($"{nameof(SpectatorPlayerClock)} seeked to {position}");
CurrentTime = position;
return true;
}
@@ -160,6 +160,13 @@ namespace osu.Game.Screens.Play
Seek(StartTime);
// This is a workaround for the fact that DecoupleableInterpolatingFramedClock doesn't seek the source
// if the source is not IsRunning. (see https://github.com/ppy/osu-framework/blob/2102638056dfcf85d21b4d85266d53b5dd018767/osu.Framework/Timing/DecoupleableInterpolatingFramedClock.cs#L209-L210)
//
// This breaks in multiplayer spectator.
// I hope to remove this once we knock some sense into clocks in general.
(SourceClock as IAdjustableClock)?.Seek(StartTime);
if (!wasPaused || startClock)
Start();
}