Skip to content

Animate players on the SDK base player anim state - #2244

Draft
sunzenshen wants to merge 3 commits into
NeotokyoRebuild:masterfrom
sunzenshen:anim-sdk-base
Draft

sunzenshen wants to merge 3 commits into
NeotokyoRebuild:masterfrom
sunzenshen:anim-sdk-base

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

This change moves player animation back to the Source SDK base animation state used by classic NEOTOKYO. CNEOPlayerAnimState restores the base movement and aim blends while retaining NT;RE-specific gestures, lean behavior, client-side animation, and network fields.

The change also aligns jump, sprint, and standing-turn animations with the reviewed behavior. It keeps the existing weapon and class substitutions for gestures. Known differences and unverified cases, including ladder animation in classic and exact 180-degree turns, are described in the PR's test notes.

Testing: Compared per-frame animation logs and clips from classic, master, and this branch. The reviewed jump, torso blend, sprint, and standing-turn cases matched the expected behavior; bot spectating and gesture checks showed no new animation failures. A Debug run reported only the known startup assert.

Toolchain

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

Linked Issues

  • None.

Comment thread src/game/client/hl2mp/c_hl2mp_player.h Resolved
Comment thread src/game/server/hl2mp/hl2mp_player.h Resolved
Comment on lines +237 to +272
//-----------------------------------------------------------------------------
// Purpose: Whether a jumping player has landed. The client draws other players a few tenths of a second behind
// their networked ground flag, so there the jump lasts until the drawn body reaches the ground.
//-----------------------------------------------------------------------------
bool CNEOPlayerAnimState::HasLandedFromJump()
{
if ( !( m_pPlayer->GetFlags() & FL_ONGROUND ) )
{
#ifdef CLIENT_DLL
m_flJumpGroundFlagTime = 0.0f;
#endif
return false;
}

#ifdef CLIENT_DLL
if ( m_flJumpGroundFlagTime <= 0.0f )
{
m_flJumpGroundFlagTime = gpGlobals->curtime;
}

if ( gpGlobals->curtime - m_flJumpGroundFlagTime > JUMP_LAND_MAX_FLAG_LEAD )
{
return true;
}

const Vector &vecOrigin = m_pPlayer->GetAbsOrigin();
trace_t tr;
UTIL_TraceHull( vecOrigin, vecOrigin - Vector( 0, 0, JUMP_LAND_GROUND_DIST ),
m_pPlayer->GetPlayerMins(), m_pPlayer->GetPlayerMaxs(),
MASK_PLAYERSOLID, m_pPlayer, COLLISION_GROUP_PLAYER_MOVEMENT, &tr );

return tr.fraction < 1.0f || tr.startsolid;
#else
return true;
#endif // CLIENT_DLL
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain what this code is doing? A player's animation determines where their hitboxes are, so it's very important we predict a players animation state correctly. Seeing different logic on the client vs server makes me nervous.

@sunzenshen sunzenshen Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this code was an attempt to fix an animation quirk with the jump animation, where in the middle of the jump the walk animation is triggered on the way down.

jump-reset

Even with the side by side comparison and foreknowledge of the transition, I don't easily notice it, so I can revert this change and try to stay consistent with upstream. Then we can address this case in a future PR if people still see the issue. I'll take a look when I get back to my dev setup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falling from a great height shows the issue more clearly
image
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually just moving in a direction while landing

@AdamTadeusz AdamTadeusz Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is subjective but testing with host_timescale 0.25, I prefer the look where the character begins moving their legs in the direction of their movement in mid air.

@AdamTadeusz AdamTadeusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to the attempt to stop the legs from running mid air, I just think we need to be careful about diverging behavior between client and server. Also I'm curious if there is a way to check how far away from the ground a player is without doing a trace, maybe by comparing a player's interpolated position against their networked position or something like that, although I couldn't figure it out in the limited testing I did, but at least it makes sense to me in theory that the update that updates the Ground flag should also have the player origin on the ground, and we can maybe check somehow how the players draw origin compares against that, but again an idea for another PR. IDK, networking is hard

@sunzenshen
sunzenshen requested a review from a team October 28, 2026 05:59
sunzenshen and others added 3 commits November 9, 2026 23:59
Move the player animation back onto CBasePlayerAnimState, the 2006
SDK base classic NEOTOKYO is built on, which neo compiles but did not
use. CNEOPlayerAnimState replaces CHL2MPPlayerAnimState and takes
CMultiPlayerAnimState out of the build (the files stay on disk).

The base gives classic's torso blend by speed, constant leg ground
speeds, the 3 s face-front timer and its feet rules. The new class
adds the run legs only while sprinting, the jump held until a drawn
landing, one gesture layer for fire, reload, grenade and detpack
events, the lean rule, the NeotokyoRebuild#2108 transitioner reset, and a face-front
timer counted from the last squared frame so server and client agree.
Client-side animation and the network excludes from NeotokyoRebuild#653 are kept.
Wrap neo_playeranimstate.h includes in #ifdef NEO blocks in the
HL2MP player headers, following review feedback.

Remove HasLandedFromJump() — jump animation tampering is out of
scope for this PR. The jump pose now ends when the player has been
in the air at least JUMP_MIN_TIME and FL_ONGROUND is set.

Also removes the JUMP_LAND_* constants and m_flJumpGroundFlagTime
member that were only used by that function.
@sunzenshen

Copy link
Copy Markdown
Contributor Author

When I recently attempted to create a coverage catalog of all the different animations and the differences in coverage, the animation logs didn't have a significant difference between master, ogNT, and this PR beyond some animation edge cases.

For now, let's see if merging just #2319 resolves most of the impressions of animations being smoother in the original.

(drafted)

@sunzenshen
sunzenshen marked this pull request as draft November 15, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Animations Animation stuff. Including the syncronizing of animations between client and server based on state.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants