RedHat Linux Free Tutorial

Web based School

Red Hat Linux rhl60

Previous Page TOC Next Page



60


Linux Games


A variety of games comes with Linux. The games can be roughly divided between those that require the X Window system to run and those that will run in plain text mode. In this chapter, you will learn about both types. The chapter provides a reasonably complete list of both X- and character-based games.

This is the final chapter in the guide. We decided to save the most fun and addictive Linux programs for last!

Which Games Have You Installed?


The games listed in this chapter come in several different installation packages, so you might not have one or more of these games on your system. For instance, the graphical version of Tetris, GNU Chess, and Xfractint are each installed separately.

If one of the listed games sounds intriguing, you might want to install it if you haven't done so already.



Many more games are available from Internet sites.


X Games


The following games require X Window to run.

As X Window is a graphical, windowing environment, you might guess that X games are graphically oriented. You would be right! Almost all of the following games use color and bitmapped graphics. Often, you can specify the palette of colors the game will use.

However, you should keep in mind the following:

  • Arcade games, and home video game systems, have dedicated hardware that is designed specifically for running games. X Window is a generic environment. Even today's powerful personal computers can't match the speed and smoothness of movement of a game machine.

  • Games work your hardware and operating system software harder than any other application. For best performance, games are often programmed to run "close to the edge" and do various software and hardware tricks. You might find that one or more of these games will crash your system or have strange side effects.

  • The X games that come with Linux are personal efforts. The individuals who wrote the games, and allowed free distribution, appreciate suggestions and help in further development. Don't hold these games to commercial standards—they are not commercial products.

  • The Red Hat version on the CD-ROM will let you install two types games. The "Y" set contains the BSD games collection and the other set "XAP" contains the games with X Window support. Install both versions and then remove the ones you don't like.



It's tempting to put new games in /usr/games, though the most common area for user installed games is in /usr/local/games. The /usr/games directory is usually reserved for games that come with the system.

Following is a discussion of the X games you should find on your system. Keep in mind that installation differences might mean that you have more or fewer games.

Games in the fvwm Root Menu


If you use the X display manager fvwm, the fvwm Root menu (usually accessed by holding down the left mouse button while the cursor is in the root screen area) has a Games submenu choice. If you use a different window manager, such as Motif, your menus will be correspondingly different.

The menu choices are listed here. Some of the games they start are described in detail later in this chapter.

The Games menu features the following entries:

  • Hextris

  • Xbill

  • Chess (GNU Chess)

  • Xchomp

  • Minesweeper

  • Backgammon

  • Xjewel

  • Xlander

  • Xsnow

  • Tetris (Xtetris)

  • Trojka


X Games Not in the Menus


The following games can be started by typing the appropriate command at the Linux prompt in a command-line window. These, and any other games you may install, can be added to the Games menu if you desire. See Chapter 21, "Installing X Window on Linux," for more information.

  • Spider

  • Xboing

  • Xpaint

  • Xcannon

  • Xgal

  • Xcurling

  • attraction

  • Xsnooker

  • Xcarrom

  • Xpool

  • Xhockey

  • hopalong

  • Xdino

  • Xevil

Look in the /usr/x11/bin directory for still more games not listed here.

Spider (Small and Large)


This is double-deck solitaire. To see this game's man page, type man spider. To start this game, type spider in a command-line window.

This game requires a fair bit of thought, planning, and skill. The aim is to arrange cards of the same suit in descending order. You can also, however, have cards of different suits arranged in descending order. Sometimes this can help you immediately, but hinder you in the long run! Note that, if you do have two or more consecutive cards of the same suit, the cards will move as a group. Spider is challenging; don't try to play it just to pass the time!

GNU Chess


This is a graphical version of GNU Chess that uses the xboard display system.



Running GNU Chess under xboard is very resource-intensive. It may crash your system.
Adding more swap space may correct an agonizingly long response time. Do not worry, it's not your system, it's GNU Chess.



Xtetris


If you've never been hooked on Tetris, here's your chance. This is a nice X implementation of a game that always seems to suffer when taken from the video arcade and placed on a home computer.

To see this game's man page, type man xtetris.

To start this game, type xtetris in a command-line window.

