Here's a quick tutorial on how to make the player have different footstep sounds per surface.
Skim down a few posts if you want to know how to add surface-specific weapon sounds and surface-specific weapon visual effects.
===
First, you'll need to create your own sounds. Searching around on the web will save you some time if you're not sure how to go about creating your own effects because a lot of sites offer free/royalty free sounds that you can use. Just make sure to read all of the disclaimers and usage agreements to make sure you don't use something illegally.
Next, create a directory structure like so:
At the same level as the "base" directory, create a directory called "nps."
This will be our mod directory and will make sure that we don't overwrite any of the vanilla game's content. In other words, ALL files we're about to create and/or alter will be placed into a subdirectory of "nps" and not "base".
In the "nps" directory, create the following subdirectories, so you have this structure:
Code:
your-doom3-dir/nps/def
your-doom3-dir/nps/materials
your-doom3-dir/nps/sound
your-doom3-dir/nps/textures
If you don't want to use your own textures, you can use vanilla ones... to change the player sounds as they walk over a surface, all that's required is that you change the material definition, not the texture/image files themselves. However, in the case of this example, I'm using the content from the third test-build of the D3CDIT project, so I happen to have custom textures.
Okay, so let's say I have several new sounds I want to use. First, I make sure all of the sounds are in a valid format:
iddevnet wrote:
Valid sound files are 1 or 2 channel, 16 bit OGG or WAV files at 11025, 22050 or 44100 Hz
Next, I place the following new footstep sounds into the mod directory using this structure:
Code:
sound/player/footsteps/concrete_footstep1.wav
sound/player/footsteps/concrete_footstep2.wav
sound/player/footsteps/concrete_footstep3.wav
sound/player/footsteps/concrete_footstep4.wav
sound/player/footsteps/concrete_footstep5.wav
sound/player/footsteps/concrete_footstep6.wav
sound/player/footsteps/concrete_footstep7.wav
sound/player/footsteps/concrete_footstep8.wav
sound/player/footsteps/concrete_footstep9.wav
sound/player/footsteps/gravel_footstep1.wav
sound/player/footsteps/gravel_footstep2.wav
sound/player/footsteps/gravel_footstep3.wav
sound/player/footsteps/gravel_footstep4.wav
sound/player/footsteps/gravel_footstep5.wav
sound/player/footsteps/gravel_footstep6.wav
sound/player/footsteps/rug_footstep1.wav
sound/player/footsteps/rug_footstep2.wav
sound/player/footsteps/rug_footstep3.wav
sound/player/footsteps/rug_footstep4.wav
sound/player/footsteps/water_footstep1.wav
sound/player/footsteps/water_footstep2.wav
sound/player/footsteps/water_footstep3.wav
sound/player/footsteps/water_footstep4.wav
sound/player/footsteps/water_footstep5.wav
sound/player/footsteps/water_footstep6.wav
sound/player/footsteps/wood_footstep1.wav
sound/player/footsteps/wood_footstep2.wav
sound/player/footsteps/wood_footstep3.wav
sound/player/footsteps/wood_footstep4.wav
sound/player/footsteps/wood_footstep5.wav
sound/player/footsteps/wood_footstep6.wav
sound/player/footsteps/wood_footstep7.wav
With the sound files in place, I can then create a sound shader file to handle the changes:
Copy the vanilla player.sndshd file into the nps/sound directory. This makes sure that the changes we make won't affect the vanilla game, but will only show up when we run our mod.
Open the new player.sndshd file and add the following code at the top of the file:
Code:
//
// New player sounds
//
// Wood footsteps
// Gravel/dirt footsteps
// Concrete/road footsteps
// Water/liquid footsteps
// water/liquid
player_footstep_liquid {
minDistance 1
maxDistance 15
volume 0
no_dups
sound/player/footsteps/water_footstep1.wav
sound/player/footsteps/water_footstep2.wav
sound/player/footsteps/water_footstep3.wav
sound/player/footsteps/water_footstep4.wav
sound/player/footsteps/water_footstep5.wav
sound/player/footsteps/water_footstep6.wav
}
player_footstep_wood {
minDistance 1
maxDistance 15
volume 0
no_dups
sound/player/footsteps/wood_footstep1.wav
sound/player/footsteps/wood_footstep2.wav
sound/player/footsteps/wood_footstep3.wav
sound/player/footsteps/wood_footstep4.wav
sound/player/footsteps/wood_footstep5.wav
sound/player/footsteps/wood_footstep6.wav
sound/player/footsteps/wood_footstep7.wav
}
// rug sounds
player_footstep_surftype10 {
minDistance 1
maxDistance 15
volume 0
no_dups
sound/player/footsteps/rug_footstep1.wav
sound/player/footsteps/rug_footstep2.wav
sound/player/footsteps/rug_footstep3.wav
sound/player/footsteps/rug_footstep4.wav
}
// dirt/gravel sounds
player_footstep_surftype11 {
minDistance 1
maxDistance 15
volume -10
no_dups
sound/player/footsteps/gravel_footstep1.wav
sound/player/footsteps/gravel_footstep2.wav
sound/player/footsteps/gravel_footstep3.wav
sound/player/footsteps/gravel_footstep4.wav
sound/player/footsteps/gravel_footstep5.wav
sound/player/footsteps/gravel_footstep6.wav
}
// concrete/road
player_footstep_surftype12 {
minDistance 1
maxDistance 15
volume 0
no_dups
sound/player/footsteps/concrete_footstep1.wav
sound/player/footsteps/concrete_footstep2.wav
sound/player/footsteps/concrete_footstep3.wav
sound/player/footsteps/concrete_footstep4.wav
sound/player/footsteps/concrete_footstep5.wav
sound/player/footsteps/concrete_footstep6.wav
sound/player/footsteps/concrete_footstep7.wav
sound/player/footsteps/concrete_footstep8.wav
sound/player/footsteps/concrete_footstep9.wav
}
A quick explanation of the sound shader file:
Whenever you have multiple source files listed in one sound shader, Doom3 will randomly choose a file from the list and play it. So, the more source files you have listed in a shader, the greater the variation of sounds. I prefer to have about 6 footstep sounds per surface... it gives enough variation that you don't notice any sort of annoying repitition. Of course, you can increase and decrease the number of sources according to your own needs.
volume Volume values are in decibles, so 0 is still pretty loud. Think of a home stereo with a reciever... most of the time, you listen to music at a negative dB volume... unless you want to fry your speakers. The same concept applies to Doom3. So, if you want sounds to be softer, use negative volume values, as was done with the gravel sounds shown above.
min/maxDistanceThis is the range to and from which the sound should be audible. For example, you can take a loud rumble and turn it into a low hum by reducing the volume... but if you don't change the min/maxDistance values, you'll only hear the sound if you're in the vicinity of the sound's origin (usually a speaker). You can increase the maxDistance value so that the hum will be audible at larger distances from the speaker. In the case of changing the player sounds, though, there's no need to alter the defaults of 1 and 15, because we'll always be in the vicinity of the sound's origin because... well... we
are the origin.
Here's the quote from iddevnet:
Quote:
minDistance / maxDistance sets the radius where the sound fades out. The sound is at maximum volume inside 'minDistance' radius, and it completely silent after 'maxDistance' radius.
no_dupsno_dups is especially handy for footsteps and it means just what it says: the same source sound won't be played two times in a row.
Okay, with those sound shader options out of the way, let's talk about the shader names themselves:
player_footstep_liquid
player_footstep_wood
player_footstep_surftype10
player_footstep_surftype11
player_footstep_surftype12
Out of the box, there are a few other named surface types not listed here, as well as a few more custom/empty ones... so here's the full list:
Code:
metal
stone
flesh
wood
cardboard
liquid
glass
plastic
ricochet
surftype10
surftype11
surftype12
surftype13
surftype14
surftype15
That means that you have the ability to create custom sounds for up to 15 surfaces without needing to touch the game code... not too shabby.
Since concrete, gravel and rug sounds weren't listed as "named" types, I used custom surftypes10-12.
So now that you have your player.sndshd defined, it's time to edit the player.def file and add the new sounds to the player so Doom3 knows how to link the sounds with your movement:
Copy the vanilla player.def file into your nps/def directory and open it.
Scroll through the file until you see this line:
Code:
"snd_footstep" "player_sounds_footstep"
Leave that line alone, but add these just below it:
Code:
// added custom footstep sounds
"snd_footstep_wood" "player_footstep_wood"
"snd_footstep_liquid" "player_footstep_liquid"
"snd_footstep_surftype10" "player_footstep_surftype10"
"snd_footstep_surftype11" "player_footstep_surftype11"
"snd_footstep_surftype12" "player_footstep_surftype12"
// end add
Note how the "snd_footstep_*" matches with the appropriate shader name from the player.sndshd file we just created.
With that complete, we only have one more thing to do... edit some materials so that they reference the surface types.
Here are examples of a materials that use the wood, rug and dirt/gravel surface sounds. You can create the others yourself if you like. Also, I'm assuming you know how to create or use custom textures and their material files. If not, you can just add the top line (the surftype) to any vanilla shader material and it will work. Copy and paste these examples into a nps.mtr file and place the file in your npc/materials directory:
Code:
textures/euro/block3/embassy/in/rug1
{
surftype10 // rug
qer_editorimage textures/euro/block3/embassy/in/decoration/object006_d.tga
diffusemap textures/euro/block3/embassy/in/decoration/object006_d.tga
specularmap textures/euro/block3/danteuk/gray/gray_s.tga
bumpmap textures/euro/block3/danteuk/gray/gray_local.tga
}
textures/euro/id_stock/textures/hell/boards1
{
wood // wood
qer_editorimage textures/hell/boards1.tga
{
blend bumpmap
map addnormals (textures/hell/boards1_local.tga, heightmap (textures/hell/boards1_bmp.tga,4) )
}
diffusemap textures/hell/boards1.tga
specularmap textures/hell/boards1_s.tga
}
textures/euro/id_stock/textures/rock/dirt03
{
surftype11 // dirt/gravel // dirt/gravel
qer_editorimage textures/rock/dirt03.tga
diffusemap textures/rock/dirt03.tga
bumpmap addnormals( textures/hell/dirt02_local.tga, heightmap( textures/hell/dirt02_h.tga, 8 ) )
specularmap textures/rock/dirt03_s.tga
}
Note that the last two examples are the vanilla game's materials with the only change being the addition of the surftype value. The first example uses a custom material with custom textures.
All that's left now is to "reloadSounds", "reloadDecls" and/or "reloadEngine" in the console (or just restart Doom3) and you're ready to go with custom player footstep sounds.
Enjoy!
Goliath