.MAT file (CS:CZDS)

From Valve Developer Community
Jump to: navigation, search

So, you want to make a cool particle effect when you shoot a wall in CS:CZDS? Well, lets take a look at what a .MAT how it all connects to the workings of CS:CZDS.


I do recommend making a backup of your CS:CZDS directory, just incase something goes wrong and ends up doing something we don't want. This is standard practice and should always be done when modifying files in the main directory.

What is a .MAT file

A .MAT file is what CS:CZDS uses for it's uniquely built particle system that is specific to the textures in the game. It covers everything that you might imagine a particle effect could do. For example, when a concrete wall is shot in game, one would expect that things like a bullet decal, gray smoke would be emitted, chips of concrete would fall out of the wall, Among other things such as the gravity, fade speed, color and what sprite the chips of concrete use. The .MAT format is highly customizable and very easy to work with once the terms and formatting are explained. But there are limits to what we can do in CS:CZDS because of the mostly hardcoded nature of the game itself.

The limits

Now lets take a look at the limitations of the .MATs on CS:CZDS.

  1. Limit on material .MATs. You'd initially think that you could just make a new material (for example, Blood.mat) and chuck it in the 'default' directory and assign it to a texture in the level. Unfortunately, that's not possible. For some reason, the materials have a hard coded limit in the game. This means that you can only replace the .MATs in the 'default' directory. There is one single slot named 'custom' for a user defined .MAT though.
  2. Unclear Properties. Now, this one is difficult to explain. None of the settings for the materials have explanations for their settings. So I don't fully know what some of the settings do. This is a result of there being a lack of documentation for the game.

File structure

The file structure is important. There are two directories that .MATs should be. One for defining the .MATs for levels, and one for creating material .MATs to be used.

Directory for defining .MATs for a level:

  • Files in this directory define the .MAT file for your levels, and can also be the area where a global czero.MAT is stored for loading when the game is started. The format for these is generally YOURMAPNAME.MAT, with the exception of the global czero.mat.

Directory for defining the material .MATs:

  • Files in this directory define the materials used within the above mentioned directory. Basic materials such as dirt and grass are stored and referenced from here, aswell as the prior mentioned 'custom' .MAT.

These two directories are linked in a way. So you should always place the correct file in the correct directory, otherwise they may not work as intended. The next section is going to explain how to create and link a texture a .MAT file.

Linking a texture to an effect

Lets say we have a brick texture. We need to assign the correct .MAT material for this texture. How do we do this? We need to create a .MAT file for our level first. We can copy one from the base game directory, rename it to whatever your custom map name is, and put it in the materials folder.

Next, open your new custom level .MAT using notepad, I am using notepad++ for this. Delete all it's contents and use this handy prefab.

		type "brick"

If you used the above prefab, this would assign the "brick" base material that can be found in the "default" directory, to the texture name you put in. This means that, when the texture is hit, it will make the "brick" particle effect. You can choose other base materials out of that folder too. Play around with the different materials and see what suits the texture that you put in. Save your custom level .MAT file and fire up your map in game and test it out. If we want to define more materials, just copy the previous entry, change the texture name and the basic material and it should work.

Note.png Note:  It is important to note that we can hotload the material list after saving using the mat_reload command within the command console.

To do: Finish the tutorial.