Skip to content

[WONTFIX?] Play the sprint legs only at sprint speed - #2242

Draft
sunzenshen wants to merge 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:anim-sprint-legs-speed
Draft

sunzenshen wants to merge 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:anim-sprint-legs-speed

Conversation

@sunzenshen

Copy link
Copy Markdown
Contributor

Description

Case 4: sprint legs at walking speed.
Review page: exported review page (Dropbox) · live review page (opening it lets you request access with your email or Claude account).

HandleMoving plays the sprint legs (Run_lower, authored at about 130 u/s) whenever IsSprinting() is set, whatever the speed. Sprint starts as soon as the key is held and the player moves, so a sprint from a stand plays the sprint legs from the first frames (74 u/s), and a player who stops with the key still held keeps them down to 1 u/s, with the feet sliding. Classic NEOTOKYO picks the legs by speed only (walk_lower up to 175 u/s, Run_lower above, as the 2006 SDK does), so its sprint legs never play slowly.

This PR keeps the sprint key as the trigger and adds a speed: the sprint legs play only above 100 u/s (2D). One condition and one named constant: +7 / -1 lines (with the #ifdef NEO guard and a two-line comment) in hl2mp_playeranimstate.cpp. The Source SDK base has nothing to call here: CMultiPlayerAnimState::HandleMoving always runs (ACT_MP_RUN), and the 2006 base's speed rule lives in the SDK template, which neo does not derive from.

Why 100 u/s and not classic's 175: neo's slowest sprints are 185 u/s (Assault with a 0.725 speed-scale rifle), and bots sprint through turns at 100-180 u/s. Replaying the frames of a 10-bot master log through each threshold, the legs would swap walk/run inside a sprint 29 times in 24 sprints at 175, 13 at 130, and 3 at 100. 100 u/s is also the 2006 base's top walking speed (classic's ACT_WALK maximum ground speed). Players see the difference from classic only while sprinting at 100-175 u/s, which lasts one or two frames at a start and about 0.1 s at a stop.

Independent of the other animation PRs from the review page. #2241 (case 1) changes the else branch of the same if in HandleMoving to a horizontal-speed test; the two merge without conflict (trial merge of this branch, #2241 and #2240 checked). The torso part of case 4 (full run torso while sprinting) belongs to #2240.

How this was compared

The code came first: neo's HandleMoving against the 2006 base classic is built on, and classic's client.dll read for its leg rule (CalcMainActivity: 2D speed > 0.5 walks, > 175.0 runs, no sprint test). Then per-frame animation logs from both games (classic's cl_showanimstate_log, neo's harness log) on the same map (nt_rise_ctg), class and weapon (Jinrai Assault, MPN), with the same scripted keys, read by the same scripts. Then side-by-side clips. Numbers come from the logs, not from watching.

How to test

  1. Hold sprint and then press forward from a stand: walk legs for the first few frames, sprint legs from 100 u/s.
  2. Sprint, then release forward with sprint still held: the legs go to the walk legs and stop with them, no sprint legs at a standstill (also against a wall).
  3. Sprint, release sprint, keep running: walk legs at run speed, as before.

Results

Scripted pass (thirdperson in neo; classic logs in first person, which it does not draw differently): (a) sprint key, then forward, from a stand; stop with the key held; (b) run, sprint, release sprint; (c) both keys together; (d) run, sprint, stop with the key held. Classic starts no sprint when the key is held before moving, so (a) and (c) are runs there. neo Release builds of master (f426c22) and this PR.

classic master this PR
slowest frame with sprint legs, sprint start 180-194 u/s 74 u/s 100-127 u/s
slowest frame with sprint legs, stop with the key held 218 u/s (next frame walk) 1 u/s 104 u/s (next frame walk)
frames with sprint legs below 100 u/s, whole pass 0 32 (about 1 s) 0
sprint legs below 130 u/s, stop with the key held (a / d) 0 / 0 s 0.39 / 0.48 s 0.10 / 0 s
torso while sprinting (Run_Upper share; case 2) 0.71-0.75 0.95-0.96 0.90-0.94

An earlier pass with longer sprints ended against walls: master played the sprint legs at 1 u/s for 2.7 s while the key was held against the wall; this PR, none.

Bots (10 on ntre_rise_ctg, chase camera cycling through them, 120 s each): sprint-leg frames below 100 u/s: master 5 of 920, this PR 0 of 856. Bots also swap walk/sprint legs when they tap the sprint key, in both builds (master 20, this PR 36 quick swaps in 120 s; the live counts vary run to run with the bots' key use, the replay above isolates the threshold).

Unchanged by construction: non-sprinting legs and crouching (the walk branch is untouched); checked on the pass: walk legs at run speed (136 u/s) before and after the sprint in both builds. A Debug client with 10 bots on ntre_rise_ctg (90 s) logged only the known neo_root.cpp (378) localizedWszStr at startup.

Not changed: whether sprint should start from a stand (classic needs the key pressed while moving); the sprint legs still play at sprint speed only while the key is held, so a player released from sprint at 200 u/s shows the walk legs for the few frames of slowing down, as before.

GIF (master / this PR, side view, half speed: sprint from a stand, then stop with the key held; classic cannot be filmed here: it has no third-person view and its bots do not copy a mimicked sprint): case4-sprint-legs.gif

A player holding the sprint key played the sprint legs (Run_lower) at
any speed: from 69 u/s at a standing sprint start, and at a few u/s
when stopping with the key held, so the feet slid. Classic NEOTOKYO
plays them only above 175 u/s. neo's slowest sprints (185 u/s) dip
below 175 at every turn, which would swap the legs back and forth, so
the switch is at 100 u/s, the 2006 SDK's top walking speed.
@sunzenshen sunzenshen added the Animations Animation stuff. Including the syncronizing of animations between client and server based on state. label Oct 15, 2026
@sunzenshen

Copy link
Copy Markdown
Contributor Author

🤔

image-1792048148630

@sunzenshen

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 Play the sprint legs only at sprint speed [WONTFIX?] Play the sprint legs only at sprint speed Oct 16, 2026
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.

1 participant