goliathvt@Posted: Mon Jan 24, 2005 3:33 pm :
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/maxDistance

This 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_dups

no_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



Cody64@Posted: Mon Jan 24, 2005 6:40 pm :
I've been working with this sort of stuff for a while in my mod (Doom Chronicles), and the only thing that I have not been able to figure out is how to give different impact particles to different surfaces... I have tried using (example) "model_smokespark_metal", and use a different particle for it, but the game still uses the default "smokespark" for that weapon :(

I don't know if you have looked into this, but if you have and can give me any usefull tips, I'd be greatfull :)



goliathvt@Posted: Mon Jan 24, 2005 8:45 pm :
Okay, I'm going to run through adding surface-specific sounds and surface-specific "splats" (impact particles) for weapons.

Sounds

Let's make pistol give off a wood "knock" sound whenever wood is shot and a gravel "shuffle" sound whenever you shoot a gravel surface. Open up the weapon_pistol.def file.

First, note that everything in:

Code:
entityDef   damage_bullet_pistol { ... }


ONLY applies to things that can get hurt... like enemies and breakable crap. So that's why the only sound reference is "snd_flesh".... You can add more if, say, you wanted to use S@tanic's "breakble wood" stuff and have a specific sound fire whenever you "hurt" some wood.

Here's how:

Code:
// from weapon_pistol.def
... SNIP ...

   "smoke_wound_flesh"   "burstysquirt.prt"
   "mtr_wound_flesh"   "textures/decals/hurt02"
   "mtr_wound_metal"   "textures/decals/hurtmetal"
   "mtr_wound_ricochet"   "textures/decals/hurtmetal"
   "mtr_splat_flesh"   "textures/decals/dsplat2"
   "mtr_splat_flesh2"   "textures/decals/dsplat5"
   "mtr_splat_flesh3"   "textures/decals/dsplat7"
   "mtr_splat_flesh4"   "textures/decals/dsplat11"
   // the flesh impact is used in the damage so players hear it on their body
   // the other impacts are played on detonation
   "snd_flesh"         "bullet_impact_flesh"
... SNIP ...


Note again, that the ONLY thing defined here is the "flesh" sound. Therefore, you have to add the new stuff, like so:

Code:
// from weapon_pistol.def
... SNIP ...

   "smoke_wound_flesh"   "burstysquirt.prt"
   "mtr_wound_flesh"   "textures/decals/hurt02"
   "mtr_wound_metal"   "textures/decals/hurtmetal"
   "mtr_wound_ricochet"   "textures/decals/hurtmetal"
   "mtr_splat_flesh"   "textures/decals/dsplat2"
   "mtr_splat_flesh2"   "textures/decals/dsplat5"
   "mtr_splat_flesh3"   "textures/decals/dsplat7"
   "mtr_splat_flesh4"   "textures/decals/dsplat11"
   // the flesh impact is used in the damage so players hear it on their body
   // the other impacts are played on detonation
   "snd_flesh"         "bullet_impact_flesh"
   "snd_wood"         "bullet_impact_wood"
   "snd_surftype12"      "bullet_impact_surftype12"
... SNIP ...


surftype12 is a gravel surface. Now, if, for some reason you made "hurtable" wood and/or gravel/concrete, those sounds would be played on impact.

Now, for things that can't be hurt... like most surfaces in a map:

Scroll down the file further and look for:

Code:
   // played on collision with non-damagable entities
   "snd_plastic"            "bullet_impact_plastic"
   "snd_cardboard"            "bullet_impact_cardboard"
   "snd_flesh"               "bullet_impact_flesh"
   "snd_metal"               "bullet_impact_metal"
   "snd_stone"               "bullet_impact_stone"
   "snd_glass"               "bullet_impact_glass"
   "snd_liquid"            "bullet_impact_liquid"
   "snd_ricochet"            "bullet_ricochet"
   //"snd_impact"            "bullet_impact_metal"


And add:

Code:
   "snd_wood"               "bullet_impact_wood"
   "snd_surftype12"            "bullet_impact_surftype12"


This means that if you shoot a character OR a non-damageable surface that has a surftype of wood or surftype12, doom3 will play those sounds on impact.

