From 51762769643306ab72f081e182a4a4d4956d9958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 8 Oct 2026 06:01:22 +0300 Subject: [PATCH 1/2] Fix usercmd packets being throttled on loopback connections --- Source.Engine/CL.cs | 3 ++- Source.Engine/Host.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source.Engine/CL.cs b/Source.Engine/CL.cs index 5e107fa7a..fa4da09a5 100644 --- a/Source.Engine/CL.cs +++ b/Source.Engine/CL.cs @@ -148,7 +148,8 @@ public void Move(double accumulatedExtraSamples, bool finalTick) { bool sendPacket = true; - if (Net.Time < cl.NextCmdTime || !cl.NetChannel!.CanPacket()) + if ((!cl.NetChannel!.IsLoopback() || Host.host_limitlocal.GetInt() != 0) && + (Net.Time < cl.NextCmdTime || !cl.NetChannel!.CanPacket() || !finalTick)) sendPacket = false; if (cl.IsActive()) { diff --git a/Source.Engine/Host.cs b/Source.Engine/Host.cs index 6101a6a27..8f47c5304 100644 --- a/Source.Engine/Host.cs +++ b/Source.Engine/Host.cs @@ -51,6 +51,7 @@ public partial class Host public static readonly ConVar host_map = new("host_map", "", 0, "Current map name."); public static readonly ConVar developer = new("developer", "0", 0, "Set developer message level"); public static readonly ConVar host_timescale = new("host_timescale", "1.0", FCvar.Replicated, "Prescale the clock by this amount."); + public static readonly ConVar host_limitlocal = new("host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection"); #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. public static GameClient? Client; From 155dc5d6b495fb6a18d69a837ad6ec9aabaec8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 8 Oct 2026 06:01:22 +0300 Subject: [PATCH 2/2] Fix view offset not being interpolated on the client --- Game.Client/C_BasePlayer.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Game.Client/C_BasePlayer.cs b/Game.Client/C_BasePlayer.cs index 1e557f4d3..ab7310dfb 100644 --- a/Game.Client/C_BasePlayer.cs +++ b/Game.Client/C_BasePlayer.cs @@ -47,6 +47,13 @@ public partial class C_BasePlayer : C_BaseCombatCharacter, IGameEventListener2 public override ShadowType ShadowCastType() => ShadowType.None; + static readonly DynamicAccessor DA_ViewOffset = FIELD.OF(nameof(ViewOffset)); + public readonly InterpolatedVar IV_ViewOffset = new($"{nameof(C_BasePlayer)}.{nameof(IV_ViewOffset)}"); + + public C_BasePlayer() { + AddVar(this, DA_ViewOffset, IV_ViewOffset, LatchFlags.LatchSimulationVar, true); + } + public static readonly DataMap PM_PlayerState = new(typeof(PlayerState), [ DEFINE.PRED_FIELD( nameof(PlayerState.DeadFlag), FieldType.Boolean, FieldTypeDescFlags.InSendTable ), ]);