GraphOn site: http://www.graphon.com/
Technology patent: www.graphon.com/News/pr.patent.html
LJ piece on Graphon in China: http://www.linuxjournal.com/articles/briefs/031.html
Have you ever heard six-year-olds reminisce about having been five? I confess I am guilty of this sort of thing, feeling nostalgic for computer games that were state-of-the-art just a few years back. Old is not necessarily bad. Modern software is technically impressive, but how useful is it? Still, I have yet to find a computer game that rivals chess in excitement, or Go in elegance and subtlety, while both games are at least 1,500 years older than computers. You'd think 3-D shooters would bore people to death, or maybe we could do something more creative with the amazing virtual-reality techniques we've got. Anyway, Linux remakes of classic games are cultural oddities; I hope some anthropologist catalogs them. In keeping with the theme of “Linux on the Desktop”, here are some games you can play on your desktop!
Linux gamers tend to have a soft spot in their hearts for the disturbingly popular blast-Bill-Gates-to-pieces games, the family of games in which Bill Kendrick's Defendguin is the newest member. Yes, it's the classic Defender game, only the graphics aren't hollow line drawings. The trick is to save the Penguinoids from being mutated by little flying Gates saucers. In honor of the new journalistic tradition of pulling random quotes and holding them up as though they represent the entire community, here's a stellar line from Digital Ebola on http://happypenguin.org/: “It's quite satisfying to blow Bill Gates up. That alone makes anything worth 5 stars.” Check it out at http://www.newbreedsoftware.com/defendguin/.
Beetle enthusiast Holger Priebs has delivered the goods for Q*Bert addicts. Black Penguin (“rotund” would be more accurate, and anyway, it's a blue penguin) is a fellow who hops around collecting happy things while avoiding his opponent, the Evil Window. It uses Qt, the sources are well-commented, and it's a good game for Linux newbies to get used to compiling software from the source as well as learn from the source. I should warn you that Qt is not LGPL, but I imagine you've already heard. The home page lives at www.priebs.de/blackpenguin.html.
Fleuch, a Linux remake of Thrust from the C64, comes to us by way of Karsten Goetze. It's available only as a binary for SVGAlib, but maybe we can convince Karsten to open up the source if it turns out the game is popular enough. Pilot a ship by turning and thrusting, pick up a ball, and fly away. According to an anonymous quote from happypenguin, Fleuch “is unmatched in supremacy”. It can be found at http://start.cgirealm.com/meuch/.
“The greatest game... we've ever made” reads the Insane Odyssey Episode I Trailer. Aaron P. Matthews (coding) and Seth B. Peelle (music and graphics) of Rival Entertainment team up to bring you this futuristic escape from a mental hospital. The scrolling is smooth, the graphics are outstanding, and the game play is fun. It's a cohesive, polished production, one of the nicer-looking Linux games out there. While it's not a remake of a classic per se, it is a remake of a game the author started years ago and didn't finish. With so many 3-D shooters, don't you miss a good platformer? Find this game at http://rival.clan.net/.
Last episode, we got a scrolltext going in SVGAlib, which looked pretty cool. Pair it with some Beethoven and an artsy, scribbled logo, and you've got a happening intro for your next act of brilliance. Ah, but how do we get the music playing? Well, assuming Beethoven is what you want and not some frantic dance pop, we've got to figure out a way to get music into the program.
Years ago, this was tricky. We had to program in assembly code and call a play routine every vertical blank. Before that, pitched beeps had to be carefully inserted into the program, and any deviance from the loop would cause the whole program and/or the music to change speed. Fortunately, today we have multi-tasking machines, so we don't have to bother with anything difficult; we just fork a process or call a library routine. Now the question is, what do we want to do? How to do it is easy.
For music in a Linux program, there are several options. One is to use the sound card's built-in midi synthesizer, which is extremely resource minimal. Xavier XOSXE uses this approach in his excellent, high-resolution escapade SpaceBoom, reserving digital audio exclusively for sound effects. This way, the CPU's resources are left over for the horizontal scrolling landscape and trigger-happy space aliens. Playing midi music is very simple; all you have to do is fork to the program playmidi. And no, it's not cheating—fork is an integral part of the UNIX model. Consider that by using it, you pay homage to the same function that got us past the first init routine. Listing 1 is simple code for starting up your tune.
Just keep tabs on the process ID (PID) so you can kill the playmidi program when you want to change tunes, or when the game is finished. (The SpaceBoom source code, albeit C++, has a more elegant example of how to do this.) With on-board synthesizers improving dramatically, midi files are really a viable option for music. They're easy to create, resource-minimal to play, have small footprints, and are fun.
Another option is to use the time-tested, scene-approved, MODs! From their birth on the Amiga, these things just won't die. MODs are digital audio music files, which basically include audio samples of the instruments, loop points and note data (newer formats include more instrument parameters).
The advantage of MODs is they are digital audio, so you get sample playback, as opposed to midi files which use preset instruments on the sound card; MODs give you more flexibility. The downside is that your CPU needs to dump a lot of data to /dev/dsp, so MODs are resource intensive. For example, at 44,100Hz of 16-bit stereo (CD quality), you'll be writing 16 bits of data to each channel 44,100 times every second—that's 176,400 bytes of writing to /dev/dsp every second, not to mention the calculations that go on within the mod-playing routine (volume, mixing, effects, pitch slides, etc.).
These days, processors are incredibly fast, so MODs are more practical than they used to be, but sound cards have better synths than ever before. Wouldn't you like extra CPU for more intensive graphics? While I definitely opt for midi, most people prefer MODs. If you're making a game on CD-ROM, just record a whole album. Maybe when we all have supercomputers, we can use mpegs in real time. You can choose between MikMod and Midas for MOD playing; MikMod is GPL while Midas is not quite, so in the spirit of GNU, let's try out MikMod. Listing 2 is code for starting and stopping a MOD with mikmod.h.
Next month, we'll finish up on sound for now and take a look at how to use generic digital audio for sound effects.
Listings are available by anonymous download in the file ftp.linuxjournal.com/pub/lj/listings/issue70/3798.tgz.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- Non-Linux FOSS: Code Your Way To Victory!
- Vagrant Simplified
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Libreboot on an X60, Part I: the Setup
- Dealing with Boundary Issues
- System Status as SMS Text Messages
- Bluetooth Hacks
- New Products
- October 2015 Issue of Linux Journal: Raspberry Pi
- Linux and the Internet of Things