By Richard Clark

Map Layout in WadAuthor
Figure 1: Map Layout in WadAuthor

Sound has always been an important aspect in Doom. However, the sounds in Doom were hard-coded into the engine and so were difficult at times to manipulate. In order to create ambient sounds, for example, the level designer had to hack the executable. ZDoom offers a rich set of sound functions and has enabled the level designer to add or modify sounds using simple text files.

Figure 1 illustrates the map layout for the demo wad, snd.wad. The demo illustrates three types of sounds that can be added and modified: polyobj sounds, door sounds and ambient sounds. Platform sounds can also be modified in the same manner as door sounds. In the illustration, the switch is set up to activate the polyobj. While the polyobj is moving, the sound assigned to the polyobj will be heard. When the polyobj stops, so does the sound.

In ZDoom two lumps define the sounds in the game: sndinfo and sndseq. Sndinfo defines the sounds and assigns "logical" names to the sounds, and also defines any ambient sounds used in the wad. The sounds themselves will need to be added to the wad file using Wintex or some other wad manipulation tool. Sndseq defines how the sounds are to be used by the engine.

The sndinfo lump is simply a text file that can edited with any text editor and then imported into the wad file using WinTex or some other wad manipulation tool. The following is the contents of the sndinfo lump in the demo map.

train	train
drone   drone
winch	winch

Table 1: SNDINFO Lump

In Table 1, first column defines the logical name of the sound. This is simply the "handle" that the level designer wants to use to refer to the sound. The second column is the actual wav file name in the wad itself. In snd.wad there are three wav files: train, drone and winch. To keep it simple, I just named the logical names the same as the actual names.

The last line in Table 1 defines the ambient sound that is is used in the demo wad. ZDoom will support up to 64 ambient sounds. The zdoomref.txt file that comes with the ZDoom package has an excellent explanation of the ambient command, under the heading $AMBIENT.

The sndseq lump is simply a text file that can edited with any text editor and then imported into the wad file using WinTex or some other wad manipulation tool. The following is the contents of the sndseq lump in the demo wad.

	door		0
	playrepeat	train

	door		1
	playrepeat	winch
Table 2: SNDSEQ Lump

In Table 2, the text between the : and end define a particular sound sequence. In the demo wad two different sound sequences are used. One for the poly object and one for the door. Unless you specify a sound for a poly object, it will be silent. Doors will normally use the default door sound; however, you can override that functionality by using either the ACS soundsequence command or a sound sequence thing.

Sound sequences can be assigned to either doors or platforms. Both of the sequences in Table 2 are assigned to doors since the poly object uses the door sound when it moves and the other object in the demo map is of course a door. The train sound is assigned to door 0, while the winch sound is assigned to door 1. The numbers are what is used for the sound things, or to designate a sound for the poly object.

Platforms are defined in the same way, but use the keyword platform instead of door. One thing to note, a sound sequence can be assigned to both a door and a platform, since ZDoom handles each separately. If I wanted to use the winch sound for a platform as well as a door, I would add the line platform 1, under the door 1 designation.

The actual sound command follows the id number. The set of sound commands is quite extensive and allow the level designer complete control of how the sound is played. The sound commands use the logical sound names defined in the sndinfo lump. In the above examples, the train and winch sounds will be played (playrepeat) when each sound sequence is activated. The zdoomref.txt file lists all the commands and the definition of each command.

After the sounds have been defined it is quite easy to add these sounds to a level.

Poly Object Sound
Figure 2: Poly Object Sound

Figure 2 illustrates the poly object start-line setup. The third parameter is the sound number. Since polyobjs use door sounds when they move, this polyobj will use door sound 0, defined in Table 2.

Door Sound Sequence
Figure 3: Door Sound Sequence

As already mentioned, doors will use the standard door sounds. To override this behaviour, a sound sequence thing can be placed in the door sector and when the door is opened, the sound sequence will be played instead of the standard door sound. Figure 3 illustrates the setup for the sound sequence used in the door sector of the demo map. In Table 2, sound sequence 1 was defined as the winch sound, so sound sequence thing 01 is used to replace the standard door sound. When the door is opened, the winch sound will be used instead of the standard door sound.

Ambient Sound
Figure 4: Ambient Sound

Figure 4 illustrates the setup for the ambient sound thing that was assigned in Table 1 with the ambient sound command. Since the ambient sound was defined as a continous point sound, the sound will emanate from the thing location continuously.

Although not intuitive, using the ZDoom sound system is straight forward and can really enhance the gameplay of a map.


ZDoom reference by Randy Heit.