This article's documentation is for the "GoldSrc" engine. Click here for more information.

materials.txt

From Valve Developer Community
Jump to: navigation, search

Stub

This article or section is a stub. You can help by adding to it.

English (en)
Edit

🖿sounds/materials.txt is a text file used in GoldSrc GoldSrc to dictate what sounds are made when stepping on certain textures, as well as what sounds to make when attacking those textures.

Cpp-16px.pngCode:🖿pm_shared/pm_shared.c controls footstep sounds, and 🖿dlls/sound.cpp controls surface hitsounds.
Icon-Important.pngImportant:The per-texture footstep sounds are only used by players (including bots).
Monsters do not have footsteps by default, but can have specific individual sounds defined in the animation sequence definition in their models' QC file, using animation event 1004. For example, the scientists use this QC definition for their walk animation:
$sequence "walk" { "scientist_anims\walk" ACT_WALK 1 { event 1004 0 "common/npc_step1.wav" } { event 1004 8 "common/npc_step3.wav" } fps 20 loop LX }

Description

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.

List of values:

Icon-broom.png
This article or section needs to be cleaned up to conform to a higher standard of quality because:
The surface types are defined in the server DLL; while these types are accurate for Half-Life and Counter-Strike, other mods/games can use whatever format they wish. The useable values are usually properly documented at the top of the file, so perhaps a list isn't needed here?
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
Prefix Means
M Metal
V Metal (ventilation)
D Dirt
S Slime
T Tile
G Grate
W Wood
P Computer
Y Glass
N Snow (Counter-Strike only)
X Grass (Counter-Strike only)
C Concrete
F Flesh


Usage example:

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.

Note.pngNote:this file is universal and affects all texture names used in any map within the game mod. 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.

Quirks

There are certain quirks within the system that can be utilized by mappers to simplify the process of adding new textures.


Character Limit

All Half-Life textures have a maximum limit of 15 characters for their names, so when implementing these methods, it is important to ensure that the new texture names still adhere to this limit. The header of the materials.txt file provides information indicating that only the first 12 characters of a texture name are used. This is interesting for mappers because it allows for the addition of numerous custom textures without the need to overwrite existing ones. By using an existing 12-character material name from the list as a prefix for a new texture, the first 12 characters will match. For example, CRETE2_FLR03 is listed as a Grate type texture and its name is 12 characters long. If a custom texture is created with the name CRETE2_FLR03_NU it will still produce the sound associated with a Grate because the first 12 characters match. However, ELEV1_FLR is also listed but cannot be used in the same manner. If a custom texture named ELEV1_FLR_MyFlr is created, only the first 8 characters will match. This quirk is also utilized by certain default Half-Life textures to allocate material sounds to multiple textures through a single entry, such as DRKMTLT_WALL


Prefix Characters

When the engine compares the materials.txt file to a map texture, it first removes any "texture prefix" characters from the map texture. Specifically, it removes a leading "+0" or "-0" (or any other digit or letter). It can also remove one of the characters "!", "~", "{", or a space before making the comparison. Practically, this means that an entry like G CHAIN_LINK will match various texture names, including:

+0CHAIN_LINK
-2CHAIN_LINK
+A~CHAIN_LINK
~CHAIN_LINK
+1{CHAIN_LINK


Similar to the 12-character limit, this quirk can be leveraged to add new textures without replacing existing ones by adding an unused prefix. For example, to include another wood texture, a texture could be named -1OUT_WD This will match the existing entry OUT_WD from materials.txt while keeping the original OUT_WD from the halflife.wad file available as well. It is advisable to avoid using prefixes with special meanings, indicating:

  • "!" ("liquid")
  • "-0" ("randomly tiled")
  • "{" ("alpha-tested").

See also

External links