Play Games on Your Pi - Raspberry Pi: A Quick-Start Guide, 2nd Edition (2014)

Raspberry Pi: A Quick-Start Guide, 2nd Edition (2014)

Chapter 8. Play Games on Your Pi

Linux has never been a popular gaming platform. Even though the situation has improved over the years, it probably will take some time for the first blockbuster titles to become available. Still, you can already play some entertaining and sometimes even addictive games on the Raspberry Pi.

For example, you can enjoy thousands of text adventure games on the Pi. Although commercial publishers abandoned this genre long ago, it still has an active and enthusiastic fan base that releases new games frequently. And if you haven’t played classic games such as Zork, you should give them a try.

Another classic genre is point-and-click adventure, including games such as The Secret of Monkey Island and Day of the Tentacle. Thanks to the efforts of the open-source community, you can play most titles on your Pi.

Even if the Pi isn’t powerful enough to run modern games, it still has enough power to run some native Linux games, such as Quake III. It even has enough power to emulate some home computers and game consoles from the past. For example, on the Pi you can play all games made for Atari’s VCS 2600.

Play Interactive Fiction

Text adventure games were very popular with users of the first home computers. In contrast to modern games with spectacular 3D graphics and surround sound, text adventures look very spartan. They output only text, and you control the game by typing commands on your keyboard. Here you can see the opening of Zork, one of the most famous text adventures.



ZORK I: The Great Underground Empire

Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights reserved.

ZORK is a registered trademark of Infocom, Inc.

Revision 88 / Serial number 840726

West of House

You are standing in an open field west of a white house, with a

boarded front door.

There is a small mailbox here.


>open mailbox


Opening the small mailbox reveals a leaflet.


>take leaflet




>read leaflet



ZORK is a game of adventure, danger, and low cunning. In it you will

explore some of the most amazing territory

ever seen by mortals. No computer should be without one!"

Don’t be misled by the game’s presentation. Many text adventures tell great stories and can entertain you for hours.

Even though no commercial text adventures have been released for decades, the genre still has an active community that produces exciting games. Most of these games tell long and elaborate stories, so their authors prefer to call their creations interactive fiction.

Infocom was one of the first companies to produce interactive fiction. They created some of the greatest text adventure games. The Infocom developers realized early on that they could reduce their efforts by creating a domain-specific language for describing interactive fiction. They called this language Z-language, and authors of interactive fiction still use it today to create games.

To run programs written in Z-language, you need an implementation of a virtual machine named Z-machine,[88] and one of the best is Frotz.[89] You can install it as follows:


pi@raspberrypi ~ $ sudo apt-get install frotz

To play a text adventure using Frotz, you need only the game’s Z-language file. A great place to start your search for interactive fiction is the Interactive Fiction Archive,[90] which hosts thousands of games.

If you’re new to interactive fiction, you should start your journey with the Zork trilogy. This series of games made Infocom famous, and although they are a couple of decades old, they are still as fresh as they were on their first day. Meanwhile, they are available for free,[91] so download Zork I[92] and start it as follows:


pi@raspberrypi ~ $ unzip

pi@raspberrypi ~ $ frotz zork1/DATA/ZORK1.DAT

This invokes the Z-machine interpreter and runs the game stored in ZORK1.DAT. You might need a few moments to get used to this kind of game,[93] but it’s certainly well worth it.

If you enjoy playing interactive fiction, you might also enjoy creating it using today’s tools. It’s really easy,[94] at least on a technical level. You still have to come up with a compelling and original story, though.

Play Point-and-Click Adventures

Another genre that has always been popular is point-and-click adventures. In these games, you control the main character using the mouse. You can make the character move to a certain place on the screen by clicking the place, and you can perform actions by clicking the action’s name on the screen. Popular point-and-click adventures are The Secret of Monkey Island, Day of the Tentacle, and Maniac Mansion.

There has always been a demand for new point-and-click adventures, but very few have been released over the last several years. The big publishers didn’t believe in them and preferred to release countless first-person shooters, such as Call of Duty and Battlefield, instead.

Tim Schafer, one of the creators of The Secret of Monkey Island, got frustrated by this situation and tried to raise some money on to fund a new point-and-click adventure. He raised more than $3.3 million and proved that people are still very interested in this genre.

Similar to text adventures, most point-and-click adventures run on a virtual machine. The most popular one is SCUMM, which stands for Script Creation Utility for Maniac Mansion.

Originally, it was created by the developers of LucasArts to implement the game Maniac Mansion, and they have used it to implement many other games since.

The ScummVM[95] project implements a virtual machine that interprets SCUMM games, and it’s available for free. You can install it as follows:


pi@raspberrypi ~ $ sudo apt-get install scummvm

pi@raspberrypi ~ $ sudo apt-get install beneath-a-steel-sky

pi@raspberrypi ~ $ sudo apt-get install flight-of-the-amazon-queen

This will install not only ScummVM, but also two great games you can play with it. These games will appear in the Games section of your desktop’s Start menu. In the following figure, you can see Beneath a Steel Sky.


Figure 42. Beneath a Steel Sky is still a great game.

Beneath a Steel Sky and Flight of the Amazon Queen are freeware, so you can safely install them. Most other games aren’t available for free, so you’re allowed to install them only if you own the original. If you own other games that are compatible with ScummVM, you can start ScummVM directly and add them.

Emulate Other Platforms

Another way to play some fine games on the Pi is to emulate other platforms. Many emulators are available for Linux, and they reanimate classic computers and game consoles, such as the Commodore 64, the Sega Mega Drive, the Nintendo Entertainment System (NES), and many more. There’s probably at least one emulator for every single system from the past.

An emulator rebuilds the hardware of a certain computer or game console in software. So, you run the emulator on the Pi, and then you can work with the emulated system as if you’re using the original hardware. Most importantly, you can run all the old software and games that were available for the old system.

Emulating a complete computer is extremely difficult even for simple systems, and most emulators suffer from two major problems. The first is accuracy; often an emulator can’t emulate the original system at 100 percent. The second problem is performance, because emulating even very old and slow hardware requires a tremendous amount of resources. For example, the Commodore 64 ran at a clock speed of only 1MHz, but you need a lot of computing power to emulate it. Even the Pi’s hardware isn’t powerful enough to emulate the C64 at a reasonable frame rate at the moment, although it has a multiple of the C64’s resources. This might change with better graphics drivers for the Pi.

Still, the Pi is powerful enough to emulate some cool game consoles, and one of them is the Atari VCS 2600.[96] This device was popular from 1977 until the early 1990s, and you could play great games such as Pac-Man, Centipede, and Pitfall on it. The console was so popular that several emulators exist for it, and one of the best is Stella.[97] You can install and start it as follows:


pi@raspberrypi ~ $ sudo apt-get install stella

pi@raspberrypi ~ $ stella

First Stella asks you where it should look for game ROMs. The games for the VCS 2600 shipped on cartridges containing a few kilobytes of read-only memory (ROM). To play a game using Stella, you need a copy of its cartridge’s ROM. You can copy the content of a cartridge to your PC using a special device. Fortunately, you can find ROM files for all games on the Web,[98] but there’s one big problem: although most games for the VCS 2600 are very old, they are still copyrighted. So in most countries, it’s illegal to download and use ROM files of games you don’t actually own!

You can buy used cartridges on the Web for very little money, and some publishers still sell Atari game collections that ship on CDs. These collections do nothing but run an emulator and play the original ROM files.

The size of a ROM file is usually between 4KB and 8KB, and the filenames end with the extension bin. So, Pac-Man’s ROM file is named pacman.bin, for example. If you’ve copied a ROM file to the Pi, you can select it in Stella’s main menu, and it will start immediately. By default, you can use the cursor keys for movements and the spacebar for actions. Stella allows you to remap all keys, and it also has support for joysticks. On top of that, you can change countless video and audio options, but note that the Pi won’t emulate the VCS 2600 properly in the most demanding video modes.

Playing some classic games might bring back childhood memories, but the VCS 2600 has an incredibly active user group that still creates games.[99] Many of these home-brew titles actually look and sound better than most of the original games, and they’re usually available for free. In the following figure, you can see A-VCS-tec Challenge, for example.[100] Some of these home-brew games are available on cartridges even today.


Figure 43. People still create great games for the VCS 2600.

By the way, developing games or demos for the VCS 2600 is very difficult, but you can learn a lot, and it can be fun! Most people can’t imagine how limited the hardware was. It ran at a clock speed of 1.19MHz, it had only 128 bytes of RAM, and it had no frame buffer for the video display. Developing software for this machine was really painful back in the old days, but today’s tools and documentation make it much easier. For example, Stella comes with a debugger that allows you to see and change the state of a game while it’s running. To enable the debugger, start Stella like this:


pi@raspberrypi ~ $ stella -debug

To invoke the debugger, press the backquote key (‘), and remember that you can freely remap Stella’s actions to other keys if you can’t find them on your keyboard. In the following figure, you can see the debugger in action.


Figure 44. Stella comes with a powerful debugger.

All in all, Stella works pretty well on the Pi, because the VCS 2600 isn’t a very strong machine. Emulators for other systems don’t work as well at the moment. The C64 emulator Vice,[101] for example, theoretically works on the Pi, but its frame rate is too low for playing most games. On the other hand, emulators such as MAME[102] work really well for many titles.

Play Native Games

In the preceding sections, you learned about technologies that help you run games using virtual machines and emulators, but native games also exist for Linux. For example, on the LXDE desktop, you can find a compilation of some classic games written in Python: Four in a Row, Snake, and so on.

Because the Pi is a regular Linux system, you can run every game compatible with your current distribution as long as the Pi’s resources are sufficient. If you search the Web for classic games, such as Tetris or Pac-Man, you’ll quickly find really good clones.


pi@raspberrypi ~ $ sudo apt-get install ltris pacman

It’s worth trying to install all the games you find, but many are too demanding for the Pi. Surprisingly, the Pi is capable of running Quake II and Quake III (two famous first-person shooters) at a decent frame rate. As of this writing, they have some problems with sound output, but they’re still playable.

In addition, you can find cool games in the Pi Store (see Install Software and Media Using the Pi Store). Iridium Rising, for example, is an exclusive game for the Pi, and it’s very professional.

Finally, Mojang[103] has released a special Minecraft edition for the Pi.[104] It has some unique features, and it’s free. So, it’s worth looking for new Pi games.

Next Steps

In this chapter, you learned how to kill some time playing classic games on the Pi. The Pi might not be an Xbox or a PlayStation, but it runs some entertaining games that you won’t find on most modern video game consoles. The next chapter deals with a completely different topic. You’ll learn how to build and attach electronics projects to the Pi’s GPIO ports.









At, you can find a nice help sheet.