LJ Archive

Networking for Pleasure

Marcel Gagné

Issue #93, January 2002

Challenge your old friends, wherever they live, to a game of Risk or Monopoly, across the network, across the world.

The wonderful thing about the Linux community, François, is that there really is a community. In some cases that community goes back to before Linux was born. Today, more than ten years after Monsieur Torvalds released Linux to the world, the tradition continues, those common bonds among computer enthusiasts only heightened by the Internet's toujours là nature. Networks, François—that is what makes this community strong.

Mais oui, François, you are correct. While this whole notion of networks leads itself to business communication, I think you will agree with me when I say the real keyword is communication. That means bringing people together, and what better way to bring people together than through games. We are a playful species, mon ami. I believe human evolution has brought us to this point, and the real purpose of all this networking technology, François, is to make it possible for people to play games with others around the world or across the block—that and to exchange wine-tasting notes via e-mail of course.

Ah, bonjour mes amis! François! To the wine cellar. Vite! Bring up the 1997 Mendoza from Argentina for our guests. Please, sit down, mes amis. Be comfortable. François and I were just discussing ways to unwind with friends who are far away. You know, when I was younger, we would sit around the table with a glass of wine, chatting loudly and enjoying a classic board game. With today's networking technology and your Linux systems, we can still do that, even when our friends are on the other side of the planet. Ah, François. Merci. Please, pour for our guests.

The first such game I want to look at is an old favorite of mine. You know the one—five ships are assembled on a grid representing a strange ocean. Two players face off, firing shots blindly:

“E-7.”

“Miss.”

“E-8.”

“Aw, you sunk my destroyer!”

This game even has been played on scraps of paper with the grids and ship positions drawn in. Now, if your long-lost friend is at the end of an internet connection on some far shore, you still can experience the joys of the game. In fact, it is even better. Ricardo Quesada is the author of Batalla Naval, a network-enabled game that takes this classic into a new realm. With this version of the game the two-player limit is gone, meaning that more can join in on the action. Now you have more to worry about than a single opponent. The excitement begins by visiting the Batalla Naval web site at batnav.sourceforge.net and downloading the latest source. Building the software will be familiar to many of you:

tar -xzvf gbatnav-1.0.2.tar.gz
cd gbatnav-1.0.2
./configure
make
make install

Voulez-vous jouer? In order to start a game, you must first execute the server program, gbnserver. It is also possible to connect to an existing server running somewhere else on the Internet. On the machine that launches the server, a window will pop up showing client connection statuses ranging from 0 through 9. At this point, you can join the game using the gbnclient program. The first thing you will see is a connection box, asking for server and port number. If you started the server by simply typing the command name, that port will be 1995. You also can choose a name for your player at this time. The default is your login name.

When you are ready, place your ships on the grid (a total of ten ships in this incarnation of the game) and click Send ships when you are happy. You'll need at least two players, but you also can fire up a robot to play against. When you are ready, and you have all the players you want, click on the Start game button.

So now we play over the network, whether it be across the room or around the world. But what about the friendly, energetic banter? What makes this feel like high-tech-meets-old-fashioned play is (strangely) something that takes advantage of the networked nature of the game—a chat interface. During the course of the game, you can let friendly banter flow back and forth among the assembled players by typing your messages in the text box at the bottom of the client. All messages will be prefixed with the name of the person who sent the message. Figure 1 shows a game of Batalla Naval in progress.

Figure 1. A Fierce Game of

The next item I want to cover appeals to the capitalistic land baron in all of us. It is one of the most popular games of all time, the classic real-estate trading and selling game called Monopoly. Over the years, it has spawned many variations including boards that represent a number of major cities throughout the world. Atlantic City is but one locale for the virtual real-estate mogul.

You'll find a couple of variations of this classic game out there, and we will get to that shortly. It is possible to connect to existing servers on the Internet, but there were no permanent servers when I checked into this, so the best bet is to run your own server (particularly if you want to play with your own crowd). The program that allows you to run such a server is Rob Kaper's monopd. The address for downloading the monopd dæmon program is sourceforge.net/projects/monopd. You will, however, need one other piece before you actually can assemble the game dæmon. This piece is the libcapsi_network library (once again from Rob Kaper), and it is also available from SourceForge, but at the following address: sourceforge.net/projects/libcapsinetwork. Let us start there. Begin by extracting the libcapsi source:

