WAD files are libraries of data files for any program that runs on the Doom Engine, such as Sonic Robo Blast 2. The term "WAD" is an acronym for Where's All the Data?. Stored in lumps, the data in a WAD file can be SOC data, maps, graphics, sound effects, and music. WAD files with all the main data of the game are known as IWADs, whereas WADs that work as patches are called PWADs.
Types of WAD file
There are four possible types of WAD file for use in SRB2 – any of the type names given below are set as the first four bytes of a WAD file, which can be viewed and edited through a hex editor. Each of these types are detailed below:
An internal WAD, or IWAD is the main WAD file for a Doom-based game. It is assumed it contains all the basic resources needed for the game (i.e. sprites, levels, music, other graphics, multimedia data, and various important lump files), if not most. Otherwise, these are identical in function to PWADs. The IWAD used by SRB2 is known as
A ZWAD is a compressed PWAD, which can be created by converting a PWAD to this type using the utility wadzip, an external tool that requires use of command line (Link to SRB2MB thread). These cannot be opened directly by standard WAD editors such as SLADE or XWE.
An SDLL is an alternative type of WAD file which was formerly reserved for date-activated secrets such as
3drend.dll for Christmas mode, typically used for WAD files disguised as DLL files – this type prevented them from being opened by any WAD editors, unless a hex editor was used to change the WAD's type to a PWAD before doing so. Several community members also used these to hide secret levels and other data within in a similar fashion. These are no longer used officially, as all date-activated secrets were removed by Version 2.0.
WAD files are organized as a collection of lumps – these are pieces of data which can contain data such as graphics, music, sounds, maps and several other types of data. A lump is identified by an eight-character name. If two lumps with the same name are reloaded, the one that was loaded last will override the other one. This makes it possible to replace the game's native resources by creating a lump with the same name as a lump in the game's IWAD.
Types of lumps
- Markers: Markers are lumps that do not contain any content and are merely used to organize the contents of a WAD file.
- Maps: Maps are stored as a collection of several consecutive lumps that must follow each other in a strict order. These map blocks start out with a header that indicates the map number, after which several lumps that contain specific data for the map follow. Map editors provide a graphical interface that is able to read these lumps and display them in an easy-to-edit format, and to automatically create and modify these lumps upon saving a map.
- SOCs: These are text lumps that control a wide array of different game settings and can be used to define custom content, such as Object configurations, level headers or playable characters. SOC lumps with the name
OBJCTCFGare automatically loaded on startup.
- Lua scripts: These are text lumps specially made to run Lua code. The names for these are expected to have the prefix
LUA_to be interpreted as a Lua script lump, such as
- Console scripts: These are text lumps that automatically execute console commands. While these can be created as external files, they are often integrated into WAD files as lumps to be executed either upon loading the WAD file by using the
ExecCfgparameter in the
MAINCFGlump, or inside a level, when used in conjunction with linedef type 415.
- Flats: These are the graphics displayed on floors and ceilings. They should be placed between the marker lumps
- Textures: These are the graphics displayed on walls. Textures that consist of single images are located between the marker lumps
TX_END. Composite textures that consists of multiple images can be defined in the
TEXTURESlump, while additional images for these composite textures can be stored between the marker lumps
- Sprites: These are the graphics displayed by in-game Objects. They should be placed between the marker lumps
- Character skins: These are the characters the player can play as, affecting both the graphics displayed for the player as well as gameplay. The skin and stats are defined in the
S_SKINlump, which should be followed by all sprites intended for the skin - these do not need to be between marker lumps unlike normal sprites.
- Other graphics: Other images can also be stored anywhere in WAD files, and used for various purposes, such as the title screen, menus and cutscenes.
- Sound effects and music: Sound files can be stored as lumps in WADs in formats such as WAV, Ogg, MP3, MIDI and MOD. See the sound and music tutorial for more information.
- Demos: Recorded playback demos, such as the ones used for Record Attack, can be stored as lumps in WAD files as well. Players can play back these demos with the
PLAYDEMOconsole command. Additionally, special demos can be included that are played back at the title screen.
Some lumps have special reserved names. These lumps typically serve a specific purpose.
MAINCFG- This SOC lump controls miscellaneous global game settings, but can also contain other SOCs.
OBJCTCFG- This SOC lump is identical to
MAINCFGin function. It is commonly used to define the character select entry for a character WAD, but can contain any other type of SOCs too.
S_SKIN- This text lump defines the stats for a character WAD. The lump name is partially flexible; "S_SKIN1", "S_SKIN2", and so on can all be used too, as the game will only search for the "S_SKIN" part of the name to load it.
TEXTURES- This text lump is used to define composite textures, which are textures that consist of more than one image.
ANIMDEFS- This lump is used to define animated flats and textures. See the custom textures tutorial for more information.
PLAYPAL- This lump defines the default palette of 256 colors that can be used by the game.
COLORMAP- This lump defines how the palette colors are adjusted for different light levels by default.
PALxxxx- This lump defines the custom palette for a map with Palette in the level header set to xxxx+1, xxxx being a four-digit number between 0000 and 9999.
CLMxxxx- This lump defines the custom palette color adjustments for a map with Palette in the level header set to xxxx+1, xxxx being a four-digit number between 0000 and 9999.
LUA_name- This text lump is a Lua script lump. The lump name is partially flexible; these lumps can have any name following the "LUA_" prefix, as the game will only search for the "LUA_" part of the name to load it.
DEMO_xxx- These are the playback demos that are played on the title screen. See MAINCFG#Title screen demos for more information.
Loading WAD files
To launch SRB2 with added WAD files, the files must either be in the same directory as SRB2 or in a subdirectory. Then, you may add them à la one of the following methods:
- In the console, enter in
- Use the SRB2 Launcher.
- In Start Menu -> Run, type in
SRB2DIRECTORYNAME\srb2win -file filename.wadYou must enter in the directory name as the DOS command prompt would display it.
- Add the
ADDFILE FILENAME.WADin autoexec.cfg in the SRB2 directory. This particular method will load that WAD file every time you run the game.
To remove a WAD file from the game, the game must be restarted.
Creating and editing WAD files
- Main article: WAD editors
First of all, you need to create the necessary data for the WAD that you want to create. Depending on what you want to feature in your map, these can be textures, sprites, a SOC file, levels etc. Then you use a WAD editor to add/extract/edit data into the WAD file and store it as a lump. For raw resources such as images or music, simply adding the lumps to the WAD file and then loading it will suffice. Some of the more complicated data requires extra steps for adding it, however. Depending on what resource you want to add, there are tutorials available to help you out:
- Level design - For custom levels and other techniques associated with mapping.
- Character WAD tutorial - For character WADs, which contain both sprites and SOC lumps.
- SOC and MAINCFG - For general modification settings and other SOC lumps.
- Custom textures tutorial - SLADE and Custom textures tutorial - XWE - For custom textures.
- Sound and music tutorial - For custom sound effect and music lumps.
If you want to replace any data that is already present in the game (such as changing the title screen, for example), simply give the replacing lump the same name as the lump that you want to replace, and store it in an external WAD. Externally loaded WADs, so-called PWADs, take precedence over the main WAD file, the IWAD. That means that if both the IWAD and a PWAD contain a lump with the same name, the game will only load the lump from the PWAD. If no lump of the same name is found in a PWAD, the lump from the IWAD is loaded.