Friday, 23 January 2015

Install Wolf4SDL

In this tutorial, I will show how to download and install the Wolfenstein 3D port, wolf4sdl as well as how to integrate it into Retropie.

A Quick Word about the Versions of Wolfenstein 3D

Wolf4sdl came already installed on my Retropie 1.9 build but is no longer included in version 2.x.  It's easy to see why. When I installed wolf4sdl on my desktop, five binaries were installed, one each for the different versions of the game. On the pi, there is one binary, wolf3d, for all versions of the games. As a result, the Retropie 1.9 pre-compiled binary would only work for one (unspecified) version of the game.

Compiling the wolf3d binary takes less than five minutes and to do so is straightforward. The short compile times means it can be repeated until the right one for your version of Wolfenstein 3D is obtained.

Build Wolf4sdl binary for your version

If you are not using Retropie, then it's likely that you will need to install the SDL development libraries by running the command below.

sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev

Obtain the source code and unzip the data with following commands.


Before you compile, you need to edit the source code to create a binary for the version of your game data. The file to edit is version.h in the wolf4sdl-master folder. To do this, run the following commands.

cd wolf4sdl-master
sudo nano version.h

The lines to edit are 10 to 12. If you brought the full version of Wolfenstein 3D 1.4 from 3D Realms, then you need to leave line 16 uncommented as below.
//#define UPLOAD
//#define GOODTIMES

If you have the full version 1.4 from GT interactive, ID or Activision, then you need to leave line 15 uncomment as well.

//#define UPLOAD

If you have shareware version, have versions other than 1.4 or wish to create a binary for Spear of Destiny, then refer to lines 22 to 31 in version.h to find which lines to leave uncommented.

Save your changes to version.h. To compile, run the following command.


As mentioned earlier, the compile will take no more than five minutes. Once done, there will be a binary called wolf3d in the wolf4sdl-master folder.

Set up and Run Wolf4sdl

The source data is no longer required so to keep things tidy, create a new folder, wolf3d, in the home directory and copy the wolf3d binary to this folder.

cd ~
mkdir wolf3d
cp /home/pi/wolf4sdl-master/wolf3d /home/pi/wolf3d/wolf3d

The game data needs to be in the same folder as the binary so copy the game data to the wolf3d folder. The game data needs to be placed in /usr/share/games/wolf3d folder. If you are using the full version, the file extensions will be *.WL6. Change the working directory to the one containing the game data and run the following command.

sudo cp -r *.wl6 /usr/share/games/wolf3d/

For shareware versions,  the game extensions are *.WL1 so change *.wl6 to *.wl1 in the command above.

Before you can run the game, all filenames need to be changed to lowercase. As a check, the data files required are:

  • audiohed.wl6
  • audiot.wl6
  • config.wl6
  • gamemaps.wl6
  • maphead.wl6
  • vgadict.wl6
  • vgagraph.wl6
  • vgahead.wl6
  • vswap.wl6

Now run the following commands to check that Wolfenstein 3D runs.

cd wolf3d
./wolf3d --res 640 480
If the game runs fine, then you can now delete the source code in the wolf4sdl-master folder if you wish.


It's likely that you will have to play around with both versions of the version.h file described above before you get the right binary.


Check that the *.wl6 data files are in the same directory as the wolf3d binary and their names are in lowercase. If they are and you are still getting this error, then re-edit the version.h file (see above) and recompile.

ps you forgot to update NUMCHUNKS

If you receive this error, then it's likely that you have a binary for the wrong version. Re-edit the version.h file (see above) and recompile.

 If this does not resolve the problem, then try again with a different source for your game data.

Integration into Retropie

Ports in Retropie 2.x now use shell scripts to launch games in emulationstation. Do the same for Wolf4sdl by using the commands below to create a script,

cd ~/RetroPie/roms/ports
sudo nano

Copy and paste the code below.

cd /home/pi/wolf3d
/opt/retropie/supplementary/runcommand/ 0 "./wolf3d --res 640 480"

Save and exit. Next make the executable so it can be launched from emulationstation.

sudo chmod +x

Restart emulationstation and Wolfenstein 3D will appear in the Ports category.

If you are running Retropie version 2.3 or earlier, then it's probable that you will see a black screen on game exit and the pi can only be rebooted through a power cycle. In which case, you can fix this by either getting the latest Retropie image or carrying out the following updates on your existing image:
  • Update the Retropie binaries by choosing option 6 in the Retropie setup script;
  • Update the script.