Next, you need to make a sound shader to handle those references:

Here's part of my "projectile_impacts.sndshd" that I'm using for the D3CDIT project (this wasn't included in the build, by the way):

Code:
bullet_impact_wood {
   minDistance   1
   maxDistance   15
   volume      -10
   
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact1.wav
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact2.wav
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact3.wav
}

bullet_impact_surftype12 {
   minDistance   1
   maxDistance   15
   volume      0

   sound/euro/shared/goliathvt/projectile_impacts/gravel/gravel_impact1.wav
   sound/euro/shared/goliathvt/projectile_impacts/gravel/gravel_impact2.wav

}


I assume that you already have the surftype listed in the various materials you're trying to use (it's the same surftype reference for player footsteps...), so follow my tutorial for info on adding that to your .mtr files.

Note that when you test this, you may need to tone down the sound of the gun if you're having trouble hearing the effect... but it does work.

Visuals

Okay, with the sound effects for specific surfaces covered, let's move on to now to change the visual impact of the pistol:

Again, open up the weapon_pistol.def file. I'm going to skip the "hurtable" stuff and just focus on things that can't get killed (most game surfaces). For that, we need to edit this section:

Code:
entityDef projectile_bullet_pistol { ... }


Scroll down until you see these lines:

Code:
   "mtr_detonate"            "textures/decals/bulleth02"
   "mtr_detonate_glass"      "textures/decals/testbulletglass1"


Right now, the ONLY detonation effects for the pistol are the default "mtr_detonate" and a glass detonation effect.

So, let's add:

Code:
   "mtr_detonate_surftype12"   "textures/decals/duffysplat"
   "mtr_detonate_wood"   "textures/decals/duffysplat"


For now, just use the blood splat as the material effect for testing... you can create your own decal later on.

This will replace the black bullet mark that fades away over time with a blood splat that will fade away....

I think that should do it... so basically, you have full control over the sound and visual effects that get used for each surface you define.

Here's a screenshot. The wall uses the default detonation...

Code:
"mtr_detonate"            "textures/decals/bulleth02"


And the floor (wood) uses the blood splat.

Code:
"mtr_detonate_wood"      "textures/decals/duffysplat"


Image

Oh, and one last thing... you can load a particle effect (in addition to a decal "splat") when the projectile detonates by modifying the entityDef projectile_bullet_pistol section:

Code:
   //"model_smokespark"         "bulletsmokeandspark.prt"
   // comment the above out so the following line works:
   "model_detonate"         "plasmatrail"
   "model_ricochet"         "bulletricochet.prt"


Note that these don't seem to be surface-specific...

Image

The possible values are model_detonate, model__ricochet, model_smokespark, model_burn, model_tracer, and model__dissolve.
Let me know if you have any problems or further questions.

Goliath



