Battles inside the Computer
What do you mean, “Who is inside the computer?” No one is inside the computer, François. Ah, I see. I think you misunderstand the concept of this month's focus, “Kernel Internals”. Why, the whole notion of there being anything other than bits and bytes floating in the Linux kernel is pure science fiction, mon ami. Qu'est-ce que tu dis? No, of course not. Inside the computer isn't a real place, at least not in this world. Still...
Quoi? Sorry, mon ami. I was just remembering a movie from years ago, where there really was an “inside” the computer, and programs fought for their users against the MCP, the master control program. François, what are you looking at?
Ah, mes amis. Welcome to Chez Marcel, home of fine Linux fare and excellent wine. Please sit and I will have François fetch the wine. We have some incredible French Canadian tourtière to serve tonight as well. François, run to the cellar and fetch the wine. The 1997 Napa Valley Cabernet Sauvignon is drinking exceptionally well.
It is good to see you, mes amis. François had this strange notion that kernel internals implied something was going on inside his Linux system that involved real people. That made me think of the 1982 Disney film called Tron. Inside the computer, programs are engaged in gladiatorial battles, fighting for their users. One of the deadly sports in this virtual world was a lightcycle race. Contestants rode a kind of motorcycle that left a wall of light in its wake. The cycles themselves can't stop. The only thing you can do is ride, avoiding your opponents' walls while trying to get them to crash into yours. The last program standing wins.
François, you have returned. Please pour for our guests, then head back to the kitchen for that tourtière. As I was saying, mes amis, as dated as Tron appears in today's world, the lightcycle battle was the inspiration for various arcade games based on the simple concept of an ever-growing light trail that must be avoided at all costs. That inspiration continues today and is represented in several open-source projects.
Let's start with a lightcycle game you already may have on your system. As part of the KDE games package, you'll find Matthias Kiefer's KTron, a simple but highly functional lightcycle game. You'll find it in your K menu under arcade games, and the command name is ktron. When the game starts, you'll see two squares near the center of the screen, one red and one blue. To play, press either your left or right cursor and the race begins instantly (Figure 1).
In order to change game play, click Settings on the menubar and several modifications are at your disposal. For instance, if the game is a little fast for you, tone down the velocity. Or, speed it up if you are falling asleep at the lightcycle's wheel. You also can change the size of the cycle's trail or modify the default colors.
This little game is actually a lot of fun, particularly if you change the size of the arena, but really to get the feel of a lightcycle battle, you must enter the three-dimensional world. That, mes amis, is how you get into the computer. You will need a 3-D accelerated video card and OpenGL or Mesa 3-D video libraries.
As far as the card itself is concerned, many are extremely well supported under Linux. Unfortunately, even when the card is supported, the manufacturer of the card may not license the accelerated driver for inclusion with the Linux distributions themselves. That doesn't mean they aren't available, but you may have to visit the vendor's site and download them. With some cards, full 3-D acceleration is directly supported under XFree86. So, how can you tell if you are ready to go? A quick way to test for the presence of 3-D support is with the following command:
glxinfo | grep rendering
The system should respond with this:
direct rendering: YesAnother fun little test you can perform involves running a program called gears (part of the Mesa-demos package). To do this, simply type the command gears at a shell prompt. Your hard work will be rewarded with three gears spinning on your screen (Figure 2).
Do not get too distracted by the spinning gears. Have another sip of your wine, then look back at your terminal window. You will see some statistics regarding the performance of your 3-D hardware:
1778 frames in 5.001 seconds = 355.529 FPS
That result comes from my test system, which has an NVIDIA GeForce2 card. This is actually a reasonably impressive hardware performance. In contrast, my little notebook, which suffers from a complete lack of accelerated hardware, yields this result:
312 frames in 5.004 seconds = 62.350 FPSNot having acceleration for your card doesn't stop the program from working; it simply will run very, very slowly. Now that we've got that out of the way, mes amis, let us return to the world of lightcycles in the third dimension with Manuel Moos' Armagetron (armagetron.sourceforge.net). As Manuel's home page suggests, think Armageddon with a “tr” instead of that double “d”. Precompiled binaries were easy to find, and the source, of course, is there as well.
The first time I tried the game, I immediately crashed into the wall. This was my experience the first three times or so, until I realized that perhaps I needed to configure my keys for steering. Navigate the menus to Player settings (whichever player number you happen to be), then change the Input Configuration. Cursor down to turn left and press Enter. You'll be asked to press the key you wish to use for a left turn. I know it sounds crazy, but I chose the left cursor key. Repeat the process for the right turn and anything else you may wish to use in combat, such as instant chat phrases so you can taunt other players with a single keystroke. Exit that menu, then the one before it until you return to the main menu.
Now, from the Game menu, select Start Game. Armagetron is a great lightcycle game with an omnipresent overhead camera that follows your moves and provides some dizzying perspective changes on those instant, 90-degree turns (Figure 3). Armagetron also is network playable with up to 16 computers, each running four players.
Armagetron is wonderfully addictive and, as a result, comes with an absolutely essential feature: a Boss key. In other words, if you happen to be playing a game of Armagetron over the network and the boss approaches, press Shift-Esc, and the game ends and vanishes instantly.
Armagetron is great, but for something approaching photo-realism, we have Andreas Umbach's GLTron. As you might expect, mes amis, this realism comes at a price in terms of hardware and performance, but if you have the machine, you will not be disappointed. You should have no problem finding precompiled binaries (RPMs are available on rpmfind.net), but the source is always available. You can pick it up at www.gltron.org.
GLTron is fast-paced (assuming proper 3-D hardware) with impressive graphics and a play mode that is sure to raise your heart rate.
There are three main configuration menus for GLTron (game, video and audio), and some of these make it possible to change the game experience dramatically. For instance, you can run GLTron in full-screen mode as well as windowed. Artpacks also are included in the package so you can alter the look and feel. My favorite is still the default (Figure 4), but I am somewhat fond of the Metaltron artpack.
What I like most about GLTron is the ability to pan with the mouse to create almost any camera view. Press the spacebar to pause the game, then tilt or rotate your point of view. If you really want to hone your skills in this 3-D world, try changing your point of view relative to the arena and restart the race. Controlling your lightcycle from the side is an altogether different experience than it is from above or behind. Try pressing F10 to change the camera angle and tracking. I find the behind-camera viewpoint particularly interesting. It changes your view so that you seem to be riding in the lightcycle itself—very heady.
By default, a small 2-D map floats above the screen. If you feel particularly cocky, try turning the map off.
In many ways, GLTron is the most polished of the three games mentioned here, but it doesn't have the network play of Armagetron. On the other hand, as simple as KTron is, you can play it on any system—accelerated hardware is not necessary.
So, mes amis, as you can see, all your workstations are set up with the three games as well as being fully networked. Perhaps you would like another glass of wine before entering the arena? Or maybe an espresso? François will be happy to provide you with either.
Mon Dieu, has the time passed so quickly? As I cannot connect to your systems and pour you a glass of wine, I must attend to it here before François and I close the restaurant for the night. François, would you be so kind as to refill our guests' glasses a final time? Until next time, mes amis, let us all drink to one another's health. A votre santé! Bon appétit!
Win an iPhone 6
Enter to Win
|Microsoft and Linux: True Romance or Toxic Love?||Nov 25, 2015|
|Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.||Nov 24, 2015|
|Cipher Security: How to harden TLS and SSH||Nov 23, 2015|
|Web Stores Held Hostage||Nov 19, 2015|
|diff -u: What's New in Kernel Development||Nov 17, 2015|
|Recipy for Science||Nov 16, 2015|
- Microsoft and Linux: True Romance or Toxic Love?
- Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.
- Cipher Security: How to harden TLS and SSH
- Web Stores Held Hostage
- PuppetLabs Introduces Application Orchestration
- Simple Photo Editing, Linux Edition!
- Firefox's New Feature for Tighter Security
- diff -u: What's New in Kernel Development
- November 2015 Issue of Linux Journal: System Administration
- It's a Bird. It's Another Bird!