Fly Me to the Wine Cellar

Marcel Gagné

Issue #85, May 2001

Marcel demonstrates how Linux can get you literally off the ground with the FlightGear simulator.

Not bad, eh, François? What do you mean, what is it for? This month's issue of Linux Journal deals with training and certification, and I am exploring that very topic. What? Of course I am on topic. This is a flight simulator, is it not? No one said anything about what kind of training and certification I should be cooking up. Mon Dieu! You are a wonderful waiter, mon ami, but you can be so literal. Watch this barrel roll, François. Wonderful, non?

Quoi? Ah, our guests are here. Welcome, mes amis. Sit down and make yourselves comfortable. We were discussing flight training and certification with the help of your Linux system. Of course, you can stretch your virtual wings at your computer, but to really fly, you must visit your local flight school and enroll, as your humble chef has done. Oui, mes amis. A number of years ago, I made my way to the local airport and took the first steps toward getting my pilot's license. It is a wonderful experience and one I highly recommend. Most schools will offer an inexpensive familiarization flight to give you a feeling of what you can expect when you take to the skies.

François. What are you doing standing there? Vite, François! To the wine cellar. In honor of the international nature of this topic, I suggest you bring up the 1997 Chilean Petite Syrah for our guests. When the world is open to you, it is only fair to be open to the world, non?

While the necessary skills of the pilot must eventually be honed in the pilot's seat, you can use your Linux system to help you with the process. For instance, you can download and build software to help you with your flight planning. Getting from one airport to another is more than simply following the road. For one thing, there is no road.

Ah, François, you are back. Please pour for our friends. While you are enjoying your Syrah, you might want to look at the first item on the menu, and what an item.

Even licensed pilots need to keep their skills tuned. In the commercial aviation business, this is often done with flight simulators. As expensive as these things can be, it is certainly less expensive than taking the old 747 out for a spin, as they say, non? For the Linux user, there are a few simulators available. We are going to explore one in particular.

Probably the single most ambitious simulator project out there is FlightGear. The developers of this incredible package have produced a very impressive flight simulator. The scenery itself is breathtaking, and the coloration of land and sky verges on photo-realistic. FlightGear takes the notion of realism so seriously they have started the arduous process of applying for FAA certification and approval. This realism comes at a cost, however. Trying to run FlightGear with anything short of a decent accelerated 3-D video card will be a slow and painful experience. If you are lucky enough to have such a card, then you must experience FlightGear. Fly, don't run, to http://www.flightgear.org/ to download your copy.

When I picked up my copy for this article, the release was 0.7.6. The installation process requires that you have a few libraries installed on your system, including PLIB, SimGear and Mesa. The GLUT libraries are also required, but they are part of the latest Mesa 3-D graphics library, so that should save you a step. Mesa is now distributed with a number of Linux CD distributions, so check yours out before going to look for the source. Links to all these sites are in the Resources section at the end of this article.

At the heart of this whole process is 3-D rendering, so we need to start with Mesa. If you do not have it on your system, go to http://www.mesa3d.org/ and get a copy.

Once we have verified the presence of Mesa, we have to create the PLIB libraries. I found the install to be much better with the latest version (1.3.1). Start by extracting the source to a temporary build directory. I like to use usr/local/src for that purpose, hence the first command below:

cd /usr/local/src
tar -xzvf plib-1.3.1.tar.gz
cd plib-1.3.1
./configure
make
make install

Similarly, you should then extract and build the SimGear libraries. The version at the time of this writing was SimGear-0.0.14.tar.gz. We build it like this:

 tar -xzvf SimGear-0.0.14.tar.gz
cd SimGear-0.0.14
./configure
make
make install
Next, unpack the FlightGear base package. The default location for the root directory is /usr/local/lib, and this is where I chose to unpack the archive. Note that this unpacking does not require you to do any compilation. These are base files for the packages, including some default aircraft models, scenery and so on:
cd /usr/local/lib
tar -tzvf fgfs-base-0.7.6.tar.gz
This will create a directory called FlightGear. Finally, we have the package itself. Extract your FlightGear-0.7.6.tar.gz file into a temporary directory and build the software:
tar -xzvf FlightGear-0.7.6.tar.gz
cd FlightGear-0.7.6
./configure
make
make install
To take advantage of hardware acceleration, the FlightGear executable (fgfs) needs to run SUID root:
chmod +s /usr/local/bin/fgfs
If all has gone well, you should be able to start your flight simulator from the comfort of your desk chair. I poured myself a glass of wine and fired up my new flight simulator. Yes, I know mes amis, one does not drink and fly, but this is a simulation. Perhaps I will pour a gingerale instead.
fgfs --fg-root=/some_directory/FlightGear
By the way, you need to specify the --fg-root flag only if you have chosen to install the FlightGear base files (scenery, etc.) somewhere other than its default location. For a look at my Cessna 172's cockpit, have a look at Figure 1.

Figure 1. Marcel Attempts a Takeoff from Toronto International Airport

I will let you in on a secret, mes amis. Your humble chef is also a licensed pilot, and he will admit right here that a good flight simulator can be quite intimidating when you are still trying to get the hang of it. Once you get comfortable with the controls (I used the keyboard to control my airplane), it is time to decide where to go. After all, it is a big planet, non?