Cody64@Posted: Tue Jan 25, 2005 2:26 am :
Well, its different particles for different surfaces that I am trying to do :( I have tried "model_detonate_metal" but it still just plays the default particle :( It would be odd if there is no way of achieving that without modifying the sdk :? I'm still looking into it, and have been trying a number of different things. If I find a way to do it, I will post it :)

BTW, Thanks for the help :)



Grid@Posted: Tue Jan 25, 2005 6:55 am :
There are no specific detonate fx. You can only use "model_detonate".

The way it works is to look for a "model_detonate" in the projectile def. If it fails to find that fx, or if the string is empty, it then searches the following:

If the surface is metal, stone, or none, it uses "model_smokespark". If the surface is a richochet, it uses "model_ricochet". Otherwise it uses "model_smoke".

So if that doesn't suit your needs, the only way I can see of doing what you want without modifying the SDK is if you can somehow set the console variable "g_testParticle" to "1" and "g_testParticleName" to the name of the fx you want to use, since that will override everything above. I don't know if scripting will handle that, though. It's probably easier in the end to modify the SDK source code.



Cody64@Posted: Tue Jan 25, 2005 8:10 pm :
hmmm...... Thanks for the usefull info..... I'll see what I can do. But because of many other things I am working on, I might have to wait for the second chapter of my mod b4 I put in the type of particle system that I want :(



geppy@Posted: Sat Jan 29, 2005 11:51 pm :
How can you add more (named) sound surfaces? What in the SDK would you need to mess with?



Grid@Posted: Sun Jan 30, 2005 8:59 am :
As far as I know the material parser is part of the engine rather than the SDK. Therefore, it doesn't seem possible to reference a new surface type by name in a material file and have the parser recognise it.

The only solution I know about is to add your own text processor that generates the mtr files, then you can translate your own named surface into the D3 generic ones.



KC Clark@Posted: Fri Mar 21, 2008 5:48 am :
Sorry to resurect this old thread but I was wondering, does the new nps folder need to stay outside of the base folder? If I put it in my base will it affect anything?



Skul@Posted: Fri Mar 21, 2008 3:27 pm :
If I'm reading the tutorial correctly, I think doing that will overwrite the game's original sounds. Putting it on the same level as base will make it a mod folder so that any modified/new definitions, GUIs, etc. won't affect the original game's.



wal@Posted: Fri Mar 21, 2008 7:20 pm :
Skul wrote:
If I'm reading the tutorial correctly, I think doing that will overwrite the game's original sounds. Putting it on the same level as base will make it a mod folder so that any modified/new definitions, GUIs, etc. won't affect the original game's.

Exactly, and if you turn your mod folders into a pk4 and name it either alphabetically sooner or a higher number pak then any duplicate files in the mod folder will take priority, so it's much easier and better to leave base alone. You can mimic the file structure in base to keep things simple.



Tom Yum 72@Posted: Mon Nov 22, 2010 7:47 pm :
Thats an old thread here...but its about footsteps.
I really hate the footstep sound in Doom 3.
Is there a way to completly remove the footstep sound?
Or at least a good footstep sound mod someone know?

I,m glad if someone could help. Thank you



goliathvt@Posted: Mon Jan 24, 2005 2:33 pm :
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/maxDistance

This 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_dups

no_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



Cody64@Posted: Mon Jan 24, 2005 5:40 pm :
I've been working with this sort of stuff for a while in my mod (Doom Chronicles), and the only thing that I have not been able to figure out is how to give different impact particles to different surfaces... I have tried using (example) "model_smokespark_metal", and use a different particle for it, but the game still uses the default "smokespark" for that weapon :(

I don't know if you have looked into this, but if you have and can give me any usefull tips, I'd be greatfull :)



goliathvt@Posted: Mon Jan 24, 2005 7:45 pm :
Okay, I'm going to run through adding surface-specific sounds and surface-specific "splats" (impact particles) for weapons.

Sounds

Let's make pistol give off a wood "knock" sound whenever wood is shot and a gravel "shuffle" sound whenever you shoot a gravel surface. Open up the weapon_pistol.def file.

First, note that everything in:

Code:
entityDef   damage_bullet_pistol { ... }


ONLY applies to things that can get hurt... like enemies and breakable crap. So that's why the only sound reference is "snd_flesh".... You can add more if, say, you wanted to use S@tanic's "breakble wood" stuff and have a specific sound fire whenever you "hurt" some wood.

Here's how:

Code:
// from weapon_pistol.def
... SNIP ...

   "smoke_wound_flesh"   "burstysquirt.prt"
   "mtr_wound_flesh"   "textures/decals/hurt02"
   "mtr_wound_metal"   "textures/decals/hurtmetal"
   "mtr_wound_ricochet"   "textures/decals/hurtmetal"
   "mtr_splat_flesh"   "textures/decals/dsplat2"
   "mtr_splat_flesh2"   "textures/decals/dsplat5"
   "mtr_splat_flesh3"   "textures/decals/dsplat7"
   "mtr_splat_flesh4"   "textures/decals/dsplat11"
   // the flesh impact is used in the damage so players hear it on their body
   // the other impacts are played on detonation
   "snd_flesh"         "bullet_impact_flesh"
... SNIP ...


Note again, that the ONLY thing defined here is the "flesh" sound. Therefore, you have to add the new stuff, like so:

