Skip to content

Read mp_slammoveyaw directly in the 9-way move yaw - #2237

Closed
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:anim-cache-slammoveyaw
Closed

sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:anim-cache-slammoveyaw

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

ComputePoseParam_MoveYaw constructs a ConVarRef on every call, causing a name lookup for each player update. This change reads the existing mp_slammoveyaw ConVar directly. It still reads the live value, so changing the cvar takes effect immediately and animation behavior is unchanged.

Testing: On a Linux Release dedicated server, the function's measured time fell from 9.6 to 0.44 microseconds per call. Server frame time fell from 1.01 to 0.86 milliseconds in the paired run. All 30 Release matches and three Debug matches ended with no asserts. Checked that mp_slammoveyaw still toggles move-yaw snapping.

Toolchain

  • Linux GCC Distro Native (Linux Mint 22.3, GCC 13.3.0)

Linked Issues

  • None.

CHL2MPPlayerAnimState::ComputePoseParam_MoveYaw built a ConVarRef by
name on every call, so every player's every usercmd on the server (and
every frame on the client) did a linear CCvar::FindVar walk over all
registered cvars. The ConVar is defined in multiplayer_animstate.cpp,
which both DLLs compile, so refer to it with extern instead. The value
read is the same; only the lookup goes away.

Co-authored-by: Mikhail Bogdanov <Masterkatze@users.noreply.github.com>
@sunzenshen sunzenshen added the Animations Animation stuff. Including the syncronizing of animations between client and server based on state. label Oct 15, 2026
Keep the stock SDK code path unchanged outside NEO builds: only NEO
reads the ConVar directly, other builds keep the by-name lookup.
@AdamTadeusz

AdamTadeusz commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

wowee like +50 fps on isolation with 22 bots

(edit) well the fps counter is difficult to read, 50 fps might be a bit much but definitely a significant improvement

@AdamTadeusz

Copy link
Copy Markdown
Contributor

also no ifdef NEOs, but I understand this is a draft pr and imagine you will want to move this into neoplayeranimstate anyway

@sunzenshen sunzenshen added wontfix This will not be worked on and removed Animations Animation stuff. Including the syncronizing of animations between client and server based on state. labels Oct 16, 2026
@sunzenshen

sunzenshen commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

#2244 might actually accomplish the same and better than this, so waiting of the result of that review before deciding what to do with this PR.

(This PR edits hl2mp_playeranimstate.*, which #2244 no longer uses and could even remove from the build.)

@sunzenshen sunzenshen changed the title Read mp_slammoveyaw directly in the 9-way move yaw [WONTFIX?] Read mp_slammoveyaw directly in the 9-way move yaw Oct 16, 2026
@sunzenshen

Copy link
Copy Markdown
Contributor Author

(Have a backup in case we need this again, but is likely obviated by #2244.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants