Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Embedding Custom Textures - A Tutorial for Goldsource Engine.

Textures can be embedded with your map to save up on disk space and .res entries.

1. Requisites

2. -wadinclude

The recommended way to embed your textures is to use the -wadinclude file parameter in CSG, where file is the name of your WAD file(s). It is not case sensitive, matches partial names and also matches directory names.

If you want to embed multiple WAD files with different names, specify this parameter multiple times: -wadinclude game -wadinclude banana. If your WAD files have similar names, such as apple1.wad, apple2.wad, apple3.wad, use partial name matching:  -wadinclude apple. You could also embed a directory containing your WAD files: -wadinclude folder.

This parameter will only embed textures that you have used in your map, not the whole WAD file. Note that zhlt.wad is automatically set in the wadinclude list, but will only be embedded if you use the ZHLT tool textures in your map.

Here's the CSG compile log with the use of -wadinclude. There are no wad files required to run the map, as all 3 of the used textures used are embedded into the map.
Using mapfile wad configuration
Wadfiles not in use by the map will be excluded
Wadinclude list :
[zhlt.wad]
[seedee]

CreateBrush:
(0.00 seconds)
CSGBrush:
(0.00 seconds)

Including Wadfile: /VHLT/zhlt.wad
- Contains 1 used texture, 33.33 percent of map (19 textures in wad)
Including Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/seedee.wad
- Contains 2 used textures, 66.67 percent of map (33 textures in wad)

Wad files required to run the map: (None)
Texture usage is at 0.17 mb (of 32.00 mb MAX)
0.04 seconds elapsed

If you decompile the map and open the resulting WAD file, you will see all of the embedded textures:


Here's the CSG compile log without the use of -wadinclude. As you can see, seedee.wad is required to run the map. If you attempt to load the map without it, it will crash your game.
Using mapfile wad configuration
Wadfiles not in use by the map will be excluded
Wadinclude list :
[zhlt.wad]

CreateBrush:
(0.00 seconds)
CSGBrush:
(0.00 seconds)

Including Wadfile: /VHLT/zhlt.wad
- Contains 1 used texture, 33.33 percent of map (19 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/seedee.wad
- Contains 2 used textures, 66.67 percent of map (33 textures in wad)

Wad files required to run the map: "seedee.wad;"
Texture usage is at 0.17 mb (of 32.00 mb MAX)
0.04 seconds elapsed

3. -wadconfig

This method uses the wad.cfg file, which contains configurations of WAD files to be used by the compiler. Use the -wadconfig name parameter in CSG, where name is the name of your configuration. Any WAD files not specified in your configuration will be excluded, and won't be required.

I have created a configuration called bananaconfig in my wad.cfg file. Note that paths with spacebars must be wrapped in double quotes, or the compile tools may not locate the WAD file. zhlt.wad must also be defined, but it will be included automatically.
bananaconfig
{
c:\VHLT\zhlt.wad
include "c:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\seedee.wad"
include "c:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\treegrasspack.wad"
}

Here's the CSG compile log with the use of -wadconfig.
Loading wad configuration 'bananaconfig' from 'C:\VHLT\wad.cfg' :
"c:\VHLT\zhlt.wad"
include "c:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\seedee.wad"
include "c:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\treegrasspack.wad"
Wadinclude list :
[zhlt.wad]

CreateBrush:
(0.00 seconds)
CSGBrush:
(0.00 seconds)

Including Wadfile: c:\VHLT\zhlt.wad
- Contains 1 used texture, 25.00 percent of map (19 textures in wad)
Including Wadfile: c:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\seedee.wad
- Contains 2 used textures, 50.00 percent of map (33 textures in wad)
Including Wadfile: c:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\treegrasspack.wad
- Contains 1 used texture, 25.00 percent of map (99 textures in wad)

Wad files required to run the map: (None)
Texture usage is at 0.50 mb (of 32.00 mb MAX)
0.05 seconds elapsed

3.1. -wadcfgfile

By the default, CSG looks for the wad.cfg file in it's own directory and in the Half-Life directory, so this parameter doesn't have to be used. However, if you are using a wad.cfg file in another directory, you should specify the path to it using the -wadcfgfile path parameter in CSG.

4. -nowadtextures

This is the obsolete method of embedding textures. It works the same way as -wadinclude, except it embeds every single texture from every WAD file used in the map. This makes it a poor option if you are using stock textures that everyone already has, such as halflife.wad or cs_dust.wad, as it unnecessarily increases your map file size. Therefore, you should only use the -nowadtextures parameter in CSG if you are entirely using custom textures.

5. -wadautodetect

This parameter automatically detects which WAD files you have used in your map and excludes any WAD files that aren't in use, allowing you to have unused WAD files configured in the editor without them being required to run the map. This parameter isn't required if you are using -wadconfig. Here's the CSG compile log with the use of -wadautodetect.
Using mapfile wad configuration
Wadfiles not in use by the map will be excluded
Wadinclude list :
[zhlt.wad]

CreateBrush:
(0.00 seconds)
CSGBrush:
(0.00 seconds)

Including Wadfile: /VHLT/zhlt.wad
- Contains 1 used texture, 33.33 percent of map (19 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/seedee.wad
- Contains 2 used textures, 66.67 percent of map (33 textures in wad)

Wad files required to run the map: "seedee.wad;"
Texture usage is at 0.17 mb (of 32.00 mb MAX)
0.03 seconds elapsed

Here's the CSG compile log without the use of -wadautodetect. I had 14 different WAD files configured in the editor, excluding zhlt.wad. All of them are required to run the map, even when I've used textures from just one of them.
Using mapfile wad configuration
Wadinclude list :
[zhlt.wad]

CreateBrush:
(0.00 seconds)
CSGBrush:
(0.00 seconds)

Including Wadfile: /VHLT/zhlt.wad
- Contains 1 used texture, 33.33 percent of map (19 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/cs_dust.wad
- Contains 0 used textures, 0.00 percent of map (28 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/valve/halflife.wad
- Contains 0 used textures, 0.00 percent of map (3116 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/itsitaly.wad
- Contains 0 used textures, 0.00 percent of map (99 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/chateau.wad
- Contains 0 used textures, 0.00 percent of map (136 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/de_piranesi.wad
- Contains 0 used textures, 0.00 percent of map (160 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/cs_havana.wad
- Contains 0 used textures, 0.00 percent of map (122 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/valve/liquids.wad
- Contains 0 used textures, 0.00 percent of map (32 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/torntextures.wad
- Contains 0 used textures, 0.00 percent of map (162 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/treegrasspack.wad
- Contains 0 used textures, 0.00 percent of map (99 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/decals.wad
- Contains 0 used textures, 0.00 percent of map (225 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/de_vertigo.wad
- Contains 0 used textures, 0.00 percent of map (19 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/de_westwood.wad
- Contains 0 used textures, 0.00 percent of map (33 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/cs_dust_2020.wad
- Contains 0 used textures, 0.00 percent of map (101 textures in wad)
Using Wadfile: /Program Files (x86)/Steam/steamapps/common/Half-Life/cstrike/seedee.wad
- Contains 2 used textures, 66.67 percent of map (33 textures in wad)

Wad files required to run the map: "cs_dust.wad;halflife.wad;itsitaly.wad;chateau.wad;de_piranesi.wad;cs_havana.wad;liquids.wad;torntextures.wad;treegrasspack.wad;decals.wad;de_vertigo.wad;de_westwood.wad;cs_dust_2020.wad;seedee.wad;"
Texture usage is at 0.17 mb (of 32.00 mb MAX)
0.05 seconds elapsed

Note that -wadautodetect is enabled by default therefore doesn't have to be used in the command line. If you wish to disable it, comment out #define -wadautodetect in settings.txt.
#ifdef // CSG
#ifndef -wadautodetect
//#define -wadautodetect
#endif
#endif

6. See also

Creating and Editing WAD Files
  • tom avatar
    tom username pic Joined 21y ago
    End Boss Ripe Supporter TBS2 Manager FNF Manager TF2 Manager KRtDL Manager GGST Manager CS1.6 Manager Super Admin
    Offline
    2,120 points Ranked 22,645th
    92 medals 13 legendary 11 rare
    • Achieved Super Admin clearance Medal icon
    • 10 years a member Medal icon
    • Thanked 500 submitters Medal icon
    • Submitted 200 Blogs Medal icon
    • Submitted 200 Threads Medal icon
    • Submitted 60 Polls Medal icon
    tom avatar
    tom
    End Boss
    2y
    Another great tutorial - thank you!
    1 2 3 4
    URL to post:
  • Pirucho XP-007 avatar
    Pirucho XP-007 username pic Joined 6y ago
    Offline
    Zamurais Flag Affiliation: Zamurais
    824 points Ranked 48,435th
    28 medals 2 legendary 5 rare
    • Submitted 50 Maps Medal icon
    • 2019 Top Contributor Medal icon
    • Submitted 20 Maps Medal icon
    • Returned 1000 times Medal icon
    • Submitted 15 Mods Medal icon
    • Submitted 20 Mods Medal icon
    Pirucho XP-007 avatar
    Pirucho XP-007
    Zamurais Flag
    Affiliation
    Zamurais
    2y 2y
    Fence, interesting data that you contributed, thanks, will help me a little.
    • Thanks x 1
    Maper and CS 1.6 Programmer avatar
    Mantra
    Maper and CS 1.6 Programmer
    URL to post: