Setting up Raspbian (and DOOM!)

Pages

Contributors: Jimb0

DOOOOOOOM!

Once you’ve familiarized yourself with everything Raspbian includes, you may notice it’s missing something. Certainly you’ve got the web, you’ve got Python, you even have Python games. But there aren’t any Python games that have you playing a space marine fighting off an otherworldly invasion on Mars. Let’s install Doom.

This step does require a connection to the Internet. So you’ll either need to route Ethernet to your Pi, or set up WiFi. If you’re a Linux newbie, this is a great opportunity to have your first experience with apt-get, tarball extraction, binary compilation, and installation – stuff you’ll be doing a lot of as you continue on.

There will be a lot of command line interaction here, so open up LXTerminal now. Every terminal command you should send will be presented as such:

pi@raspberrypi ~ $ man apt-get

Which emulates the default look of your terminal. Only send the grey-ish text in that line. The text in green represents your user and localhost name (which may be different). The text in blue represents your current directory (~ is the /home/pi directory).

Install Dependencies

Before we can compile Chocolate Doom, there are a few dependencies we need to harness first.

To begin, it’s always a good idea to update your apt-get index with:

pi@raspberrypi ~ $ sudo apt-get update

After apt-get update runs, we can apt-get all of our dependencies with this beast of a command:

pi@raspberrypi ~ $ sudo apt-get install libsdl1.2debian libsdl-image1.2 libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-net1.2 libsdl-net1.2-dev timidity.

It’ll alert you that the total “get” will be about 90MB. Type Y to begin the download. Now, time for something you’ll be doing a lot of: waiting. The downloading and unpacking will take 20-or-so minutes to finish up. While you’re waiting you can read up on the dependencies you’re installing:

It’s always good to know a little something about what you’re downloading and installing.

Download and Unpack the Source

Now that we have the dependencies under control, we can download the Chocolate Doom source code. First, navigate to a directory where you want the files to live. Here are commands to create a directory called “Doom” and go there:

pi@raspberrypi ~ $ mkdir Doom
pi@raspberrypi ~ $ cd Doom

Next, download Chocolate Doom with the wget command by sending:

pi@raspberrypi ~/Doom $ sudo wget http://downloads.sourceforge.net/project/chocolate-doom/chocolate-doom/1.7.0/chocolate-doom-1.7.0.tar.gz

Extract the tar.gz file by with this tar command:

pi@raspberrypi ~/Doom $ tar -xvf chocolate-doom-1.7.0.tar.gz cd chocolate-doom-1.7.0.tar.gz

Then move into the chocolate-doom-1.7.0 directory by sending:

pi@raspberrypi ~/Doom $ cd chocolate-doom-1.7.0

Configure, Make and Install

To double-check that everything looks correct, you can use the ls command to view all files in your current directory.

alt text

After un-tarring comes the ./configure command.

The next step is to configure Chocolate Doom by running the configure file. Do this with:

pi@raspberrypi ~/Doom/chocolate-doom-1.7.0 $ ./configure

Getting close! The next step is to make Chocolate Doom:

pi@raspberrypi ~/Doom/chocolate-doom-1.7.0 $ make

Watch the compilation scroll through a huge list of processes. Time for more thumb-twiddling. Once that’s done, the last step is to:

pi@raspberrypi ~/Doom/chocolate-doom-1.7.0 $ sudo make install

Woo! The Chocolate Doom engine is installed!

Download a WAD

You’ve got the game installed, but where’s all the data? WAD’s where all the data is. In order to run Chocolate Doom requires that you point it to a WAD file on your Pi.

There are a variety of WAD files out there. If you don’t own the game, you can download a shareware WAD here. Or if you want to stick to the command line, type this:

pi@raspberrypi ~/Doom/chocolate-doom-1.7.0 $ cd ..
pi@raspberrypi ~/Doom $ sudo wget http://www.jbserver.com/downloads/games/doom/misc/shareware/doom1.wad.zip

And then unzip the WAD with this command:

pi@raspberrypi ~/Doom/chocolate-doom-1.7.0 $ sudo unzip doom1.wad.zip

Now you should have a file named DOOM1.WAD in your Doom folder.

Setup and Play!

To open the Chocolate Doom setup utility, use the chocolate-setup command. While you’re doing so, you should also point it to the Doom WAD file you downloaded:

pi@raspberrypi ~/Doom $ chocolate-setup -iwad DOOM1.WAD

With the Chocolate Doom Setup utility you can adjust things like screen resolution (full-screen or windowed), configure keyboard, mouse, and joystick inputs, and sound.

Chocolate setup screenshot

Once you’ve made all of those changes, click “Save Parameters and Launch DOOM”.

Doom screenshot

If you ever want to launch straight into Doom, you can use this command:

pi@raspberrypi ~/Doom $ chocolate-doom -iwad DOOM1.WAD

Now go save the world!


Want more information about SparkFun's classes? Interested in getting involved with teaching electronics? Just want to talk? Sign up for our newsletter, or contact our education department.

SparkFun is a company built around one core idea – sharing ingenuity. We think everyone should have the hardware and resources to learn and play with cool electronic gadgetry.

Share, give, learn, SparkFun.

Do you regularly instruct classes and workshops in a formal or informal learning environment? SparkFun offers Educator Discounts to people teaching and sharing electronics.

Find out more.