Avoiding havoc when there is a missing sound resource

posted in Merc Tactics
Published December 09, 2023
Advertisement

I remember reading a blog post about a game developer who forget to include a sound file for his game update and that caused the game to close down at certain time. This caused havoc because no one could play the game anymore and had to release an emergency update to fix the problem

Well, we are all human and make mistakes, but there's is a simple solution that can mitigate this issue. Normally, a sound is not a critical resource for a game. For instance, it could be just be audio feedback for an action, so closing down the entire game is not the appropriate way to handle a missing file error. What I do is instead of throwing an error I play a null sound when the sound resource can be found. The code is something like this:

Sound* SoundManager::GetSound(const string& name)
{
	fmap<string, Sound*>::const_iterator iter;
	iter = m_mapSound.find(name);
	if (iter == m_mapSound.end())
	{
		racAssert(false);
		return m_pNullSound;
	}
	return iter->second;
}
 

The null sound, is just 100ms silent sound, so the game never closes down even if it's released with missing resources.

0 likes 2 comments

Comments

scott8

Sounds like the audio equivalent of the texture that says “Missing Asset”. The only problem I see is that you may never notice it's missing if it's a minor sound. Would it be better to play an unusual sound, rather than a silent sound?

December 13, 2023 11:12 PM
Ed Welch

The developer will notice that it's missing, because it throws an assert

December 16, 2023 07:00 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement