From 80ddfc3b1e33f3c93c5174fef01fd4819bbccfcb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Jul 2019 10:27:51 +0900 Subject: [PATCH 1/4] Disable frame accurate replay playback I want to prioritise better playback performance over accuracy for now. Also, in my testing this is still 100% accurate due to the addition of the FrameStabilityContainer, which is pretty cool. --- osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index 3830fa5cbe..4c011388fa 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -84,7 +84,7 @@ private bool advanceFrame() /// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data. /// Disabling this can make replay playback smoother (useful for autoplay, currently). /// - public bool FrameAccuratePlayback = true; + public bool FrameAccuratePlayback = false; protected bool HasFrames => Frames.Count > 0; From 2a3601e43b26c70f93f7d4532e0313db92d72c03 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Jul 2019 11:42:30 +0900 Subject: [PATCH 2/4] Fix test class filename case --- ...eplayinputHandlerTest.cs => FramedReplayInputHandlerTest.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Tests/NonVisual/{FramedReplayinputHandlerTest.cs => FramedReplayInputHandlerTest.cs} (99%) diff --git a/osu.Game.Tests/NonVisual/FramedReplayinputHandlerTest.cs b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs similarity index 99% rename from osu.Game.Tests/NonVisual/FramedReplayinputHandlerTest.cs rename to osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs index 73387fa5ab..aa5bb02cdd 100644 --- a/osu.Game.Tests/NonVisual/FramedReplayinputHandlerTest.cs +++ b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs @@ -9,7 +9,7 @@ namespace osu.Game.Tests.NonVisual { [TestFixture] - public class FramedReplayinputHandlerTest + public class FramedReplayInputHandlerTest { private Replay replay; private TestInputHandler handler; From bd53a96507ee406e28e38272fe904cb7607597eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Jul 2019 11:47:50 +0900 Subject: [PATCH 3/4] Ensure tests cannot run forever --- .../NonVisual/FramedReplayInputHandlerTest.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs index aa5bb02cdd..2f1c4831a4 100644 --- a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs +++ b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using NUnit.Framework; using osu.Game.Replays; @@ -160,10 +161,7 @@ public void TestBasicRewind() [Test] public void TestRewindInsideImportantSection() { - // fast forward to important section - while (handler.SetFrameFromTime(3000) != null) - { - } + fastForwardToPoint(3000); setTime(4000, 4000); confirmCurrentFrame(4); @@ -205,10 +203,7 @@ public void TestRewindInsideImportantSection() [Test] public void TestRewindOutOfImportantSection() { - // fast forward to important section - while (handler.SetFrameFromTime(3500) != null) - { - } + fastForwardToPoint(3500); confirmCurrentFrame(3); confirmNextFrame(4); @@ -227,6 +222,15 @@ public void TestRewindOutOfImportantSection() confirmNextFrame(2); } + private void fastForwardToPoint(double destination) + { + for (int i = 0; i < 1000; i++) + if (handler.SetFrameFromTime(destination) == null) + return; + + throw new TimeoutException("Seek was never fulfilled"); + } + private void setTime(double set, double? expect) { Assert.AreEqual(expect, handler.SetFrameFromTime(set)); From 5e2adf59beaff47a0dd0724067852df1dfd2dc8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Jul 2019 11:53:34 +0900 Subject: [PATCH 4/4] Enforce frame accuracy for tests --- osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs index 2f1c4831a4..18cbd4e7c5 100644 --- a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs +++ b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs @@ -278,6 +278,7 @@ private class TestInputHandler : FramedReplayInputHandler public TestInputHandler(Replay replay) : base(replay) { + FrameAccuratePlayback = true; } protected override double AllowedImportantTimeSpan => 1000;