Luckily, there is no lack of places to fly with FlightGear. Click on their download page and scroll to the Additional Scenery section. One click will transport you to a map of the world broken up into 10x10 degree chunks. In my case, I wanted the scenery that covered Toronto International Airport. That was the w080n40.tar.gz file. To be able to use that scenery, you need to change directory to the FlightGear scenery directory. Remember the default installation for the base stuff was in /usr/local/lib:

cd /usr/local/lib/FlightGear/Scenery
tar -xzvf w090n40.tar.gz

From there, I can restart my session from the Toronto airport by specifying the airport's identifier:

fgfs --airport-id=CYYZ
Unfortunately, we will not be able to learn everything there is to know about flying from this little introduction to FlightGear, so I do recommend you take some time and have fun with it.

If helicopters are more your passion, another great project under way is Search and Rescue. Not only do you get to fly a variety of helicopters and practice your flying, but you also take on search and rescue missions (hence the name), saving victims from terrible fates. Ah, the pressure. Have a look at Figure 2 for a view of my Sikorsky Jayhawk on the pad at LA International.

The process of installing the software is essentially the same as our previous examples. Unpack the source from the SearchAndRescue0.7b.tgz bundle into your temporary directory. Note that you will also need the xview libraries for this to compile properly. For sound and joystick control, you will also need a couple of additional libraries available off the web site, but these are not necessary for the program to work:

tar -xzvf SearchAndRescue0.7b.tgz
cd SearchAndRescue0.7b/sar
make -f Makefile.Linux
make install

The default installation directory for the binary is /usr/games. To start Search and Rescue, simply type the following (note the capitalization):

/usr/games/SearchAndRescue
While offering a very realistic view, I found that Search and Rescue was quite playable without video acceleration.

Figure 2. My Sikorsky Readies for Takeoff at LA International Airport

Once you have mastered all aspects of the sky, only the stars are beyond your reach. Or are they? It is true that we may not have access to the universe in the next week or so. François is still working out the bugs in the faster-than-light travel program he is developing. Relax François. It is just a little joke, non? Nevertheless, you can still experience the thrill of interstellar flight (and combat) with one of the single most addictive games on your Linux system—one you may not even be aware you have.

It is called XPilot, and if it is not already on your machine, check your distribution CD. If that still fails, head on over to http://www.xpilot.org/ and download your own copy. You might also want to have a look at the XPilot Newbie manual on that site. But before we go on I feel I must caution that, like wine, you should take XPilot in moderation.

That said, it is time to play. To find a list of servers that you can join, Telnet to this address:

telnet meta.xpilot.org 4401

Note the port number at the end (4401). You might want to direct this output to a file (telnet meta.xpilot.org 4401 > xpilot.servers) because there will be a lot of information scrolling past your screen. By doing a Telnet to port 4402, you can get the latest FAQ on the game. A Telnet to port 4400 puts you into interactive mode with the server. From there, you can type HELP, or LIST or even FAQ. Here's a sample from that server list:

4.2.1 :marach.dd.chalmers.se  :15345 :3 :26d
4.2.1  :tigger.skaro.bt.co.uk :15345 :1 :0.03 :The Globe
The first part is the version number, followed by the hostname, port number, number of users, server uptime and map name. That's right, mes amis, these games are live, played in real time (so to speak) with others from around the world. Even better, those who might feel left out because they do not yet have that high-speed 3-D graphics card, do not worry. If you have X running on your system, you can play XPilot and pit your skills against the best star pilots the world has to offer. Let's pick “Tourmination” (since there are already three players active) and join that game. To do this, I type the command:
xpilot -name francois -join marach.dd.chalmers.se
The -name option is a nickname I pick for myself for the duration of the game (which lasts only moments because some slimy person blasts my fighter into space dust). As you may imagine, many options can be set. Type xpilot -help for a sample. Then, have a look at Figure 3 to see a picture of my short-lived battle in space.

Figure 3. Marcel's Ship Is Blasted to Space Dust in XPilot

Oui, François? Mon Dieu! Is it that time already? Before you go mes amis, let me give you one other little additional flying treat. You probably all know about the xscreensaver package with its fireworks displays, dancing lines, cool fractal effects and, most importantly, the warp journey through space dodging rocks as your screen rotates this way and that. The package is probably already installed on your system. If you do not have it, check your distribution CD-ROM or look in the Resources section. Good. Now, look around the house and dig up those old 3-D glasses. You know, the ones with one blue lens and one red lens. Now, put on the 3-D glasses, fasten your seat belts, and type the following command:

/usr/X11R6/lib/xscreensaver/rocks -3d

It is just like being there, non? You may not know this, but you can execute all these programs individually (as with our rocks) without having to wait for your screen saver to kick in. That is it for now, mes amis. François, please be so kind as to pour our friends a final glass of wine before they go. And you, mes amis, must admit that it is fun to have an operating system that really flies; now you can fly with it, too. A little joke, but not very good, non? François, mon ami, better fill my glass too.

Until next time, please join us here at Chez Marcel. Your table will be waiting.

A votre santé! Bon appétit!

Resources

Marcel Gagné lives in Mississauga, Ontario. In real life, he is president of Salmar Consulting Inc., a systems integration and network consulting firm. He is also a pilot, writes science fiction and fantasy, and is coeditor of TransVersions, a science fiction, fantasy and horror anthology. He loves Linux and all flavors of UNIX and will even admit it in public. In fact, he is currently working on Linux System Administration: A User's Guide, coming soon from Addison Wesley Longman. He can be reached via e-mail at mggagne@salmar.com. You can discover lots of other things from his web site at http://www.salmar.com/marcel/.