Check out Half-Life Re-imagined competition results!
Check out Skewing textures in Hammer, our newest tutorial!
Welcome, al_mam, our newest member!

logo

Site Stuff

Reference

Maps

Community

ShoutBOX

Poll

Feeling Blue

What's your favourite shade of blue?

Azure

12

Cobalt

27

Turquoise

7

Cyan

9

Royal

5

Teal

3

Onliners

4 mins

Archie

4 mins

Dimbeak

9 mins

Kachito

18 mins

Qwertyus

20 mins

NineTnine

22 mins

Trempler

40 mins

Windawz

Affiliates

A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

Embedding Textures into a Map

By Unquenque

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:

  • it saves the author from having to distribute multiple files in order to load the map
  • the author may wish to protect his/her custom textures from being used in other custom maps without permission

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 Zoner's Tools 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.

  • Worldcraft - add '-wadinclude custom' to the Parameters box for hlcsg (without the quote marks). Note that '.wad' is not necessary in this line, and that the -wadinclude parameter can be added before or after the '$path\$file' parameter.

    So your Parameter box on hlcsg should read: $path\$file -wadinclude custom

  • Batch file - add '-wadinclude custom' after hlcsg.exe in your batch file.

    So your hlcsg line should resemble: hlcsg.exe -wadinclude custom yourmap

  • TBCC - type custom in the WAD Include box on TBCC's main setup screen.

Important notes on using -wadinclude

  1. Make sure you are using Zoner's Tools to compile.
  2. It is unnecessary to fill in the entire path to your custom.wad, and in fact this can cause problems, at least when using TBCC. I recommend just typing in the name of the wad file, without the path, and without '.wad' on the end.
  3. You should always check out your compile log to make sure that the necessary textures were embedded from the wad(s) you specified. Look at a portion of my hlcsg example compile log (using TBCC), with the important line highlighted:

    ----- 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
    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.

  4. The -wadinclude parameter is case-insensitive and can match partial filenames and even directory names. This is a very powerful feature that you should take advantage of. This is the easy way to embed multiple wad files using -wadinclude, instead of using multiple -wadinclude parameters. For example, if you name your custom wads custom1.wad, custom2.wad, custom3.wad, etc., all you need is to add '-wadinclude custom' and all these wads will be embedded because of partial filename matching. Or, you could just drop all custom wads you want to use into a special directory, e.g. into sierra\half-life\textures. In this case, add '-wadinclude textures' and all the used wads in that textures directory will be embedded because of directory name matching.

    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:

      -wadinclude sand
      -wadinclude BLAST
      -wadinclude world - because my sandblast.wad is in my f:\worldcraft3 directory

    What this feature also means, if you use it correctly:

    • You'll never have to use multiple -wadinclude statements on your compiles.
    • You'll never have to manually combine wad files using Wally to get your -wadinclude down to one wad.

-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 Zoner's compile tools.

Zoner's 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.

  • Worldcraft - add '-nowadtextures' to the Parameters box for hlcsg (without the quote marks).

    So your Parameter box on hlcsg should read: $path\$file -nowadtextures

  • Batch file - add '-nowadtextures' after hlcsg.exe in your batch file.

    So your hlcsg line should resemble: hlcsg.exe -nowadtextures yourmap

  • TBCC - simply double-click the No WAD Textures box to set this option to ON.

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.