Game Engine analysis (6)

Source: Internet
Author: User
Original Author: Jake Simpson
Translator: Xianghai

Part 1: sound system, audio APIs

Sound System
Voice and music have become increasingly important in games over the past few years due to advances in the types and technologies of games played by people (sound is a real gameplay feature, for example, in thief and other similar games ). Now the four-byte surround system is an affordable and common task in the treasure of game players. Given space sound, noise barrier and blocking, and dynamic music, it is not surprising that many games use these to improve players' emotional reactions. More attention is invested in this field.

Currently, in the PC arena, there is only one sound card available for gaming players-the sound blster live of the PC sound card manufacturer's creative labs! From the old time personal computer sound card manufacturer creative center. over the years, innovative companies have provided their eax sound extensions to DirectX, and they are the founder of the new openal (open audio library. Just like OpenGL is a graphical API, openal is an API of a sound system. Openal is designed to support many features of most general sound cards and provide a software alternative when a specific hardware feature is not available.

To better define openal, I asked Garin Hiebert of the innovative company about its definition:

"Here is a definition of" openal specifications and references:

Openal is a software interface for audio hardware, providing programmers with the ability to produce high-quality multi-channel output. Openal is an important way to generate sound in a simulated 3D environment. It is intended to be cross-platform and easy to use, similar to OpenGL in terms of style and specification. Any programmer familiar with OpenGL will find openal very familiar.

Openal APIs can be easily extended to adapt to plug-in technologies. Innovative companies have added eax support to this set of APIS, allowing programmers to add complex responses, competitions, and barrier effects to their sound environments.

Like jedi knight II: outcast, soldier of fortune II features this new system, along with the eagle world/sound Feature editor. What is Eagle? Before introducing this, let's discuss some other systems and define some sound terms.

Another system is the miles sound system. Miles is a company that produces plug-ins for your code. When making full use of each sound card, it handles all the necessary calls to a specific sound card (such as sound blster live! Series, or the old a3d sound card ). It is very similar to an API front-end, and some additional features are bundled in it. Among other things, Miles allows you to access things like MP3 decompression. It is a good solution, but like anything, it spends money and is an extra layer between your code and hardware. Although it is very useful for rapid sound system manufacturing, and they have been proficient in their own business for a while.

Terms
Let's start obstacle and occlusion. They sound the same, but not so. Blocking basically means that when a sound is playing, the listener has some closed obstacles between them.

For example, on a nolf2 screen shot, you hear the bad guy in the house. You can hear them, but their voice is quite deep and dumb. Obstacles are similar, but the obstacles between you and your voice are not closed. A good example is that there is a pillar between you and the source. You can still hear the echo in the room, but it is different from passing the echo directly to your ears. Of course, this really depends on knowing what is in a straight line between your ears and the source. According to the size of the room, the distance from the sound source to you, and so on, the required processing can become quite time-consuming. We will talk about tracking later-it can be said that it is often the reason for the slow failover rate. The a3d code in quake III does these things. Disabling these options can usually increase the compaction rate. Tribe 2 is another victim of such ills. If you disable the 3D sound option, your seek speed will immediately improve, which makes sense when you consider how big the tribes world is and how far you can see it.

The next step is the characteristics of sound material. Most sound cards allow you to use customizable filters to modify the playing sound. For example, there is a big difference between underwater, in a cloth room, in a long corridor, or in an opera house. It is quite good to be able to change the way you hear your voice based on your environment.

Let's go back to Eagle... This is an editor that allows most first-person shooter game map designers to import their maps to this tool and then construct simplified ry to generate a sound map for the eax code in the actual game engine. The idea is that you don't need a complex geometric form of a real graphic map to simulate the sound environment. You can also assign sound substances to the generated simplified map so that the sound environment can change dynamically. I have witnessed this demonstration on soldier of fortune and Unreal Tournament, which is indeed quite striking. I am really eye-catching on the Fortune and unreal tour and its soldiers as a witness. When you jump into the water and hear all the changes, this is a very immersive experience.

Okay. Let's continue.

For game consoles, your various possibilities are more limited due to static hardware-although the hardware is quite good on PlayStation 2 and Xbox. The limitation I am talking about is just extension, not what it can do. I am not surprised to see that the games on these game consoles soon support Dolby Digital 5.1 output. Xbox, because of its MCP audio processor, can encode any game audio into 5.1, and the game can exploit this feature without special encoding. Dolby brings prologic II to pS2 and works with Factor 5 to implement prologic II for gamecube games. On top of the Xbox, halo, Madden 2002, Project Gotham Racing and other games all have 5.1 Dolby Digital audio content. DTS recently released sdks for PS2 game developers, bringing the DTs audio version that reduces the bit rate for games on this platform.