tar -xzvf libcapsinetwork-0.0.13.tar.gz
cd libcapsinetwork-0.0.13
./configure
make
make install

Now that we have the prerequisite library, we can follow essentially the same steps and create our monopd server dæmon:

tar -xzvf monopd-0.2.0.tar.gz
cd monopd-0.2.0
./configure
make
To start the dæmon, type monopd. The program listens on port 1234, and as it works you'll see little messages like entering monopigator. You conceivably can run the monopd program at this time, and it will run happily in the background, but we do need something else before we can start having real fun. Oui, mes amis, I agree that dæmons are fun, but they do not make a board game, non? What we need are clients. The client we have on today's menu is Eric Bourget's gtkmonop. You can get gtkmonop from gtkmonop.sourceforge.net:
tar -xzvf gtkmonop-0.2.0.tar.gz
cd gtkmonop-0.2.0
./configure
make
make install
When the client starts up, you'll notice three tabs. One is labeled Game Board, and it displays the game board. Amazing, is it not? The second is Assets, and from it you may wonder upon the wealth you have accumulated in the form of properties. The third is where you begin. Clicking this tab will provide you with a dialog for choosing a server (if you started it on your own machine, this is likely “localhost”), pick a nickname for the game and click Connect. When a second player joins the game, you are ready to begin.

As with the previous item on tonight's menu, Batalla Naval, gtkmonop provides a chat window so that you may (ahem) chat with your game partner or partners. Have a look at Figure 2 for a screenshot of a gtkmonop game in action.

Figure 2. Squaring off for

In the Linux world, we sometimes joke about world domination, meaning (of course) Linux's domination of the server world, the desktop, the PDA and so on. It seems that for some of us, this obsession goes back to the days before Linux was born. Many years ago I whiled away a great deal of time with friends playing a little friendly game of “conquer the world”. I do not need to tell you the risk in such an enterprise. That, by the way, was also the game's name: Risk. I occasionally miss those days, but now I need no longer fear because our old friend, Ricardo Quesada, decided that he too missed those days. Ricardo is the author of Tenes Empanadas Graciela (or just plain TEG). Along with his dedicated band of developers and gamers, the classic world conquest board game lives.

tar -xzvf teg-0.8.0.tar.gz
cd teg-0.8.0
./configure
make
make install
In order to get a game going over your network, you must now run the tegserver program. Please note that you do not run this as the root user; in fact, the program will not allow this. With the server running, start another session, this time by running the tegclient program. You will be asked for a server to connect to and that will be (presumably) the name of the host on which you started the server.

Once you have connected to the server, you will be asked to choose your color (red, blue, pink, yellow, black or green). In order for a game to proceed, you need at least two people connected and up to a maximum of six. When enough players have joined in, you can click Start to begin the game. This is a game of strategy, but the objective is simple: conquer the world. You'll notice, however, when you start the game, you also can run modified objectives, so-called secret missions. It also is possible to join in as an observer, watching others play the game.

TEG has three different map themes. These are classic, sentimental and my personal favorite, modern. Changing from one theme to another can be done during a running game by clicking on the Preferences tab. Figure 3 shows a game in progress between myself and my faithful waiter.

Figure 3. Marcel Regains Control of France

As with the other games I covered, TEG provides a chat window at the bottom of the screen so that you can send short messages to your fellow players during the course of a game. It is almost like sitting around the table at your grandparents' country home, non? The fun, the playful competition—it is all there, and now distance means nothing. So call up your cousin Henri in Versailles (or wherever), convince him to load Linux, and let the games begin.

Oui, François. I see the terrible clock and she is taunting us, non? Mes amis, I fear that closing time is upon us once again. When we cook with Linux, it seems that time vanishes. But do not worry. Finish your games. Drink your wine. François, I believe that I own this property. Prepare to pay up.

Until next time; au revoir, mes amis. Your table will be waiting. A votre santé! Bon appétit!

Resources

Marcel Gagné (mggagne@salmar.com) is president of Salmar Consulting, Inc., a systems integration and network consulting firm and the author of Linux System Administration: A User's Guide, published by Addison-Wesley.

LJ Archive