Code:
// from weapon_pistol.def
... SNIP ...

   "smoke_wound_flesh"   "burstysquirt.prt"
   "mtr_wound_flesh"   "textures/decals/hurt02"
   "mtr_wound_metal"   "textures/decals/hurtmetal"
   "mtr_wound_ricochet"   "textures/decals/hurtmetal"
   "mtr_splat_flesh"   "textures/decals/dsplat2"
   "mtr_splat_flesh2"   "textures/decals/dsplat5"
   "mtr_splat_flesh3"   "textures/decals/dsplat7"
   "mtr_splat_flesh4"   "textures/decals/dsplat11"
   // the flesh impact is used in the damage so players hear it on their body
   // the other impacts are played on detonation
   "snd_flesh"         "bullet_impact_flesh"
   "snd_wood"         "bullet_impact_wood"
   "snd_surftype12"      "bullet_impact_surftype12"
... SNIP ...


surftype12 is a gravel surface. Now, if, for some reason you made "hurtable" wood and/or gravel/concrete, those sounds would be played on impact.

Now, for things that can't be hurt... like most surfaces in a map:

Scroll down the file further and look for:

Code:
   // played on collision with non-damagable entities
   "snd_plastic"            "bullet_impact_plastic"
   "snd_cardboard"            "bullet_impact_cardboard"
   "snd_flesh"               "bullet_impact_flesh"
   "snd_metal"               "bullet_impact_metal"
   "snd_stone"               "bullet_impact_stone"
   "snd_glass"               "bullet_impact_glass"
   "snd_liquid"            "bullet_impact_liquid"
   "snd_ricochet"            "bullet_ricochet"
   //"snd_impact"            "bullet_impact_metal"


And add:

Code:
   "snd_wood"               "bullet_impact_wood"
   "snd_surftype12"            "bullet_impact_surftype12"


This means that if you shoot a character OR a non-damageable surface that has a surftype of wood or surftype12, doom3 will play those sounds on impact.

Next, you need to make a sound shader to handle those references:

Here's part of my "projectile_impacts.sndshd" that I'm using for the D3CDIT project (this wasn't included in the build, by the way):

Code:
bullet_impact_wood {
   minDistance   1
   maxDistance   15
   volume      -10
   
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact1.wav
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact2.wav
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact3.wav
}

bullet_impact_surftype12 {
   minDistance   1
   maxDistance   15
   volume      0

   sound/euro/shared/goliathvt/projectile_impacts/gravel/gravel_impact1.wav
   sound/euro/shared/goliathvt/projectile_impacts/gravel/gravel_impact2.wav

}


I assume that you already have the surftype listed in the various materials you're trying to use (it's the same surftype reference for player footsteps...), so follow my tutorial for info on adding that to your .mtr files.

Note that when you test this, you may need to tone down the sound of the gun if you're having trouble hearing the effect... but it does work.

Visuals

Okay, with the sound effects for specific surfaces covered, let's move on to now to change the visual impact of the pistol:

Again, open up the weapon_pistol.def file. I'm going to skip the "hurtable" stuff and just focus on things that can't get killed (most game surfaces). For that, we need to edit this section:

Code:
entityDef projectile_bullet_pistol { ... }


Scroll down until you see these lines:

Code:
   "mtr_detonate"            "textures/decals/bulleth02"
   "mtr_detonate_glass"      "textures/decals/testbulletglass1"


Right now, the ONLY detonation effects for the pistol are the default "mtr_detonate" and a glass detonation effect.

So, let's add:

Code:
   "mtr_detonate_surftype12"   "textures/decals/duffysplat"
   "mtr_detonate_wood"   "textures/decals/duffysplat"


For now, just use the blood splat as the material effect for testing... you can create your own decal later on.

This will replace the black bullet mark that fades away over time with a blood splat that will fade away....

I think that should do it... so basically, you have full control over the sound and visual effects that get used for each surface you define.

Here's a screenshot. The wall uses the default detonation...

Code:
"mtr_detonate"            "textures/decals/bulleth02"


And the floor (wood) uses the blood splat.

Code:
"mtr_detonate_wood"      "textures/decals/duffysplat"


Image

Oh, and one last thing... you can load a particle effect (in addition to a decal "splat") when the projectile detonates by modifying the entityDef projectile_bullet_pistol section:

Code:
   //"model_smokespark"         "bulletsmokeandspark.prt"
   // comment the above out so the following line works:
   "model_detonate"         "plasmatrail"
   "model_ricochet"         "bulletricochet.prt"


Note that these don't seem to be surface-specific...

Image

The possible values are model_detonate, model__ricochet, model_smokespark, model_burn, model_tracer, and model__dissolve.
Let me know if you have any problems or further questions.

Goliath



Cody64@Posted: Tue Jan 25, 2005 1:26 am :
Well, its different particles for different surfaces that I am trying to do :( I have tried "model_detonate_metal" but it still just plays the default particle :( It would be odd if there is no way of achieving that without modifying the sdk :? I'm still looking into it, and have been trying a number of different things. If I find a way to do it, I will post it :)

BTW, Thanks for the help :)



Grid@Posted: Tue Jan 25, 2005 5:55 am :
There are no specific detonate fx. You can only use "model_detonate".

The way it works is to look for a "model_detonate" in the projectile def. If it fails to find that fx, or if the string is empty, it then searches the following:

If the surface is metal, stone, or none, it uses "model_smokespark". If the surface is a richochet, it uses "model_ricochet". Otherwise it uses "model_smoke".

So if that doesn't suit your needs, the only way I can see of doing what you want without modifying the SDK is if you can somehow set the console variable "g_testParticle" to "1" and "g_testParticleName" to the name of the fx you want to use, since that will override everything above. I don't know if scripting will handle that, though. It's probably easier in the end to modify the SDK source code.



Cody64@Posted: Tue Jan 25, 2005 7:10 pm :
hmmm...... Thanks for the usefull info..... I'll see what I can do. But because of many other things I am working on, I might have to wait for the second chapter of my mod b4 I put in the type of particle system that I want :(



geppy@Posted: Sat Jan 29, 2005 10:51 pm :
How can you add more (named) sound surfaces? What in the SDK would you need to mess with?



Grid@Posted: Sun Jan 30, 2005 7:59 am :
As far as I know the material parser is part of the engine rather than the SDK. Therefore, it doesn't seem possible to reference a new surface type by name in a material file and have the parser recognise it.

The only solution I know about is to add your own text processor that generates the mtr files, then you can translate your own named surface into the D3 generic ones.



KC Clark@Posted: Fri Mar 21, 2008 4:48 am :
Sorry to resurect this old thread but I was wondering, does the new nps folder need to stay outside of the base folder? If I put it in my base will it affect anything?



Skul@Posted: Fri Mar 21, 2008 2:27 pm :
If I'm reading the tutorial correctly, I think doing that will overwrite the game's original sounds. Putting it on the same level as base will make it a mod folder so that any modified/new definitions, GUIs, etc. won't affect the original game's.



wal@Posted: Fri Mar 21, 2008 6:20 pm :
Skul wrote:
If I'm reading the tutorial correctly, I think doing that will overwrite the game's original sounds. Putting it on the same level as base will make it a mod folder so that any modified/new definitions, GUIs, etc. won't affect the original game's.

Exactly, and if you turn your mod folders into a pk4 and name it either alphabetically sooner or a higher number pak then any duplicate files in the mod folder will take priority, so it's much easier and better to leave base alone. You can mimic the file structure in base to keep things simple.



goliathvt@Posted: Mon Jan 24, 2005 2:33 pm :
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/maxDistance

This 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_dups

no_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



Cody64@Posted: Mon Jan 24, 2005 5:40 pm :
I've been working with this sort of stuff for a while in my mod (Doom Chronicles), and the only thing that I have not been able to figure out is how to give different impact particles to different surfaces... I have tried using (example) "model_smokespark_metal", and use a different particle for it, but the game still uses the default "smokespark" for that weapon :(

I don't know if you have looked into this, but if you have and can give me any usefull tips, I'd be greatfull :)