The colors are nicely done, and the movement is relatively smooth. However, if you're used to the arcade version of Tetris, watch out for the following:

  • Left and right arrow keys move from side to side; up and down arrow keys rotate clockwise and counterclockwise. Most people have a preferred direction of rotation for the pieces; experiment to find out which way is right for you.

  • The spacebar, as is usual on home-computer implementation, slam-dunks the piece to the bottom rather than just hauling it down faster.

  • The colors of the pieces, though attractive, are sometimes confusing. For instance, the L-shaped piece that is yellow in the arcade version is purple in xtetris, and the L-shaped piece that is purple in the arcade version is light blue in xtetris. Again, very confusing if you're used to the arcade version.

The purpose of the game? Arrange the pieces so they interlock without gaps. As soon as you create a (horizontal) row that's completely filled, it vaporizes. This is good, because when the pieces stack up to the top, the game is over. (Pity the Cossack doesn't come out and tap his feet when things start to get a little out of control.)

Xlander


This is an update of the old arcade game, Lunar Lander. You get a bird's-eye view from the window of your lunar lander. By operating the main and directional thruster engines, you attempt to touch down softly on the landing pad. If things go wrong, instead of a bird's-eye view, you get a meteorite's-eye view!

To see this game's man page, type man xlander.

To start this game, type xlander in a command-line window.

You may have problems getting the game to respond to your keyboard input. In that case, the moon's surface is only a short plummet away.

Ico


Ico sets a polyhedron (a solid, multisided geometric shape) bouncing around your screen. Depending on the options specified, this three-dimensional polygon can occupy its own window or use the entire root window.

To see this game's man page, type man ico. It can be started from the command line (within X Window) by typing ico. In fact, you should start it from the command line because of the options available. If you start it from the Demo/Gadgets menu, you will only get a wireframe polygon in its own, small window.

One interesting option you can use from the command line is -colors. If you specify more than one color, you get a multicolored polyhedron, with each face a different color.

With the -colors option, you must type in the colors to be used in the following format: rgb:<red intensity>/<green intensity>/<blue intensity>. The intensities have to be specified in hexadecimal notation; 000 is the lowest value and fff is the highest. For example, the complete command might be


ico -colors rgb:000/888/fff rgb:e00/400/b80 rgb:123/789/def

This program is fairly resource-intensive and might slow down your system.

Maze


This draws a maze, and then solves it. There is no way you can solve it for yourself. Maze is a demo, not a game. On a fast system, it solves it too quickly to follow!

Xeyes


Not really a game, but cute anyway. Whenever you start Xeyes, you get a large pair of bodiless eyes that follow your cursor's movements. Running four or five copies of Xeyes at once gives your system a surrealistic touch.

To see this game's man page, type man xeyes.

To start this game, type xeyes in a command-line window.

Xlogo


This displays the official X logo.

Xhextris


This is a version of Tetris that uses pieces made up of hexagons. To start the game, type xhextris on an X Window command line. No man page is available.

Minesweeper


You are given a large grid. Some of the squares contain mines. Your job is to flag all of the mines.

This game is started by typing xdemineur at the Linux prompt in a command-line window.

Starting Minesweeper brings up the playing field, which is a dark gray grid, and a Score window.

You uncover a square by clicking on it with the left mouse button. If you uncover a mine, you are blown up and the game is over!

It's more likely, though, that you will either uncover a number or open up several light gray, blank squares (with no numbers or mines). The number tells you how many mines are found adjacent to that square, horizontally, vertically, or diagonally. For example, a "1" means there is only one mine adjacent to that square. If you've already determined the location of one mine adjacent to a "1" square, then it's safe to uncover all other squares next to the "1" square because they can't possibly contain a mine! In this fashion, you try to deduce the location of the mines. If you happen to uncover a square that has no number (and therefore no mines next to it), the game will automatically uncover the entire numberless area and its border.

When you think you've located a mine, you "sweep" or mark it by clicking on it with the right mouse button (if you click the left button accidentally, and there is indeed a mine there, the game is over). The right button toggles on and off a flag marker. Note that the game does not tell you whether you have correctly placed the flag.

You will soon discover that certain patterns of numbers let you place a mine without any doubt; other times, you have to make an educated guess.

Of course, sometimes you miscalculate and blow up. To restart the game, click with either mouse button in the Score window. If you complete the game successfully, your time will be recorded.

Xpaint


This is a color drawing-and-painting program. Start it from the Linux prompt in a command-line window by typing xpaint. A Tool menu will appear. Start a new canvas from the File menu. The Tool menu holds your drawing and painting implements (brushes, pencils, spray cans, and so on); the palette of colors and patterns is found underneath the canvas.

