Surface Types

From The DarkMod Wiki
Jump to navigationJump to search

Originally written by Ishtvan on

What are Surfaces Types?

Surfaces types are used to tell what sound to play when you walk on a surface (this code is already in D3, we just have to tell it what sounds to play and how loud those sounds should be to AI). They are also used when objects collide or a projectile hits a surface, to play a specific sound, give off a specific particle effect, or to trigger a specific action (rope arrow only sticks in wood; only "climbable" surfaces can be climbed).

They also determine armor factors in combat (an arrow will bounce off the AI's helmet, but if you shoot it right into the eye opening, it will hurt).

Doom 3 had a limited list of only 16 surface types. To support the wildly different surfaces that TDM needs, we expanded that system by using a small trick. This article explains what types you can use, and how.

Old (D3) Surface Types

The following surfaces are standard D3 surfaces. We cannot change the name of these even if we wanted to.

Put one of these in the first line of the .mtr definition:

  • none
  • metal
  • stone
  • flesh
  • wood
  • cardboard
  • liquid
  • glass
  • plastic
  • ricochet
  • surftype10 (??)
  • surftype11 (??)
  • surftype12 (??)
  • surftype13 (??)
  • surftype14 (??)

New (unique to TDM) surface types

Use surftype15' and put surface in description string (this list is not fixed, we can keep adding to it):

  • tile
  • carpet
  • dirt
  • gravel
  • grass
  • rock
  • twigs
  • foliage
  • sand
  • mud
  • brokeglass
  • snow
  • ice
  • squeakboard
  • puddle
  • moss
  • cloth
  • ceramic
  • climbable
  • slate
  • straw
  • armor_leath
  • armor_chain
  • armor_plate
  • undeadbone
  • undeadflesh (like flesh, but less vulnerable to mundane damage)
  • paper
  • hardwood

Instructions on putting in new surfaces

In the material file, put "surftype15 " as the first line. Then, in the "description" line, put the new surface type in quotes. If you want to add anything after that, that's fine, just make sure the surface type is the first thing in the description, and you put a space after it.

NOTE: Old surfaces can be entered the same way as new surfaces, but it decreases performance You could use the surftype15/description method to enter surface types for old D3 textures if you wanted. Entering it the "old" way would lead to slightly faster performance though, since wood is in the enumeration so no string manipulation is required. I don't think this performance impact will be noticable, but you never know.


Putting in one of the old D3 surface types, wood:


   qer_editorimage  textures/darkmod/mansion/floor/manfloor03.tga
   diffusemap       textures/darkmod/mansion/floor/manfloor03.tga      
   specularmap      textures/darkmod/mansion/floor/manfloor03_s.tga

Putting in a new surface type, tile:


   description "tile"
   qer_editorimage  textures/darkmod/mansion/floor/manfloor02cen2.tga    
   diffusemap       textures/darkmod/mansion/floor/manfloor02cen2.tga  
   specularmap      textures/darkmod/mansion/floor/manfloor02cen2_s.tga

Again, note that you could put more in the description line, for example:

   description "tile This is a tile mosaic that might look nice in a mansion entry hall"

This will work because the first word is tile and there's a space after it.


As of now, there is no system to tell you when you make a typo in the new surface type name that goes in the description field. The surface just won't play the proper sounds, etc, it will play the default sounds or none. In the final release, we will hopefully include a quick parser that will go thru the material files for the map and let you know if the new surface types don't match the valid ones.

See also