goliathvt@Posted: Mon Jan 24, 2005 7:45 pm :
Okay, I'm going to run through adding surface-specific sounds and surface-specific "splats" (impact particles) for weapons.

Sounds

Let's make pistol give off a wood "knock" sound whenever wood is shot and a gravel "shuffle" sound whenever you shoot a gravel surface. Open up the weapon_pistol.def file.

First, note that everything in:

Code:
entityDef   damage_bullet_pistol { ... }


ONLY applies to things that can get hurt... like enemies and breakable crap. So that's why the only sound reference is "snd_flesh".... You can add more if, say, you wanted to use S@tanic's "breakble wood" stuff and have a specific sound fire whenever you "hurt" some wood.

Here's how:

Code:
// from weapon_pistol.def
... SNIP ...

   "smoke_wound_flesh"   "burstysquirt.prt"
   "mtr_wound_flesh"   "textures/decals/hurt02"
   "mtr_wound_metal"   "textures/decals/hurtmetal"
   "mtr_wound_ricochet"   "textures/decals/hurtmetal"
   "mtr_splat_flesh"   "textures/decals/dsplat2"
   "mtr_splat_flesh2"   "textures/decals/dsplat5"
   "mtr_splat_flesh3"   "textures/decals/dsplat7"
   "mtr_splat_flesh4"   "textures/decals/dsplat11"
   // the flesh impact is used in the damage so players hear it on their body
   // the other impacts are played on detonation
   "snd_flesh"         "bullet_impact_flesh"
... SNIP ...


Note again, that the ONLY thing defined here is the "flesh" sound. Therefore, you have to add the new stuff, like so:

Code:
// from weapon_pistol.def
... SNIP ...

   "smoke_wound_flesh"   "burstysquirt.prt"
   "mtr_wound_flesh"   "textures/decals/hurt02"
   "mtr_wound_metal"   "textures/decals/hurtmetal"
   "mtr_wound_ricochet"   "textures/decals/hurtmetal"
   "mtr_splat_flesh"   "textures/decals/dsplat2"
   "mtr_splat_flesh2"   "textures/decals/dsplat5"
   "mtr_splat_flesh3"   "textures/decals/dsplat7"
   "mtr_splat_flesh4"   "textures/decals/dsplat11"
   // the flesh impact is used in the damage so players hear it on their body
   // the other impacts are played on detonation
   "snd_flesh"         "bullet_impact_flesh"
   "snd_wood"         "bullet_impact_wood"
   "snd_surftype12"      "bullet_impact_surftype12"
... SNIP ...


surftype12 is a gravel surface. Now, if, for some reason you made "hurtable" wood and/or gravel/concrete, those sounds would be played on impact.

Now, for things that can't be hurt... like most surfaces in a map:

Scroll down the file further and look for:

Code:
   // played on collision with non-damagable entities
   "snd_plastic"            "bullet_impact_plastic"
   "snd_cardboard"            "bullet_impact_cardboard"
   "snd_flesh"               "bullet_impact_flesh"
   "snd_metal"               "bullet_impact_metal"
   "snd_stone"               "bullet_impact_stone"
   "snd_glass"               "bullet_impact_glass"
   "snd_liquid"            "bullet_impact_liquid"
   "snd_ricochet"            "bullet_ricochet"
   //"snd_impact"            "bullet_impact_metal"


And add:

Code:
   "snd_wood"               "bullet_impact_wood"
   "snd_surftype12"            "bullet_impact_surftype12"


This means that if you shoot a character OR a non-damageable surface that has a surftype of wood or surftype12, doom3 will play those sounds on impact.

Next, you need to make a sound shader to handle those references:

Here's part of my "projectile_impacts.sndshd" that I'm using for the D3CDIT project (this wasn't included in the build, by the way):

Code:
bullet_impact_wood {
   minDistance   1
   maxDistance   15
   volume      -10
   
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact1.wav
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact2.wav
   sound/euro/shared/goliathvt/projectile_impacts/wood/wood_impact3.wav
}

bullet_impact_surftype12 {
   minDistance   1
   maxDistance   15
   volume      0

   sound/euro/shared/goliathvt/projectile_impacts/gravel/gravel_impact1.wav
   sound/euro/shared/goliathvt/projectile_impacts/gravel/gravel_impact2.wav

}


I assume that you already have the surftype listed in the various materials you're trying to use (it's the same surftype reference for player footsteps...), so follow my tutorial for info on adding that to your .mtr files.

Note that when you test this, you may need to tone down the sound of the gun if you're having trouble hearing the effect... but it does work.

Visuals

Okay, with the sound effects for specific surfaces covered, let's move on to now to change the visual impact of the pistol:

Again, open up the weapon_pistol.def file. I'm going to skip the "hurtable" stuff and just focus on things that can't get killed (most game surfaces). For that, we need to edit this section:

Code:
entityDef projectile_bullet_pistol { ... }


Scroll down until you see these lines:

Code:
   "mtr_detonate"            "textures/decals/bulleth02"
   "mtr_detonate_glass"      "textures/decals/testbulletglass1"


Right now, the ONLY detonation effects for the pistol are the default "mtr_detonate" and a glass detonation effect.

So, let's add:

Code:
   "mtr_detonate_surftype12"   "textures/decals/duffysplat"
   "mtr_detonate_wood"   "textures/decals/duffysplat"


For now, just use the blood splat as the material effect for testing... you can create your own decal later on.

This will replace the black bullet mark that fades away over time with a blood splat that will fade away....

I think that should do it... so basically, you have full control over the sound and visual effects that get used for each surface you define.

Here's a screenshot. The wall uses the default detonation...

Code:
"mtr_detonate"            "textures/decals/bulleth02"


And the floor (wood) uses the blood splat.

Code:
"mtr_detonate_wood"      "textures/decals/duffysplat"


Image

Oh, and one last thing... you can load a particle effect (in addition to a decal "splat") when the projectile detonates by modifying the entityDef projectile_bullet_pistol section:

Code:
   //"model_smokespark"         "bulletsmokeandspark.prt"
   // comment the above out so the following line works:
   "model_detonate"         "plasmatrail"
   "model_ricochet"         "bulletricochet.prt"


Note that these don't seem to be surface-specific...

Image

The possible values are model_detonate, model__ricochet, model_smokespark, model_burn, model_tracer, and model__dissolve.
Let me know if you have any problems or further questions.

Goliath



Cody64@Posted: Tue Jan 25, 2005 1:26 am :
Well, its different particles for different surfaces that I am trying to do :( I have tried "model_detonate_metal" but it still just plays the default particle :( It would be odd if there is no way of achieving that without modifying the sdk :? I'm still looking into it, and have been trying a number of different things. If I find a way to do it, I will post it :)

BTW, Thanks for the help :)



Grid@Posted: Tue Jan 25, 2005 5:55 am :
There are no specific detonate fx. You can only use "model_detonate".

The way it works is to look for a "model_detonate" in the projectile def. If it fails to find that fx, or if the string is empty, it then searches the following:

If the surface is metal, stone, or none, it uses "model_smokespark". If the surface is a richochet, it uses "model_ricochet". Otherwise it uses "model_smoke".

So if that doesn't suit your needs, the only way I can see of doing what you want without modifying the SDK is if you can somehow set the console variable "g_testParticle" to "1" and "g_testParticleName" to the name of the fx you want to use, since that will override everything above. I don't know if scripting will handle that, though. It's probably easier in the end to modify the SDK source code.



Cody64@Posted: Tue Jan 25, 2005 7:10 pm :
hmmm...... Thanks for the usefull info..... I'll see what I can do. But because of many other things I am working on, I might have to wait for the second chapter of my mod b4 I put in the type of particle system that I want :(



geppy@Posted: Sat Jan 29, 2005 10:51 pm :
How can you add more (named) sound surfaces? What in the SDK would you need to mess with?



Grid@Posted: Sun Jan 30, 2005 7:59 am :
As far as I know the material parser is part of the engine rather than the SDK. Therefore, it doesn't seem possible to reference a new surface type by name in a material file and have the parser recognise it.

The only solution I know about is to add your own text processor that generates the mtr files, then you can translate your own named surface into the D3 generic ones.