To see the man page, type man xpaint.

Character-Based Games


There is a long history of games being written for the UNIX operating system. Your Linux /usr/games directory contains a number of these games, from various time periods.

Many of these games were written before color, bitmapped windowing systems became common. Most of the games in /usr/games (except for Tetris, for instance) are character-based. This means that graphics (if there are any!) are displayed on your screen using standard screen characters: A, *, |, x, and so on. In addition, all input is from the keyboard.

An advantage of character-based games is that they do not require a graphical or windowing environment to run. A monochrome display is fine.

The character-based nature of some games, such as Hangman or Bog (Boggle), takes nothing away from the play; you don't really wish for fancy color graphics when playing them. Other character-based games might strike you as interesting historical curiosities: they show you what their ingenious programmers could manage with such a simple display system, but clearly would be better served by color graphics.

A Summary of Games in /usr/games


The games found in /usr/games can be roughly categorized into the following types:

  • Text adventure: Battlestar; Paranoia; Wump

  • Word games: Bog (Boggle); Hangman

  • Card games: Canfield; Cribbage; Go Fish

  • Board games: Backgammon; GNU Chess; Mille Miglia; Monop (Monopoly)

  • Simulations: ATC (air traffic control); Trek

  • Character-based "video" games: Robots, Snake, Tetris, Worm

  • Math games/utilities: arithmetic; bcd, Morse, and ppt; Factor; Primes

  • Full graphics games: DOOM

  • Miscellaneous demos and utilities: Caesar; Fortune; Number; Rain; and Worms



Two of the more interesting character-based games, Rogue and Hack, do not come with the Linux distribution. These games use the screen to display the rooms and corridors of a dungeon. You (and, in Hack, your trusty dog) move around the dungeon, mapping out the corridors, entering the rooms (be careful when you explore dark, unlit rooms), picking up treasure and magical items—and, last but not least, fighting monsters (or running from them!). After you have fully explored the level you're on, you can descend to a lower, more difficult level.
Every time you run Hack or Rogue, the dungeons are different. Every monster has different fighting skills, and some monsters have special talents. The magical items, which include rings, wands, scrolls, and potions, have a variety of effects. Some of the items you find, such as armor, might be enchanted or magically enhanced; but if you find a cursed item, you may have been better off not picking it up at all!
Both Rogue and Hack have their enthusiasts, but Hack is a later, more elaborate version that is generally preferred. If you come across either game on the Internet, pick it up and try it! There are also versions of Hack available for MS-DOS-based computers.



Text Adventure Games


These games follow the classic text-based formula: the system informs you that "you are in a maze of small twisty passages, all alike" or something similar; you type in your actions as go forward, east, take sword, and so on. If you like solving puzzles, these games will appeal to you. With text-based games, the adventure follows a defined path, and your responses are usually limited.

The following example is the start of the text-based game Battlestar, which you will learn about in the next section. Your commands are typed at the >-: prompt:


Version 4.2, fall 1984.

First Adventure game written by His Lordship, the honorable

Admiral D.W. Riggle

This is a luxurious stateroom.

The floor is carpeted with a soft animal fur and the great wooden furniture

is inlaid with strips of platinum and gold. Electronic equipment built

into the walls and ceiling is flashing wildly. The floor shudders and

the sounds of dull explosions rumble though the room. From a window in

the wall ahead comes a view of darkest space. There is a small adjoining

room behind you, and a doorway right.

>-: right

These are the executive suites of the battlestar.

Luxurious staterooms carpeted with crushed velvet and adorned with beaten

gold open onto this parlor. A wide staircase with ivory banisters leads

up or down. This parlor leads into a hallway left. The bridal suite is right.

Other rooms lie ahead and behind you.

>-: up

You are at the entrance to the dining hall.

A wide staircase with ebony banisters leads down here.

The dining hall is to the ahead.

>-: quit

Your rating was novice.

Battlestar

Type battlestar at the command prompt. A sample session is shown in the code in the previous section. A man page is available by typing man battlestar.

Paranoia

Type paranoia at the command prompt. In this humorous game, you play a secret agent on a desperate mission. Unlike most text-based adventure games, Paranoia lets you choose your actions from a menu. This is useful if you hate having to find a command that the game will understand. There is no man page for Paranoia.

Wump

