Mapping/Materials Replacement Guide

From Sven Co-op
Jump to navigation Jump to search

Next to models, sounds and sentences, you can also create a custom materials.txt file for your own WAD.

1 What is materials.txt?

Materials.txt is a file found in the '/sound' folder. This file keeps track of which type of footstep sound should be played on which texture. There are different types of material classifications:

  • metal (M)
  • ventilation (V)
  • dirt (D)
  • slosh liquid (S)
  • tile (T)
  • grate (G)
  • wood (W)
  • computer (P)
  • glass (Y)
  • flesh (F)
  • snow (O)
  • concrete (is used by default)

Here is an example of a line you will find in the default materials.txt file:

M LAB3_FLR2B

This means that the texture 'LAB3_FLR2B' will use the metallic (M) footstep sounds.

2 How to assign your own materials?

Method 1 This is the most simple one: You can use these prefixes to enable the correct sounds for your textures. So if you name your custom texture "WOODTEXTURE_WD1" the game will play the correct footstep sounds for wooden surfaces. Here is the full list of prefixes:

  • VENTTEXTURE_
  • DIRTTEXTURE_
  • GRATETEXTURE
  • METALTEXTURE
  • SLOSHTEXTURE
  • TILETEXTURE_
  • WOODTEXTURE_
  • COMPTEXTURE_
  • GLASSTEXTURE
  • FLESHTEXTURE
  • SNOWTEXTURE_

Note that textures names can't be longer than 16 characters (WAD format limitation). This considerably limits the amount of characters you have left to name your textures while using method 1. Therefore, I'd advice you to use method 2.

Method 2 Method 2 can be handy if you don't like long texture file names (because of the prefixes) or you are using a WAD file of which you can't change the texture names (because it's shared with other maps). Add lines with the right letter (accoring to the classifications above) and the name of your textures. For instance:

  1. Create a new folder in the '/sound' folder. You can use whatever name you like. I'm going to call mine 'mymap'.
  2. In this new folder, create a file called 'mymap_materials.txt'. Make sure to save it in ANSI format. Windows uses UTF-8 as default, which the engine can't read properly.
  3. Add your material classifications, according the the list above. Here are some examples: W PLANKS1 / S WATER_DIRT1A / M METAL_BORD2
  4. In the '/maps' folder, create (or edit) your map's CFG file (mymap.cfg). The CFG file needs to have the same name as the BSP file.
  5. Then add the following line to the CFG file and save it.
materials_file ../mymap/mymap_materials.txt

3 Notes

  • Do NOT edit the default materials.txt file found in the '/sound' folder. This one is used for Half-Life WADs and official maps. Supplying a modified version of this file with your map may cause conflicts. Plus, your file might be overridden in the next update of SvenCo-op, rendering your work useless.
  • The system only uses the first 12 characters from each texture entry. This means that you could create bundles of textures which start with the same first 12 characters and let them all have the same sound. If you add "M HEAVYMETAL00" to the materials.txt file, it will also apply the metallic footstep sounds to the textures such as: "HEAVYMETAL00_FLOOR", "HEAVYMETAL00_BORD", "HEAVYMETAL00_CEIL", etc. This is what makes Method 1 (described above) possible.
  • Prefixes (such as +1,-1, ~, +A) are ignored by this system. So "M HEAVYMETAL00" will also work for +1HEAVYMETAL, ~HEAVYMETAL, +AHEAVYMETAL, etc.
  • The materials.txt file cannot be used to use the ladder climbing sound (func_ladder) or the wading sound when players are walking knee high through a liquid (func_water).
  • You cannot assign the concrete sound type, since this is used by default. So if you want this sound, don't add those textures to the materials.txt file.
  • The engine can not load more than 2048 texture material definitions in total. The current default materials.txt file has around 1550 entries, so you can safely add up to 500 lines to your own custom file.