Repository navigation
Animate players on the SDK base player anim state - #2244
sunzenshen wants to merge 3 commits into
Conversation
| //----------------------------------------------------------------------------- | ||
| // 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 | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
There was a problem hiding this comment.
actually just moving in a direction while landing
There was a problem hiding this comment.
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.
ef11d9b to
70d19d2
Compare
AdamTadeusz
left a comment
There was a problem hiding this comment.
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
70d19d2 to
a45b0e1
Compare
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.
a45b0e1 to
5440e48
Compare
|
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) |


Description
This change moves player animation back to the Source SDK base animation state used by classic NEOTOKYO.
CNEOPlayerAnimStaterestores 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
Linked Issues