Type wump at the command prompt. You are out hunting the Wumpus, armed with some custom arrows and relying on your wit and sense of smell. When you start the game, you are given the choice of seeing the instructions.

Type man wump to see the man page.

Word Games


The following two games are versions of popular word-finding and word-guessing games.

Boggle

Type bog at the command prompt. This is a version of the Parker Brothers game Boggle Deluxe. You are given a 5´5 grid of letters. In the allotted time of three minutes, you type in words made up from the given letters. By default, you must use letters that adjoin horizontally, vertically, and diagonally, without reusing any letters. Plurals and different tenses count as different words—for instance, "use," "uses," "used," and "user" are all allowed in your word list. This follows the official Boggle rules. You can change these defaults, if you want.

At the end, the computer displays the list of words which it found. You can never beat the computer, because it only allows you to type in real words. You will discover that the Boggle dictionary has some odd omissions; this can be annoying, but it isn't very serious.

This game works well without color graphics, although the small size of the letter grid makes your eyes blur after a while.

Hangman

Type hangman at the command prompt. You won't miss the color graphics. The game is self-explanatory, but just in case, a man page is available; type man hangman. Hangman picks its words at random; sometimes the choices seem quite impossible to guess.

Card Games


Because of the lack of graphics, the following games are not as successful as the character-based word games.

Canfield

Type canfield at the command prompt. This is a version of solitaire. A man page is available by typing man canfield. This game does not have the time-wasting potential of graphics and mouse-based solitaire games.

Cribbage

Type cribbage at the command prompt. If you're a cribbage fan, this game is for you. A man page is available by typing man cribbage.

Go Fish

Type fish at the command prompt. It's you against the computer at Go Fish. A man page is available by typing man fish. One confusing aspect is that sometimes several actions are displayed all together on the screen (for instance, you have to go fish, the computer has to go fish, and it's back to you, all in one block).

Board Games


These are character-based versions of board games. The play quality is variable; Backgammon is probably the best of the lot.

Backgammon

Type backgammon at the command prompt; or, for an easy-to-follow tutorial on how to play Backgammon, type teachgammon. These games don't suffer from lack of graphics, but the lack of a pointing device such as a mouse means that specifying your moves is a cumbersome task, requiring entries such as 8-12,4-5. Typing ? at the game prompt gives you help on entering your moves.

Typing man backgammon will give you the manual entry for both Backgammon and Teachgammon.

Chess

Several chess and chess-related programs come in the GNU Chess package. Type gnuchess at the prompt to play chess against the computer. There is an analysis program, gnuan. The game utility prints the chessboard position to a PostScript printer or file.

Enter your moves using standard algebraic notation—for instance, e2-4.

This is an elaborate package; you should start by reading the man page.



There seem to be some problems with startup messages overwriting parts of the chessboard.


Mille Miglia

Type mille at the command prompt. This is the Linux version of a Parker Brothers racing game. You should read the man page before starting, because the game's commands are not very intuitive. To see the man page, type man mille.

Monopoly

Type monop at the command prompt. This is a character-based version of the Parker Brothers game Monopoly. The computer does not actually play; it simply keeps track of who owns what and how much money each player has. You can play by yourself, but it's pretty obvious that you will, eventually, win! Unfortunately, the board is not displayed in any form, making it quite difficult to keep track of what's happening. This is an interesting effort, but the play is poor. A man page is available.

Simulations


The following games let you try your hand at being in charge. They are open-ended, in that each game is different and does not follow a canned plot. They combine character graphics, for instance, a radar display, with text readouts and text-based commands.

Air Traffic Control

Type atc at the command prompt. Type man atc and read the man page first; otherwise, you will be responsible for one or more air tragedies! This game runs in real time. A good supply of caffeine will probably help you do well.

Trek

Type trek at the command prompt. You can "go where no one has gone before," hunt (and be hunted by) Klingons, and so on. A man page is available by typing man trek; read it before playing to avoid being a disgrace to the Federation.

Video Games


The following games all rely on a full-screen display, although all graphics are assembled from the standard character set.

Robots

Type robots at the command prompt. Robots on the screen pursue you; your only hope is to make two robots collide, at which point the robots explode. The resulting junk heap destroys any robots that run into it. You move about the screen using the hjkl keys, as used by the vi editor (diagonal movement is allowed, using yubn). Moves are simultaneous: each time you move, so do the robots. Sometimes, though, you have to teleport to get out of an impossible situation. You die if a robot touches you; otherwise, after clearing the screen, you go on to a bigger and better wave of robots. A man page is available by typing man robots.



