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.


  1. I have a problem with the command "make":

    SDL_mixer.h: no such file or directory.....

    1. It appears that you may not have the SDL development libraries installed on your system. I've updated the tutorial. Apologies, I assumed most folk would be using Retropie which has the libraries pre-installed.

  2. I tested wolf3D and it works now!
    Can you explain me how to configure the joypad please??

  3. Thanks for posting! My installation stops when I try to install the SDL dev libraries. It can't find the file libflac-dev_1.2.1-6_armhf.deb (404 Not found). Although there is a libflac-dev_1.3.0-3_armhf.deb on mirrordirector. How can I use this file instead?

    1. I'm not a Linux expert so I can't give a definitive solution.

      As far I understand, libflac-dev is a dependency of the libsdl-mixer1.2-dev package. I think the dependency required is libflac8_1.2.1-6+deb7u1_armhf.deb. I have just installed it on my system with without issue.

      Maybe you could check your /etc/apt/sources.list file. It should have one line:

      deb wheezy main contrib non-free rpi

      If it doesn't, then you should update your packages list with sudo apt-get update. If that doesn't help, then you can try apt-get install --fix-missing to download and install any missing packages on your system.

      If this doesn't help, you could try this thread on apt-get 404 errors at the raspberry pi forum to see if you find anything useful.

      If you're happy installing a .deb package, you could use gdebi. Install using sudo apt-get install gdebi and use with command: sudo debi package.deb.

    2. Here's the URL to the apt-get 404 errors thread at the Raspberry Pi forum.

      Still getting used to posting Blogger comments!

    3. I know, I'm having trouble with blogger too. I had to reply 3 times to get it right. Thanks for the info. Once I did...

      sudo apt-get update

      ...everything compiled like it should have. Although I did have to run it at a lower resolution or I'd get a blank screen.

      ./wolf3d --res 320 200

      Just curious if there are any other useful command line switches to use?

    4. I think a resolution of 320 x 200 is default. I suppose it depends on your video output as what the best resolution will be.

      You can find the command line options in the README.txt file or at the Wolf4SDL github.

  4. If I play wolf3D with your script in retropie a red screen appers when I exit the game. And I have to reboot my raspberry every time. Do you have the same problem?

    1. This comment has been removed by the author.

    2. This comment has been removed by the author.

    3. I still had the problem though it was a black screen rather than a red one. It was strange because if Wolf3D was the first game I played after booting, then I'd get the black screen. If it wasn't, then I could return to ES without a problem.

      I have updated the Integration into Retropie section above with a new shell script and the updates you need to do to make sure the script will work. I have tested it on my system and everything is working fine.

    4. Thanks. Now it works!!

  5. I think you should add a post for games like Doom, Hexen and Heretic in your blog.
    In this page there is the script to install crispy-doom...

    1. Thanks, alb. I shall put it on my list.

  6. I have tried both settings and about 5 different versions, but cant get it to work, always says "NO GAME DATA FOUND"

    someone please help me :(

    1. Even with my official version from 3drealms says the running BETA2 for raspberry pi2 if any help...

  7. The options in editing the version.f file I have given above are not the only ones available. You need to refer to lines 22 to 31 for a full list. I have Wolf3d shareware v1.4 so I needed to define CARMACIZED and UPLOAD, i.e. leave them uncommented.

    I would remove your wolf3d binary and recompile a fresh one by defining CARMACIZED for the official 3d realms version. Then you need to make sure that the game data is in the same folder as the wolf3d binary and has been renamed in lower case.

    If this is unsuccessful, you can try using DOSBox. As you have the Rpi2, I don't think you should any issues with performance.

  8. Im going out of my mind trying to get this working...

    I have recompiled it with -

    /* Defines used for different versions */

    //#define SPEAR
    //#define SPEARDEMO
    #define UPLOAD
    //#define GOODTIMES
    #define CARMACIZED
    //#define APOGEE_1_0
    //#define APOGEE_1_1
    //#define APOGEE_1_2

    Wolf3d Full v1.1 Apogee (with ReadThis) - define CARMACIZED and APOGEE_1_1
    Wolf3d Full v1.4 Apogee (with ReadThis) - define CARMACIZED
    Wolf3d Full v1.4 GT/ID/Activision - define CARMACIZED and GOODTIMES
    Wolf3d Shareware v1.0 - define UPLOAD and APOGEE_1_0
    Wolf3d Shareware v1.1 - define CARMACIZED and UPLOAD and APOGEE_1_1
    Wolf3d Shareware v1.2 - define CARMACIZED and UPLOAD and APOGEE_1_2
    Wolf3d Shareware v1.4 - define CARMACIZED and UPLOAD
    Spear of Destiny Full and Mission Disks - define CARMACIZED and SPEAR
    (and GOODTIMES for no FormGen quiz)
    Spear of Destiny Demo - define CARMACIZED and SPEAR and SPEARDEMO

    and have the 1.4 shareware version, and all the files are in the .wolf3d (home folder) and it still doesn't work...

    Can someone try this on their pi and let me know if it works?

    its the wolf3d binary that was created for me and all the data files im using from the 1.4 shareware version..


    1. Do you want to try this binary for the 1.4 shareware version? I'll try to compile a new binary myself over the weekend to see if there have been any changes in source code..

      Have you tried running your versions of wolf3d in DOSBox? It's a lot more straightforward. There's no need to worry about the version of the game you have or whether you have a working binary. Just run it as you would any other DOS game.

    2. mate that worked, I don't know what it is I am doing wrong...

      Can you possibly build me a version for the full 3drealms version?



    3. Hi Karl

      I have noticed that there have been recent changes to the source code. The binary now requires the game data to be placed in the /usr/share/games/wolf3d folder. Do you want to test this with the shareware version before trying to compile a binary for the 3drealms version?

      I'm going to try to fork the wolf4sdl repo so that it is consistent with the RetroPie file structure. It may take some time as I've never done something like this before!

    4. Recomplied the full version and put data files in /usr/share/games/wolf3d ... No game data found again :(

    5. I also compiled a shareware version again, and placed the data files that worked with your binary into usr/share/games/wolf3d, but that didn't work something is not right somewhere....

  9. This comment has been removed by a blog administrator.