Skip to content

WIP: Add client-side prediction for knife hits#1905

Draft
Rainyan wants to merge 5 commits into
NeotokyoRebuild:masterfrom
Rainyan:feat/net-predict-knife
Draft

WIP: Add client-side prediction for knife hits#1905
Rainyan wants to merge 5 commits into
NeotokyoRebuild:masterfrom
Rainyan:feat/net-predict-knife

Conversation

@Rainyan

@Rainyan Rainyan commented Mar 29, 2026

Copy link
Copy Markdown
Member

Description

  • Predict knife damage impact effects for better responsiveness for high latency players
  • Fix issues with backstab damage not working despite being within the backstab angle
  • Move backstab angle to a cvar, and convert from radians to degrees for more intuitive adjustment
  • Add a cvar for toggling whether the pitch component of the view angle is considered in backstab calculations

Examples

300 ms roundtrip latency (net fakelag 150;) without prediction (current state):

knife-impacts-unpredicted.mp4

Same but with prediction (this PR):

knife-impacts-predicted.mp4

Note how the blood impact effect is not delayed in the latter, and renders from the correct position. The sound of the video embeds seems to be bugged, but it shouldn't be desynced in either case in reality.

Toolchain

  • Windows MSVC VS2022

Linked Issues

@Rainyan Rainyan force-pushed the feat/net-predict-knife branch from 1423b95 to 3130eac Compare March 29, 2026 18:12
Rainyan added 5 commits June 3, 2026 11:46
Add a new bot debug command for mirroring the mimic XY axes
Predict the knife hits client-side for a more responsive game feel at
high latencty.

Also changes the knife target angle from abs angles to eye angles,
because the eye angles are networked to clients. Since the playermodel
upper torso also twists according to the eye angle, it probably makes
more sense to use that for the backstab logic.
Add cvars for backstab angle (degrees instead of radians), and add a
cvar for toggling whether to ignore backstab pitch component for
adjusting the "stair stabbing" mechanic.
@Rainyan Rainyan force-pushed the feat/net-predict-knife branch from eeafa21 to 29c9083 Compare June 3, 2026 08:48
@Rainyan Rainyan marked this pull request as ready for review June 3, 2026 09:22
@Rainyan

Rainyan commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

The new bot_mimic_mirror 1 (together with bot_mimic 1) can be used to make the bots look the exact opposite direction (pitch included) for testing backstab mechanics when in close proximity. I didn't nerf the "stair stabbing" mechanic whereby one can land a backstab from the vertical axis, but there is a new cvar sv_neo_backstab_ignorez (default 1) which can be disabled to make it possible to "dodge" a vertical backstab my matching your look direction accordingly, analogous to how one can dodge the regular backstab by using the look yaw angle and continuously facing toward the opponent. Unsure which mode we eventually want, but I'll leave changing that gameplay stuff outside the scope of this PR.

@Rainyan Rainyan requested a review from a team June 3, 2026 09:31
@Rainyan Rainyan changed the title WIP: Add client-side prediction for knife hits Add client-side prediction for knife hits Jun 3, 2026
@Rainyan Rainyan removed the request for review from a team June 15, 2026 19:39
@Rainyan Rainyan marked this pull request as draft June 15, 2026 19:39
@Rainyan Rainyan changed the title Add client-side prediction for knife hits WIP: Add client-side prediction for knife hits Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Knife should be predicted

1 participant