From ff2a67bc7482f54118aeb3cbad8542c4e6674bd8 Mon Sep 17 00:00:00 2001
From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Date: Sun, 21 Aug 2022 07:27:41 +1200
Subject: [PATCH] Revert PVS changes (#10735)
---
.../EscapeMenu/UI/Tabs/NetworkTab.xaml | 2 +-
.../EscapeMenu/UI/Tabs/NetworkTab.xaml.cs | 15 +++++----
Content.IntegrationTests/PoolManager.cs | 1 +
.../Networking/SimplePredictReconcileTest.cs | 31 +++++++------------
Content.Shared/Entry/EntryPoint.cs | 2 +-
.../en-US/escape-menu/ui/options-menu.ftl | 6 +---
.../Entities/Structures/Wallmounts/switch.yml | 1 +
7 files changed, 26 insertions(+), 32 deletions(-)
diff --git a/Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml b/Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml
index 1b530fba8e..7d2741ab14 100644
--- a/Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml
+++ b/Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml
@@ -8,7 +8,7 @@
();
var cEntityManager = client.ResolveDependency();
var sGameTiming = server.ResolveDependency();
- var cGameTiming = client.ResolveDependency();
+ var cGameTiming = client.ResolveDependency();
var cGameStateManager = client.ResolveDependency();
- var cfg = client.ResolveDependency();
- var log = cfg.GetCVar(CVars.NetLogging);
-
- //cfg.SetCVar(CVars.NetLogging, true);
EntityUid serverEnt = default;
PredictionTestComponent serverComponent = default!;
@@ -79,13 +72,15 @@ namespace Content.IntegrationTests.Tests.Networking
// Run some ticks so that
await PoolManager.RunTicksSync(pairTracker.Pair, 3);
- // Check client buffer is full
- Assert.That(cGameStateManager.CurrentBufferSize, Is.EqualTo(cGameStateManager.TargetBufferSize));
-
- // This isn't required anymore, but the test had this for the sake of "technical things", and I cbf shifting
- // all the tick times over. So it stays.
+ // Due to technical things with the game state processor it has an extra state in the buffer here.
+ // This burns through it real quick, but I'm not sure it should be there?
+ // Under normal operation (read: not integration test) this gets corrected for via tick time adjustment,
+ // so it's probably not an issue?
await client.WaitRunTicks(1);
+ // 2 is target buffer size.
+ Assert.That(cGameStateManager.CurrentBufferSize, Is.EqualTo(2));
+
await client.WaitPost(() =>
{
clientComponent = cEntityManager.GetComponent(serverEnt);
@@ -102,7 +97,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Client last ran tick 15 meaning it's ahead of the last server tick it processed (12)
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(16)));
- Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick(12)));
+ Assert.That(cGameStateManager.CurServerTick, Is.EqualTo(new GameTick(12)));
// *** I am using block scopes to visually distinguish these sections of the test to make it more readable.
@@ -178,7 +173,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Assert timing is still correct, should be but it's a good reference for the rest of the test.
Assert.That(sGameTiming.CurTick, Is.EqualTo(new GameTick(18)));
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(20)));
- Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick(16)));
+ Assert.That(cGameStateManager.CurServerTick, Is.EqualTo(new GameTick(16)));
{
// Send event to server to change flag again, this time to disable it..
@@ -249,7 +244,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Assert timing is still correct.
Assert.That(sGameTiming.CurTick, Is.EqualTo(new GameTick(22)));
Assert.That(cGameTiming.CurTick, Is.EqualTo(new GameTick(24)));
- Assert.That(cGameTiming.LastProcessedTick, Is.EqualTo(new GameTick(20)));
+ Assert.That(cGameStateManager.CurServerTick, Is.EqualTo(new GameTick(20)));
{
// Send first event to disable the flag (reminder: it never got accepted by the server).
@@ -364,8 +359,6 @@ namespace Content.IntegrationTests.Tests.Networking
Assert.That(clientComponent.Foo, Is.True);
}
}
-
- cfg.SetCVar(CVars.NetLogging, log);
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.Shared/Entry/EntryPoint.cs b/Content.Shared/Entry/EntryPoint.cs
index 39d14f4ca4..264b5f8a7e 100644
--- a/Content.Shared/Entry/EntryPoint.cs
+++ b/Content.Shared/Entry/EntryPoint.cs
@@ -40,7 +40,7 @@ namespace Content.Shared.Entry
var configMan = IoCManager.Resolve();
#if FULL_RELEASE
- configMan.OverrideDefault(CVars.NetBufferSize, 2);
+ configMan.OverrideDefault(CVars.NetInterpRatio, 2);
#elif DEBUG
configMan.OverrideDefault(CVars.NetFakeLagMin, 0.075f);
configMan.OverrideDefault(CVars.NetFakeLoss, 0.005f);
diff --git a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
index 1ebbd51992..0902186943 100644
--- a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
+++ b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
@@ -169,8 +169,4 @@ ui-options-function-shuttle-brake = Brake
## Network menu
-ui-options-net-interp-ratio = State buffer size
-ui-options-net-interp-ratio-tooltip = Increasing this will generally make the game
- more resistant to packet-loss, however in doing
- so it effectively adds slightly more latency and
- requires the client to predict more future ticks.
+ui-options-net-interp-ratio = Network Smoothing
diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/switch.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/switch.yml
index b497f5a26e..5dfb21d0da 100644
--- a/Resources/Prototypes/Entities/Structures/Wallmounts/switch.yml
+++ b/Resources/Prototypes/Entities/Structures/Wallmounts/switch.yml
@@ -130,6 +130,7 @@
- type: Construction
graph: LeverGraph
node: LeverNode
+ - type: Fixtures
- type: SignalTransmitter
outputs:
Left: []