Some Linux distributions might include a version of Robots that has been hacked or modified so that you can't make a misstep that brings you in contact with a robot (thus leading to your demise). This takes away from the challenge of the game.


Tetris

Type tetris at the command prompt. Ironically, although it does not look anywhere near as professional as Xtetris or other full-graphics versions, it plays very well—especially if you're used to the arcade version of Tetris. Use the arrow keys for piece movement and rotation.

Worm

Type worm at the command prompt. You are a worm, moving about the screen and eating numbers. As you eat the numbers, you grow in length. Do not run into yourself or into the wall! How long can you get before you (inevitably) run into something? Note that you still slowly crawl forward, even if you don't enter a move command.

A man page is available by typing man worm.

Math Games and Utilities


The following programs are small and interesting, although perhaps not that exciting.

Arithmetic

Type arithmetic at the command prompt. You are asked the answer to simple addition questions. This goes on until you type Ctrl-C to exit. A man page is available by typing man arithmetic.

BCD Punch Card Code, Morse Code, Paper Tape Punch Code

Type bcd at the command line to convert text you type to a punched card, type morse to see your text converted to Morse code, or type ppt for paper punch tape output. If the command line doesn't contain any text to encode, the programs go into interactive mode. Note that the Enter character you must use to finish each line of input gets coded as well. The bcd man page covers all three programs.

Factor

Type factor at the command line. This command provides you with the prime factors of any number you supply. You can type factor <number> to factor just the one number, or factor without any number to go into interactive mode. Numbers can range from —2,147,483,648 to 2,147,483,648. The following is a sample run of Factor:


d$ factor

123

123: 3 41

36

36: 2 2 3 3

1234567

1234567: 127 9721

6378172984028367

factor: ouch

d$

Primes

Type primes at the command prompt. If you include a range on the command line, Primes displays all prime numbers in the range. If no range is included, Primes waits for you to enter a number, and then starts displaying primes greater than that number. The program is surprisingly fast! A man page is available by typing man primes.

Other Thinking Games


The following programs might actually be a bit frustrating to play with initially, but they can also provide hours of addiction!

Sokoban

Imagine yourself in charge of a warehouse containing a maze and lots of bales of cotton. Each bale is so heavy that you can only push it and not pull it. So don't push a bale into a spot where you cannot push it out. Each level in this game gets more and more challenging as you attempt to collect all the bales into a loading area where you can move to the next level. The source code is available from sunsite.unc.edu in the file sokoban-src.tar.gz.

DOOM

This exciting, though controversially gory, game is now ported to Linux as well. Complete with sound support and exquisite graphics, this Linux port does its DOS counterpart justice. One problem to keep in mind though, is that your colormaps in X may be mixed up once your cursor moves out of the X terminal you run DOOM under. Two other things to keep in mind—you have to rebuild your kernel to add the sound support, and the version 1.666 of DOOM will not run external WAD files. (I recommend that you get the registered version.)

Conquest

This is an elaborate game of global conquest with equally complex instructions and display. At least the files are in an executable form, and you do not have to build them. One thing to remember is to use the xconq file and run xset fp rehash to bring up the correct fonts. A comparable game, called Empire, is also available in source from tsx-11.mit.edu, but you need a network connection to run this game.

Miscellaneous Demos and Utilities


The following programs might interest you.

Caesar

Type caesar at the command line. This program attempts to decrypt encoded words. Type man caesar to see the man page.

Fortune

Type fortune at the command line for your Linux fortune-cookie message.

Number

Type number <number> at the command line. Converts the Arabic number given as <number> (for example, 41) to its equivalent in English (forty-one).

Rain

Type rain at the command prompt. Your screen becomes rippled like a puddle in a rainstorm. On most Linux console screens, the program runs too fast to look even remotely convincing. Press Ctrl-C to exit.

Worms

Type worms at the command prompt (do not confuse with the Worm program described previously). This fills your screen with squirming worms. Like Rain, the program runs much too fast on a Linux console screen. A man page is available by typing man worms.

Summary


You should now be able to while away the time by sitting at your machine and playing your favorite games. If you haven't installed the X Window system yet, maybe this is an extra incentive!

Previous Page Page Top TOC Next Page