2022-10-17 19:41:14 +00:00
# "Materials" in GoldSrc
2022-10-17 20:24:18 +00:00
2022-10-17 19:41:14 +00:00
In the GoldSrc games "Material" definitions handle what footsteps and what impact sounds are played against each texture in the game-world.
2022-10-03 00:10:54 +00:00
2022-10-17 19:41:14 +00:00

So when you walk on dirt, you can hear the difference; or when you shoot wood with a gun it will sound like wood.
2022-10-17 20:24:18 +00:00
**Note:** While Nuclide supports this for legacy BSP files, please define the surface properties inside your [material ](Documentation/Materials/MatOverview.md ) using the **surfaceprop** command.
2022-10-03 00:10:54 +00:00
## Details
2022-10-17 20:24:18 +00:00
Usually, a game in the GoldSrc engine would provide a `sound/materials.txt` file, where each line defines the properties for a single (or a series of) textures by starting with a material id character, followed by whitespace, followed by a name matching pattern.
2022-10-03 00:10:54 +00:00
For example:
2022-10-17 19:41:14 +00:00
`C CONCRETEWALL`
2022-10-03 00:10:54 +00:00
2022-10-17 20:24:18 +00:00
Will give any surface the id **C** if it starts with the name `CONCRETEWALL` .
2022-10-03 00:10:54 +00:00
It will also only compare the length of characters of the name above. So for example if you were to define:
2022-10-17 19:41:14 +00:00
`C CONC`
2022-10-03 00:10:54 +00:00
Then `CONCRETEWALL` would still be marked as concrete, and any other texture that starts with `CONC[...]` .
2022-10-17 20:24:18 +00:00
**Note:** In vanilla Half-Life, the second argument (name) can only be 12 characters long.
2022-10-17 19:41:14 +00:00
2022-10-17 20:24:18 +00:00
When you then walk around your level, the footstep will then be aware of you being on a texture marked with the **C** attribute and play a different step sound. Games are free to define what those material id characters mean - so different games/mods may interpret it differently.
Porting levels can sometimes be a bit more work than it first appears to be at first glance as a result!
2022-10-17 19:41:14 +00:00
## Later Enhancements
### Community additions
2022-10-03 00:10:54 +00:00
2022-10-17 20:24:18 +00:00
In stock GoldSrc games, the `sound/materials.txt` can be overwritten by a modification but it couldn't be dynamically extended in any way.
This means there was no possibility of map specific materials, and mods could not inherit Half-Life's materials, so mods would always have to manage a nearly duplicate file if they desired custom material definitions.
2022-10-03 00:10:54 +00:00
2022-10-17 20:24:18 +00:00
A few mods tried to remedy this problem, the following below are methods
2022-10-03 00:10:54 +00:00
documented so far:
2022-10-17 20:24:18 +00:00
file named maps/MAPNAME.mat
2022-10-17 19:41:14 +00:00
: Introduced in The Wastes (2003)
2022-10-03 00:10:54 +00:00
2022-10-17 20:24:18 +00:00
file named maps/MAPNAME_materials.txt
2022-10-17 19:41:14 +00:00
: Convention by Andrew Lucas, creator of Trinity SDK, modeled after MAPNAME_details.txt
2022-10-03 00:10:54 +00:00
2022-10-17 19:41:14 +00:00
worldspawn entity key named 'materials_file' with the value `PATH_TO/FILE.txt`
: Introduced in Sven Co-op 5.0
2022-10-03 00:10:54 +00:00
2022-10-17 19:41:14 +00:00
**All these methods are supported by Nuclide**, as one goal is to implement
2022-10-17 20:24:18 +00:00
conventions by not only Valve but the community as well!
2022-10-03 00:10:54 +00:00
2022-10-17 19:41:14 +00:00
### Nuclide additions
2022-10-03 00:10:54 +00:00
In addition Nuclide has also implemented a way of giving modifications
2022-10-17 19:41:14 +00:00
their own *inheritable* materials file:
2022-10-03 00:10:54 +00:00
2022-10-17 19:41:14 +00:00
`sounds/materials_UNIQUENAME.txt`
2022-10-03 00:10:54 +00:00
The idea here is that any mod or even map pack can include ONLY the textures
2022-10-17 20:24:18 +00:00
used, and no longer will anyone have to manage a near-clone of `sound/materials.txt` .
2022-10-03 00:10:54 +00:00
For repackaging or modding purposes, if you desire to give your map custom
2022-10-17 19:41:14 +00:00
material property definitions, we recommend **The Wastes** its method for individual maps,
2022-10-17 20:24:18 +00:00
while the Nuclide method should be used for **mods** or **map packs** .
2022-10-03 00:10:54 +00:00
2022-10-17 20:24:18 +00:00
**Note:** We recommend only using material text files for GoldSrc related modding
2022-10-03 00:10:54 +00:00
purposes. It is inefficient for modern projects as there are much better
2022-10-17 20:24:18 +00:00
standards already supported in Nuclide.
2022-10-03 00:10:54 +00:00
# Material List
2022-10-17 19:41:14 +00:00
2022-10-03 00:10:54 +00:00
In Nuclide, this is the currently supported list of material IDs:
| Material ID | Material Name |
|-------------|---------------|
| B | Bloody Flesh |
| C | Concrete |
| D | Dirt |
| F | Flesh |
| G | Grate |
| H | Alien |
| K | Snow |
| M | Metal |
| N | Sand |
| O | Foliage |
| P | Computer |
| S | Slosh |
| T | Tile |
| V | Vent |
| W | Wood |
| Y | Glass |
## Game differences
2022-10-17 19:41:14 +00:00
Different games/mods can ship with different material properties.
To make your life easier, you can edit **scripts/surfaceproperties.txt** and define
which Material ID character maps to which [surfaceproperty ](Documentation/Surf_data.md ) entry.
This way you can add new materials to existing legacy maps without writing a line of code.
2022-10-03 00:10:54 +00:00
Listed below are definitions for various games and mods. Only the changes and additions are listed since the rest are identical.
2022-10-17 19:41:14 +00:00
## GoldSrc Games/Mods
2022-10-03 00:10:54 +00:00
### Arrangement
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| B | Blue Texture |
| N | Snow |
| R | Red Texture |
| U | Slime |
| X | Yellow Texture |
| Z | Black Texture |
### Counter-Strike
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| N | Snow |
| X | Grass |
2022-10-17 19:41:14 +00:00
2022-10-03 00:10:54 +00:00
*Afraid of Monsters: DC, Natural Selection, and Snow War uses the same definitions.*
### Cry of Fear
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| B | Random Twig Snap |
| H | Paper |
| I | Mud |
| O | Sand |
| P | Snow |
| R | Gravel |
| U | Grass |
| Y | Broken Glass |
| Z | Carpet |
### Gunman Chronicles
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| G | Wood |
| T | Rock |
| V | Sand |
| W | Unknown/Unused? |
### Firearms
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|-----------------------------------------|
| B | Sandbag |
| N | Snow |
| U | No impact or decals, just smoke effects |
### Heart of Evil
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| U | Mud |
### Hostile Intent
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| A | Sand |
| E | Foliage |
| N | Snow |
| R | Carpet |
| U | Mud |
| Z | Grass |
### Household DEATH!
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| H | Wood (Creaky) |
| I | Grass |
### Night at the Office
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| T | Carpet |
### Opposing Force
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| O | Snow |
2022-10-17 19:41:14 +00:00
2022-10-03 00:10:54 +00:00
*Science and Industry uses the same definitions as Opposing Force.*
### Poke646
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| M | Metal/Grate |
| T | Wood/Tile |
| G | Carpet/Grass |
### Wasteland Half-Life
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| B | Barrel |
| I | Sand |
| N | Tinroof |
| R | Rust |
| U | Drywall |
2022-10-17 19:41:14 +00:00
2022-10-03 00:10:54 +00:00
*The Wastes uses the same definitions.*
2022-10-17 19:41:14 +00:00
## Source Engine Games/Mods
While Source has materials describing a surface with its own ** $surfaceprop** command, the GoldSrc way of describing materials with a 1-character symbol is still used to define which **impact effect** to use.
The **Material ID** is used via the `gamematerial` command inside **scripts/surfaceproperties.txt** entries. In Nuclide that's used for compatibility with the GoldSrc system instead.
2022-10-03 00:10:54 +00:00
2022-10-17 19:41:14 +00:00