Location sound-a complex world
Currently, there are few questions about void voice processing. I am talking about putting sound in a real 3D world. It's a great start to have four speakers around you, but it's still just two-dimensional. There are no speakers above and below you, and you don't really get 3D sound. There are some sound modulation filters trying to solve this problem, but there is actually no replacement for the real thing. Of course, most real games are only two-dimensional, so this is still not a big problem.

In fact, one of the most important features of any sound system is to mix sounds together. Based on your location, the location of the sound in the space, and the volume of each sound, once you decide what actually you can hear, you must mix these sounds. Generally, the audio card handles this by itself. This is the first major reason why the audio card exists. However, some external engines decide to use the software for a 'premixed' first '. Until you focus on a little bit of history, this does not really bring much significance.

When the sound card was first introduced, there were many different mixing methods. Some sound cards can be mixed with 8 types of sound, 16 types in some units, 32 types, and so on. If you always want to hear 16 Possible voices, but you don't know whether the sound card can be processed, then you go back to the road of trying and testing-you are mixing your own software. This is actually how the quake III sound system works, but raises a question: "Quake III is for a3d and sound blster live! The sound card world was released, which is more standardized than before. Why? "This is a good question. In fact, almost every line of code in quake III's sound system is the same as that in quake II. And quake I, and even doom. Think about it and go up until the a3d sound card and SB live! Sound Card, the demand for sound systems has not changed for many years. The two speakers are two-dimensional, and the volume decreases with the distance. There is not much change from doom to quake III. In addition, in the gaming industry, if it is not a last resort, ignore it.

Generally, you only use directsound for sound mixing, because it can use sound hardware or rely on software instead, much like DirectX does for 3D display cards. In 90% of voice cases, relying on software mixing doesn't really make much difference in your compaction rate. When directsound is not even a ray of light in the eyes of some enthusiastic coders, the doom engine has already been produced. It has never been updated, because it never really needs to be updated.

Of course, you can use soundblaster live! The sound card has some smart features, such as the ECHO characteristics of a room: A grottoes, an auditorium, a giant cave, and a football gymnasium. And you really should use the mixer provided by hardware. After all, that is the purpose of its existence. One disadvantage of this method is that the program itself often cannot obtain mixed results, because the mixed results are completed within the sound card rather than in the main memory. If you need to see the volume for some reason, you are not lucky.

Music Tracks in games (audio tracks in Games)
We have not talked much about music generation in games. There are two traditional methods, one is simple music. wav files (or equivalent ). It is pre-prepared, ready to run, and at least busy. However, they are expensive in terms of memory and playback time. The second method is to encode the MIDI audio track with a preset sample. This often saves memory, but the disadvantage is that some sound must be mixed together at the same time, so the sound channel will be used up.

Dynamic music is the ability to change your music based on the actions you witness in the game, such as adventure with slow-paced music, fighting with fast-paced music. One difficulty of premade music is to make a co-production, so you can gradually fade from one piece of music to another, which is easier for MIDI audio tracks. Although you often fade out quickly enough, or a piece of music disappears before playing another piece of music, you can be surprised.

Before we leave this topic, by the way, it is worth mentioning that there are some companies dedicated to creating music of specific significance for your game. Fatman (www.fatman.com) is a company like this. Music may be easier to outsource than other things, which is the way they exist.

Finally, the current thing for the game is naturally in the MP3 format, which allows huge 11: 1 sound sample compression. However, it takes only a few CPU times to decompress the package before it is sent to the audio card. When I was working at Rave software, in Star Trek Voyager: elite force, we managed to use MP3 to support three languages on a CD and still leave space for a large number of images. Basically, MP3 is only used for voice of non-player players (NPC). Because all the audio effects of the game, MP3 streams and dynamic decompression exceed the hardware processing capabilities, this is certainly possible in the future. Relatively new formats, such as AAC from Dolby and WMA from Microsoft, provide equal or higher audio quality (in fact half of the bit rate) with a compression ratio of nearly two times MP3 ), it may be applied to future games.

The above is the content of this Chapter. The following is the development of the network and connected game environment.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.