Many games on the internet have sound. What is the key feature to always remember when you have sound?
The ability to turn off that infernal music!
Now those games on the internet that may be made using HTML5 assets probably use the audio tags for their music. If you were to look up the audio tags in Bing the default things you see will likely include the ‘controls’ attribute in the tag. The ‘controls’ attribute creates a bar that includes volume controls. It also includes the ability to skip around the audio and to pause it.
Now perhaps you don’t want to use the built-in controls feature since you don’t want to give them those later abilities? Why not? If your game could get messed up by player’s being able to skip around the sound – and would not by them muting it – then that seems like you’re taking a slightly risky and shortsighted approach to your coding. If I was you, I’d worry about it breaking on me.
By putting your sound controls on your game canvas you force for one of either two things: it becomes part of you default UI and contributes to cluttering that, or you require players to go onto a separate menu and generally be a bit of a irritation. The third possibly is binding it to a key on the keyboard, this includes its own handful of complications; none of them huge.
I suppose a key thing I’ve yet to mention here is when you have multiple audio tags for different types of sound types (e.. music versus enemy sound effects). However, unless you have very many it wouldn’t be a great difficulty for your player to mute everything as they want. In addition to this it will again give the player a greater degree of customisation assuming that everything is properly labeled.
Using the raw audio default controls could be considered as pulling back the curtain, or dispelling the illusion. Its allows people to see what’s going on underneath the hood. This is something that’s going out of style in the real world. Even with literal car hoods. However, that trend in work and domesticity is only a reason to go the opposite way when it comes to recreation. If the world is full of near-magic opaqueness then that’s a greater reason for us to be distinctly transparent.
This post was originally going to be about signalling. I’ll deal with that question more widely, tomorrow.