Be aware that a Source engine game may actually have more surface materials than this, these are *solely the IDs associated with impact effects* .
2022-10-03 00:10:54 +00:00
### Alien Swarm
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| 11 | Steam Pipe |
2022-10-17 20:24:18 +00:00
**Alien Swarm: Reactive Drop uses the same definitions.**
2022-10-03 00:10:54 +00:00
### Counter-Strike: Global Offensive
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------------|
| 11 | Mud |
| 12 | Sand Barrel |
| 13 | Sand Barrel (Penetration) |
| 14 | Metal Shield |
### Half-Life 2
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| A | Antlion |
| B | Flesh (Bloody) |
| H | Flesh (Antlion) |
| K | Snow |
| L | Plastic |
| N | Sand |
| I | Clip |
| O | Foliage |
| X | Fake |
| - | No Decal |
### Half-Life 2: Episode 2
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| E | Antlion Egg Sacks |
| Z | Adviser Shield |
### Insurgency
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| A | Fruit |
*Day of Infamy uses the same definitions.*
### Left 4 Dead
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| J | Grass |
| K | Mud |
| Q | Asphalt |
| R | Brick |
| U | Cardboard |
| 1 | Clay |
| 2 | Plaster |
| 3 | Rock |
| 4 | Rubber |
| 5 | Sheetrock |
| 6 | Cloth |
| 7 | Carpet |
| 8 | Paper |
| 9 | Upholstery |
| 10 | Puddle |
### Portal 2
2022-10-17 19:41:14 +00:00
| Material ID | Material Name |
2022-10-03 00:10:54 +00:00
|-------------------|---------------------|
| R | Reflective |