VERC: Embedding Textures into a Map Last edited 1 year ago2023-06-20 18:00:33 UTC

When this tutorial was written, GoldSrc mappers were still using Hammer, and Hammer was still called WorldCraft. The method used is identical to Hammer 3.x and JACK. For TrenchBroom, see the TrenchBroom setup tutorial.

Introduction

Half-Life stores textures in external files called wads. These wad files are then accessed at runtime, when the map is loaded into memory. When a new map is loaded, Half-Life looks for the wad files in the valve directory (for standard Half-Life maps, HL only looks here), and in the particular mod's directory, if applicable (for example, Opposing Force texture wads can be in either the valve or gearbox directories).

When custom textures are used in a user-made map, Half-Life needs to reference the custom textures in order to successfully load the map. These custom textures can either be distributed in a new wad file(s), or embedded into the map (the .bsp file) during the compiling process. Embedding textures into a custom map will increase the size of the bsp file itself, but there are a couple of reasons why an author may want to compile the custom textures into the map: There are two options for including textures in a bsp file: -wadinclude (the preferred, controllable option) and -nowadtextures (the easy, sloppy option), described below. Keep in mind that both options only embed used textures.

-wadinclude

This is the better, more flexible choice for embedding textures into your map. It is only available if you use ZHLT (or newer) to compile. It allows you to specify a particular wad file from which to embed textures into your map. This only embeds used textures from the wad file(s) specified.

Essentially, -wadinclude is the preferred option to embed textures because it is more controllable and doesn't unnecessarily inflate file size by embedding textures that everyone already has, in contrast to -nowadtextures.

Using -wadinclude

All examples below assume that custom.wad is the name of the texture file that you want to embed, and yourmap is the name of your map file.
User posted image

Important notes on using -wadinclude

----- BEGIN hlcsg -----
Command line: F:\WORLDC~2\HLCSG.EXE -wadinclude sandblast -nolog F:\Worldcraft3\maps-op4\sandblast24.map

(edited for space)

Using WAD File: \sierra\half-life\valve\halflife.wad
Using WAD File: \sierra\half-life\gearbox\opfor.wad
Using WAD File: \sierra\half-life\gearbox\decals.wad
Embedding textures from WAD File [\worldcraft3\sandblast.wad] into BSP <--- This line
Using WAD File: \sierra\half-life\valve\liquids.wad
added 26 additional animating textures.
Texture usage is at 1.64 mb (of 4.00 mb MAX)
87.44 seconds elapsed [1m 27s]
Make sure every wad that you wadinclude is listed like the above highlighted line. To further clarify this point, refer back to my hlcsg compile log above. Note that the command line at the top has -wadinclude sandblast to embed my custom file sandblast.wad. But I could have just as easily used any of the following with identical results: What this feature also means, if you use it correctly:

-nowadtextures

This is the original option for compiling textures into the bsp file. It simply embeds all used textures from all used wads into the final bsp. This was an option on Half-Life's original compile tool qcsg.exe, and was retained in ZHLT and newer tools .

ZHLT documentation claims that -nowadtextures has been rendered obsolete by the -wadinclude option, but -nowadtextures is actually still quite useful, because of its simplicity. It is overkill, though, since it will embed every single texture used in the map. Obviously, it is unnecessary to embed textures that everyone has, such as those from halflife.wad, liquids.wad, and xeno.wad. But if you are using a number of non-standard wads in your map, -nowadtextures is a quick (and dirty) way to ensure that players who download your map will not have to download extra texture wads in order to play your map.

In summary, -nowadtextures unnecessarily inflates the size of the final bsp, but it is quick and easy to set up and use.

Using -nowadtextures

All examples below assume that yourmap is the name of your map file.
User posted image
As you can see, -wadinclude is the more powerful and more useful option to embed textures into your map, while -nowadtextures is the quick, easy method. Please pay particular attention to the Important notes on using -wadinclude section above (especially #4), as these tips can help you to take advantage of the flexibility available with -wadinclude.
This article was originally published on Valve Editing Resource Collective (VERC).
The archived page is available here.
TWHL only publishes archived articles from defunct websites, or with permission. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.