Clearly, programming details into graphics is a lot more noticeable than programming details into sound rendering, but I was wondering: do modern engines already take care of things like this? I know there's APIs for '3D' audio processing as well... while engines might have processing for graphics, lighting, physics and such, I am wondering what sort of resources are put into audio processing in popular high-end game engines. Just curious, is all.
The answer is yes... and no. In fact, many modern engines do handle sound. Some handle it well, some handle it tolerably, most handle it badly. In the last few years, fortunately, more and more companies have decided to go the middleware route - instead of dealing with sound themselves, they add in a system like
FMOD, and they're good to go. Also, this makes the sound engineers incredibly happy. Sound engineers love FMOD, and hate game engines that don't have FMOD (or some equivalent system - but really, FMOD rules the roost).
What does it mean, to handle sound? Well, look at it this way - how many sounds do you hear at any one time in a game? If you have twenty soldiers on-screen, firing away at you from all directions, that's twenty sounds already. Add to that that some of them are moving, and you hear their footsteps. Add the guys off-screen, whom you can also hear moving and firing. Add the player's sounds. Then add voiceovers. On top of all that, add the background sounds - the aircraft flying past overhead, the wind shuffling through the leaves, the repeated explosions of artillery shells, etc., etc. Finally, you have music. In extreme situations, you're talking several hundred sounds all at once.
How many sounds can the hardware handle at once? I don't remember. It might be 64, possibly 128. In some cases it might still be 32, I don't know. The point is, it's nowhere near the number of the sounds you actually need - the limit is basically what the sound card can process at any one time, because the sound card must then boil these sounds down to something the speakers can handle. This is why in some games you might notice sounds suddenly cutting out in the middle of a big event. In WC Saga, for example, time and again I find that that voiceovers don't play. We had some similar problems in Standoff, where we found that the game would occasionally cut the music off in cutscenes, because there was too much going on, and the sound component had been programmed to discard the longest-playing sounds first (to be fair: the music system is separatate and not affected - the problem arose when we tried playing music as a sound effect rather than as music, for sync purposes). Now, of course, both Saga and Standoff were done on outdated engines - but sound technology does not progress anywhere near as fast as graphics progress, so these problems are very much still there.
Anyway, this is where the sound API comes in. You don't just need to process the volume of the sounds being played, and set them up in 3d space - you need to dynamically mix them together to reduce the strain on the hardware and ensure that you don't wind up dropping sounds. Besides that, there is the aspect of setting the sounds up in the game. If you're working on a level, you will need to set up the sounds in the editor, add them into the game's sound database, and so on. You probably also need to do a dozen other things that I, not being a programmer or a sound engineer, have no idea about. In any case, it does get complicated, and much more so than most people actually think.
By the way, I mentioned that sound engineers love FMOD, and usually don't much like game engines that handle sound without middleware. Why is that? Well, unlike most other specialists working on games, sound engineers tend to be relatively few, often working as freelancers on multiple projects - or, if working internally, will work on a number of different projects for a company. You just don't need that many sound engineers, you don't need them as often, and if an average project spans two years, then there will probably only be two or three months of full-time work for the sound people. What this means is that sound engineers generally want sound to work the same in different games - they don't want to have to re-learn everything every time.