-->

Previous | Table of Contents | Next

Page 281

Hour 19

Playing Linux Games

It's time to sit back, relax, and have some fun. Chances are that you've skipped the rest of the book and are reading this chapter first. Well, that's okay, because we all know the real reason we bought our computers, right? To zap hordes of alien invaders streaming across our screen!

In this hour you'll learn about two music CD players and some of the more than 70 games you can install on your system. This hour starts with an overview of the CD players, then moves on to information about playing games at the console and with the X Window System.

Page 282

Playing Music CDs with the cpd and xplaycd Commands

Using your computer as a stereo system may seem a bit extravagant, but it's nice to be able to listen to music while you work. In order to do this, Linux must be configured to use your sound card.

TIME SAVER
If you have not configured Linux to support sound, stop! In order to use your CD-ROM drive to play music CDs, you must have sound support installed in your kernel. See Hour 22, "Red Hat Tools."

If your sound card works with Linux, great! You can start playing music CDs right away. If you're not using X11, you can play music CDs with Sariel Har-Peled's cdp command, found under the /usr/bin directory. This command is a text-mode program. To use it, put a music CD in your CD-ROM drive and type the command:


# cdp

If nothing happens, make sure have a symbolic link, called /dev/cdrom, that points to your CD-ROM device—for example,


# ls -l /dev/cdrom

lrwxrwxrwx   1 root     root            3 Dec 22 08:19 /dev/cdrom -> hdb

You can create a symbolic link with the ln command. Make sure you're logged in as the root operator and type the following:


# ln -s /dev/XXX /dev/cdrom

This creates the symbolic link, /dev/cdrom, which points to your CD-ROM drive device XXX (hdb, sdb, scd, and so on). If you're not the root operator when you run first run cdp, you may get an error message:


# cdp

As root, please run

chmod 666 /dev/cdrom

to give yourself permission to access the CD-ROM device.

By default, CD-ROM devices are created with a file permission of 660, and the cdp command requires your device to be readable by anyone on your system. To fix this, use the chmod command (discussed in Hour 21, "Handling Files"):


# chmod 666 /dev/cdrom

Page 283

Now run the cdp command. When it starts, you'll see a list of the tracks on your CD. You should then turn on the NumLock key of your keyboard to control how you'd like to play your CD. Table 19.1 lists the controls for playing CDs from your keyboard's keypad.

Table 19.1. The cdp command keypad controls.

Action Keypad Key
Soft exit (music continues) 0
Help .
Back 15 seconds 1
Hard abort (eject CD) 2
Forward 15 seconds 3
Previous Track 4
Replay CD 5
Next Track 6
Stop 7 Toggle Pause/Resume
8 Play
9

The cdp command has a number of command-line options. A symbolic link, called cdplay, can be used to play music without the cdp command's interactive screen. You can tell cdplay to start playing music at a certain track with the play option, followed by a track number:


# cdplay play 3

This command line starts the cdp program, and your music CD starts playing from the third track. For more details about using the cdp command, see its manual page. The cdp command is handy for playing CDs from your console or the command line of an X11 terminal window, but if you use X11 all the time, you may want to use the xplaycd command, found under the /usr/X11R6/bin directory.

The xplaycd command, by Olav Woelfelschneider, is an X11 client you can use to play music CDs. The program appears in a small window with the standard music CD controls, along with horizontal stereo volume bars and a list of buttons representing the tracks on the CD. You can raise or lower your music's volume by clicking your left mouse button ahead of or behind the horizontal bars.

One great feature of this program is the ability to reorder tracks, and even play a track multiple times (see Figure 19.1). By clicking a track number and dragging, you can

Page 284

rearrange the play sequence of the tracks on your CD. To play a track multiple times, click a track number with your mouse's middle button and drag the track along the CD track sequence. When you release your mouse button, the track number is duplicated.

Figure 19.1.
The xplaycd X11 client
offers standard music
CD controls, along
with track re-ordering
and volume control.


The xplaycd also supports a music CD database, so you can create playlists of tracks for your favorite CDs. If you press your right mouse button anywhere on the xplaycd window, a menu of editing commands pops up. Use this menu to create and save your CD's play list. The database will be saved in the /var/lib/cddb, or CD database directory. You also can save CDs into different categories, such as jazz, new age, and so on. For details about using the xplaycd command, read its manual page, or the more detailed documentation under the /usr/doc/multimedia directory.

Games for the Console

If you don't use X11, you also can have fun at the console, because you'll find an assortment of 43 classic games you can play. Some of the games, like DOOM, have impressive graphics. Others use simple cursor movements and characters on your display.

Install the Berkeley Software Distribution, or BSD games, and you'll find: arithmetic, atc, backgammon, battlestar, bog, caesar, canfield, cribbage, factor, fish, hangman, mille, monop, paranoia, robots, trek, wargames, worm, and wump.

If you like text-based adventure games, try the scottfree command. This game interpreter comes with 11 adventures. Play an adventure by specifying its name on the command line.


# scottfree 6_circus

Scott Free, A Scott Adams game driver in C.

Release 1.14, (c) 1993,1994,1995 Swansea University Computer Society.

Distributed under the GNU software license



Roll up! Roll up!



The CIRCUS is in town!



Tell me what to do ?

This command line starts a circus text adventure. For more information about playing these games, read the files in the /usr/doc/scottfree and /usr/doc/mysterious directories.

Previous | Table of Contents | Next