Repository navigation
Stop dead players making footstep sounds - #2317
Merged
sunmachine merged 2 commits intoNov 17, 2026
Merged
Conversation
Players could hear footsteps from a body for up to 10 seconds after killing someone who was running, until the dead player became an observer. Since NeotokyoRebuild#2151, CNEO_Player::IsMakingFootstepSounds takes its speed from GetAbsVelocity, and it never checked that the player was alive. Other clients rebuild that velocity only on updates that keep the same interpolation frame. While a player is dead, CHL2_Player::PreThink runs PlayerDeathThink on every command, and that increments the interpolation frame each time, so other clients kept the speed the player died with. IsMakingFootstepSounds now returns false once m_lifeState is no longer LIFE_ALIVE. It reads m_lifeState because IsAlive is not const. The check is shared, so the server and every client make the same step decision. The check sits after the out parameters are written, as UpdateStepSound reads them even for a silent step. The water entry sound also asks IsMakingFootstepSounds, so a dead player no longer plays Player.Wade. Corpse impact and scrape sounds come from ragdoll physics and are unaffected.
sunmachine
force-pushed
the
footsteps/corpse-sounds
branch
from
November 12, 2026 20:58
6a8f468 to
7c139f0
Compare
Agiel
requested changes
Nov 12, 2026
sunmachine
commented
Nov 13, 2026
sunmachine
left a comment
Contributor
Author
There was a problem hiding this comment.
Moving early returns beyond out-parameters.
This patch is a reading example; suggestion blocks can't reach lines outside this PR's diff.
sunmachine
commented
Nov 13, 2026
sunmachine
left a comment
Contributor
Author
There was a problem hiding this comment.
Moving the life check up, initializing out-parameters at the caller.
This patch is a reading example; suggestion blocks can't reach lines outside this PR's diff.
sunmachine
commented
Nov 13, 2026
sunmachine
left a comment
Contributor
Author
There was a problem hiding this comment.
Making IsAlive const, with OVERRIDE on the guarded overrides.
This patch is a reading example; suggestion blocks can't reach lines outside this PR's diff.
UpdateStepSound passes uninitialized locals to IsMakingFootstepSounds and reads them back even for a silent step, to set the step timer and pick the ladder branch. Before NeotokyoRebuild#2151 the frozen, freeze time, noclip or observer and sv_footsteps checks returned from UpdateStepSound itself, so those locals were never read. Since NeotokyoRebuild#2151 they return false from IsMakingFootstepSounds before the out parameters are written, and UpdateStepSound reads whatever was on the stack. The out parameters are now written first. The life check moves up to join the other early returns, so a dead player skips the rest of the step decision.
Agiel
approved these changes
Nov 17, 2026
sunzenshen
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Players could hear footsteps from a body for up to 10 seconds after a kill, most clearly when the victim died sprinting. This makes a dead player silent on every client.
A dead player makes no footsteps.
Changes
Guarantees
m_lifeStateis notLIFE_ALIVE.Unchanged
For reviewers
CHL2_Player::PreThinkrunsPlayerDeathThinkon every command (hl2_player.cpp:927-933), and that increments the interpolation frame each time (player.cpp:2287). Other clients rebuild a remote player's velocity only on updates whose interpolation frame did not change (c_baseplayer.cpp:999-1005), so they keep the speed the player died with.IsMakingFootstepSoundsreads that kept speed throughGetAbsVelocity()(neo_player_shared.cpp:393). Before Fix silently entering/exiting water #2151,UpdateStepSoundused the velocity it was passed, which other clients take fromEstimateAbsVelocity. The same updates reset that interpolation history, so the body read as still.m_lifeStaterather than callingIsAlive()becauseIsMakingFootstepSoundsisconstandIsAlive()is not. The test is the same.IsMakingFootstepSoundswrites its out parameters before any early return, and the life check sits with the other early returns at the top.UpdateStepSoundreads those values even for a silent step, to set the step timer and choose the ladder branch, and stops only at the silent return (baseplayer_shared.cpp:718). Before Fix silently entering/exiting water #2151, the frozen, freeze time, noclip or observer andsv_footstepschecks returned fromUpdateStepSounditself. Since Fix silently entering/exiting water #2151 they returned before the writes and left those values uninitialized.Player.Wadecall inUpdateUnderwaterStatealso asksIsMakingFootstepSounds, so a dead player never plays it now. The exit call was already behindIsAlive().Testing
Built on Linux with the unity build, and with the changed file on its own in the non-unity build. The step decision was replayed over the networked state in a SourceTV recording of a v35.0-alpha server, where the kill that ended a round was followed by 34 footsteps from the body over 9.9 s.
The listener needs a snapshot every tick to hear it on master. A listen server running well below the tick rate can hide it.
Toolchain
Linked Issues