Skip to content

Conversation

Nomagno
Copy link
Contributor

@Nomagno Nomagno commented Aug 24, 2025

Known bug for years, happens most often when playing on a server with a custom powerup.xml or when one's internet connection is bad/has a lot of packet loss. This PR simply removes a check in Powerup::set() that made sure not to re-create the sound source when rewinding. This check was unnecessary and produced an audio bug where basically the client would decide on an item sound, and never change it regardless of whether the server corrected this item or not. The Powerup::rewindTo() function already makes sure not to invoke Powerup::set() for cases where the sound source would not need to be recreated (item of the same type), so as far as I know there are no concerns about unneeded memory accesses.

Agreement

By creating a pull request in stk-code, you hereby agree to dual-license your contribution as
GNU General Public License version 3 or any later version and
Mozilla Public License version 2 or any later version.

This includes your previous contribution(s) under the same name of contributor.

Keep the above statement in the pull request comment for agreement.

@Alayan-stk-2
Copy link
Collaborator

If I understand correctly: in case the client mispredicts the powerup (rare event or config mismatch), the client currently plays the sound of the wrong powerup, and this check prevents rewind from fixing it?

I'll have to do some testing to double-check, but if there is already a check to prevent the correct sound from being restarted or played multiple times, then this should indeed work.

@Nomagno
Copy link
Contributor Author

Nomagno commented Aug 24, 2025

That's correct.

This touches the set function, which just sets up the sound source itself to be played later when the powerup is actually used. I believe playing the sound is handled in a completely different part of the code and I have encountered no such issue in my testing, but yeah probably good to re-verify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants