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, each of which are detailed below:
An internal WAD, or IWAD, is the main WAD file for a Doom-based game. It contains all the sprites, levels, music, other graphics, multimedia data, and various important lump files that a particular game uses. The main examples are Doom, Doom 2 and both parts of Final Doom, but in SRB2's case, it would be
srb2.srb, which lacks player sprites, maps and music (these are stored externally in PWADs).
A patch WAD, or, PWAD, is a WAD file that is added on to the game. Contrary to the IWAD, PWADs are not required to run the game but simply add new resources or replace existing ones from the IWAD. They can contain various different types of lumps, such as new levels, sprites, enemies, or even a SOC file. If the game needs a lump of data, such as the sprites for a certain enemy or a map, it will check every PWAD from the most recently added to the very first added, before ultimately it checking the IWAD. If it still hasn't found it, it displays an error message, which in the case of sprites is usually a Segment Violation.
An SDLL is an alternative type of PWAD which was formerly reserved for date-activated secrets such as
3drend.dll for Christmas mode, typically used for WAD files disguised as DLL files. 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 lumps can contain a wide variety of data:
- 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 typically 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: Located between the marker lumps
F_END. These are the graphics displayed on floors and ceilings.
- 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: Located between the marker lumps
S_END. These are the graphics displayed by in-game Objects.
- 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: WAV, MIDI and OGG files can be stored as lumps in WADs.
- Palette: These lumps are called
PLAYPAL(defines the 256 colors the game uses) and
COLORMAP(controls how to adjust these colors for different light levels).
- 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.
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.