Skip to content

Stop dead players making footstep sounds - #2317

Merged
sunmachine merged 2 commits into
NeotokyoRebuild:masterfrom
sunmachine:footsteps/corpse-sounds
Nov 17, 2026
Merged

sunmachine merged 2 commits into
NeotokyoRebuild:masterfrom
sunmachine:footsteps/corpse-sounds

Conversation

@sunmachine

@sunmachine sunmachine commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

  • You no longer hear footsteps from a body after a kill. A player killed while running kept stepping on everyone else's client from where they fell. When they died sprinting it was a step every 0.3 s at running volume, until they became an observer up to 10 s later. Now the steps stop when they die.

Guarantees

  • Every client agrees. The check is in shared code, so the server, the dead player's own client and every other client make the same step decision.
  • Living players sound the same as before. The check only fires when m_lifeState is not LIFE_ALIVE.

Unchanged

  • Corpse impact and scrape sounds, which come from ragdoll physics.

For reviewers

  • The cause, at master: while a player is dead, CHL2_Player::PreThink runs PlayerDeathThink on 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.
  • Since Fix silently entering/exiting water #2151, IsMakingFootstepSounds reads that kept speed through GetAbsVelocity() (neo_player_shared.cpp:393). Before Fix silently entering/exiting water #2151, UpdateStepSound used the velocity it was passed, which other clients take from EstimateAbsVelocity. The same updates reset that interpolation history, so the body read as still.
  • It reads m_lifeState rather than calling IsAlive() because IsMakingFootstepSounds is const and IsAlive() is not. The test is the same.
  • IsMakingFootstepSounds writes its out parameters before any early return, and the life check sits with the other early returns at the top. UpdateStepSound reads 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 and sv_footsteps checks returned from UpdateStepSound itself. Since Fix silently entering/exiting water #2151 they returned before the writes and left those values uninitialized.
  • Side effect: the water entry Player.Wade call in UpdateUnderwaterState also asks IsMakingFootstepSounds, so a dead player never plays it now. The exit call was already behind IsAlive().
  • Per tick cost: one integer comparison per call for the life check. Frozen, freeze time and observer players now also compute the speed and step velocities before returning, which is one vector length and a few stores.

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.

  • On master, kill a bot that is sprinting on concrete and stay near the body. You hear footsteps from it for up to 10 s. With this change you hear none.
  • Repeat with a human victim, heard from a second client.
  • Living players' footsteps are unchanged, including crouch, walk and aim silence.

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

  • Linux GCC 10 Sniper 3.0

Linked Issues

@sunmachine
sunmachine requested review from a team and Agiel November 12, 2026 20:57
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
sunmachine force-pushed the footsteps/corpse-sounds branch from 6a8f468 to 7c139f0 Compare November 12, 2026 20:58

@sunmachine sunmachine left a comment

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.

Moving early returns beyond out-parameters.

This patch is a reading example; suggestion blocks can't reach lines outside this PR's diff.

@sunmachine sunmachine left a comment

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.

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 sunmachine left a comment

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.

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.
@sunmachine
sunmachine requested review from a team and Agiel November 13, 2026 04:17
@sunmachine sunmachine added Sound Issues related to audio or sound in some way New Changes for Reviewers New changes has been made. This label is mostly to notify reviewers. labels Nov 13, 2026
@Agiel
Agiel requested a review from a team November 17, 2026 08:22
@sunmachine
sunmachine merged commit 8040217 into NeotokyoRebuild:master Nov 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Changes for Reviewers New changes has been made. This label is mostly to notify reviewers. Sound Issues related to audio or sound in some way

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants