Materials.txt

From Valve Developer Community
Revision as of 04:22, 9 July 2023 by NOUG4AT (talk | contribs)
Jump to navigation Jump to search
English (en)Translate (Translate)

🖿sounds/materials.txt is a text file used in GoldSrc GoldSrc to dictate what sounds are made when stepping on certain textures.

The system operates through a single file called “valve/sound/materials.txt” found within the primary installation folder of the Half-Life game. This file contains a series of lines that assign texture names to corresponding material types using a one-letter code. For example, the letter ‘V’ represents ventillation, ‘D’ represents dirt, ‘M’ represents metal, and so on:

// Half-Life Texture Types.  Modify this file only if texture names are changed!
//  'M' metal, 'V' ventillation, 'D' dirt, 'S' slosh liquid 
//  'T' tile, 'G' grate (Concrete is the default), 'W' wood, 'P' computer, 'Y' glass

V SILO2_COR
D OUT_GRVL1
M SILO2_P2

By specifying the appropriate texture name in the file, the corresponding material type will be used for the associated surface. If a texture is not defined in the file, the default concrete sounds will be applied. It is important to note that this file is universal and affects all texture names used in any map within the game mod. Additionally, it cannot be overridden with custom entries specific to individual maps.

There are several approaches to overcoming this limitation:

  1. Accept the default sounds for custom maps and do not make any changes.
  2. Personally modify the materials.txt file. However, all players and servers must share the altered file, so creating a mod with a customized materials.txt file is a possible solution.
  3. Override the materials for objects by utilizing brush entities that allow material selection. Currently, only func_pushable and func_breakable entities offer this capability. By using func_breakable with the “Only Trigger” attribute, the object can be made unbreakable without assigning an actual trigger.
  4. Name custom textures in a way that matches existing entries in the materials.txt file. Textures included in the BSP file take precedence over those in WAD files, meaning that custom textures can override the default Half-Life textures.

Please note that the information provided here pertains specifically to the game Half-Life and its modding capabilities.