Sponsored By

Allegro Inspires A New Generation of Independent Developers

Allegro, a game development library that's now over five years old, has established itself as one of the most popular Open Source tools for independent developers. Damon Brown talks with Allegro's creator and explores the community that supports the library.

Damon Brown, Blogger

October 26, 1999

16 Min Read

In five years, Allegro, an open source game programming library, has grown from a few basic 320x200 VGA routines to a robust collection of functions created from over 100 contributors. Allegro is a library that solo or independent game developers can use to focus their limited resources on game design -- not research and development. For larger, more experienced developers, Allegro creates a stable game foundation from which to build an engine.

It is now estimated that Allegro's users number in the thousands. It also has been used in non-game products, from web browsers (Caldera’s Embrowser, for instance), to the graphics software controller in an arcade pinball machine, to the latest version of the highly popular MAME arcade game emulator. Additionally, there are several web pages dedicated to Allegro, making information on the library easily accessible.

In the Beginning…

In late 1994, programmer Shawn Hargreaves had a vision. He envisioned a free, open source game library, which would make game programming and development easier for everyone. The barriers of game development would fall. And it would be good.

Okay, so maybe it wasn’t that dramatic.

Hargreaves created the library using DJGPP for the simple reason that he wanted to make games, and he wanted to save some cash. Hargreaves recalls wryly that, "I was a poor student, and having just splashed out on a second-hand 486, I didn’t have any cash left for essentials like software."

DJGPP, because it was a good (and free) C/C++ compiler, became Hargreaves' platform. This twist of fate contributed to the later success of Allegro. As Hargreaves notes, "There were already plenty of libraries available for the commercial compilers, and I don’t think anyone using them would have given Allegro a second glance. The DJGPP system was still very new, though, and a lot of people were in the process of switching over to it and looking around for a decent support library. A large potential market plus no competition equals good timing…"

Thus began Allegro, technically. Hargreaves made a few short VGA routines, threw them on the Internet, and went on with his life. The limited library did what he needed, and Hargreaves considered it done. A year later, however, a casual Allegro update changed the fate of his library. Hargreaves recalls that, "The big turning point came when I added some SVGA code, initially just because I was curious to see how it worked. It turned out that a lot of people were looking for something exactly like this, so all of a sudden I had hundreds of users, and things just grew from there. I later added a sound player, true color graphics modes, and most recently porting to several platforms."

Allegro has been an open source project, but it wasn't always intended as such. Originally, users made bug fixes, particularly regarding hardware Hargreaves didn’t have. This expanded to people sending in functions to become part of the library.

Hargreaves believes that Allegro wouldn’t have made it any other way. Indeed, as he puts it, "If Allegro wasn’t open source, it would have ground to a halt after I left the university and started working full-time. I simply don’t have all that many hours to put into it anymore, so it needs other people to make things go on improving."

The Current State

Allegro currently is in version 3.9x, with 4.0 to come soon. A far cry from its DJGPP DOS days, it is currently compatible with DJGPP, Watcom, MSVC, and Linux. X-Windows and BeOS compatibility are being worked on as of this writing. There are also well over one hundred functions within the Allegro library, ranging from basic drawing functions to sound/MIDI functions. It supports multiple resolutions, ranging from unusual 80 x 80 to standard Mode 13 to a whopping 32-bit 1600 x 1200 (assuming the graphics card supports it). Various VESA modes are supported as well. Different sprite types are supported, such as compiled and RLE. There are multiple ways to display a sprite, including masked, transparent, and gourand. Other blitting techniques include rotation and scaling, as well as standard sprite axis flipping. All the standard drawing primitives are also supported. On the other end of the scale, many polygon functions are supported (including texture mapping and gourand shading), as well as splines. All input is fully supported, minus force feedback (which may change by this writing). It also includes a full-fledged GUI designer, which allows pseudo-Visual Basic game setups.

Allegro supports various media as well. It has strong audio support for MIDI, digital samples, and audio streams. FLIC routines are also included. Regarding data, multi-object data files can be stored and accessed through an included grabber utility. The grabber is a self-contained program which, via a GUI system, allows the user to organize and preview the contents of the datafile. Any necessary files, ranging from text files to palettes, can be stored within one data file. This not only organizes the files neatly for game distribution, but also allows for easier management of data. The datafile can be easily accessed from within the game code through the file.

The Allegro package also provides plenty of support. Since it is open source, all of the library code is accessible, modifiable, and changeable at a whim. This makes Allegro less of a starter package, and more of a really flexible collection of user-definable functions. Furthermore, there is extensive documentation, in Word and HTML form, that goes over the Allegro functions. Over 40 examples of different routines are also included. Coded by contributors to Allegro, these examples range from the basic (keyboard input) to the relatively complex (3D world development).

Additionally, the package includes the capability to perform a number of system tests, mostly created by Hargreaves himself. These test MIDI and sound support, math processor capabilities, and more. One test in particular profiles the capabilities of the graphics card. These tests include resolution, color, and MMX support. Also included are timed tests that show the processing speed of graphic computations, from masked blitting to textured polygons per second.

Hargreaves also saw fit to code and include an Asteroids variant. With source code included, the game shows the graphic capabilities of Allegro, including some limited polygon handling and shading.

Who's Using It?

"Most of the code will work unchanged on any operating system you care to mention, and the strength of being a nice, flexible and easily understood API remains a strength wherever you are running it," Hargreaves says, underlining one of the main strengths of the Allegro library.

Kenny Thornton, developer of the popular freeware RPG Fenix Blade, whole-heartedly agrees. He transferred his Moebius game engine from Turbo C++ 3.0 to DJGPP and Allegro a couple of years ago after examining Allegro closely.

"After looking through the source and seeing how organized it was, I decided it would be fruitful to rip out the guts and stick my old Moebius library functions in. The procedure went flawlessly, aside from a few minor linking errors and stuff, and I ditched my keyboard and gamepad handlers for their Allegro counterparts, since they worked just as well." This is a common case; indeed, teams often end up scrapping their own routines for the easier to use Allegro.

The Open Source Multi-Arcade Machine Emulator (MAME), which emulates over 1,500 games on various computer platforms, also started using Allegro within the last year. The team successfully ditched the original routines from its initial 1997 release. "Allegro is used in a lot of emulators software, such as MAME. I’ve wasted a lot of hours on that," Hargreaves told us.

Allegro has also become the choice of developers who want to concentrate on things other than screen setting and memory management. For some developers, Allegro is beyond practical. Arne Strout, head of the Megaman 21xx project, states that the development would be much more time consuming without Allegro. "(We might have been able to work without Allegro), maybe after another extra year to develop a suitable graphics library. Graphics libraries are the life of the game," says Strout.

Ulfr Fenris, creator of the popular shooter Halflight, isn’t offended by Allegro’s straightforward and smooth interface. According to the experienced programmer, he just has a higher appreciation of Allegro because he understands the work it is doing. "For someone who has worked on his own VESA driver, I understand just how much murder it can be to get a routine to work on several dozen different main chipsets and implementations of the VESA standard. Being able to call set_gfx_mode and leave it to that is very nice." This straightforwardness made starting with Allegro a breeze, he said.

"It was very easy [to adjust]. Allegro is logical and easy to use, especially if you are an experienced programmer," says Fenris. He further explained that, "I could write my games without Allegro – I had been doing it for years before I was introduced to it – but I am more concerned about game design and implementation, and spending all my time working on blitters or sound routines isn’t very practical for a single-man programming team. Allegro allows me to start coding a game idea immediately, and I can leave the gory details to those who have done more research and have more experience with that manner of low-level hardware access."

George Foot, who helped restructure Allegro for Linux compatibility, also was first attracted to the library because of its ease of use. "(Initially), I was feeling lazy and wanted something that I could start using as quickly as possible. That was the initial attraction of Allegro. It seemed hassle-free, and provided plenty of examples and reasonable documentation." Foot continued, stating that, "In the longer run, I’ve stuck with it because it always seemed easy to modify and fairly easy to find out what function does what from the source code, if not the documentation. (It also) is flexible enough so that you can use only the parts you want to use, and do the rest yourself. Or even just take the code you want."

Strout says that Allegro actually changed the way he looked at game programming. "The datafile structure supplies tons of information on each image you store, and allows you to load tons of sprites in a single command, not to mention referencing them by easy identifiers. It’s revolutionized the way I think about programming games." Strout continued, telling us that, "Really it was just what I’d wanted and hoped for. I was absolutely amazed by its functionality and as I learned new tricks with it, I was further amazed."

It Takes A Village...

There are three major mailing lists for Allegro users available at the Allegro homepage. There are also countless discussion boards across the net. Documentation and support, perhaps because of the open source policy, is plentiful for Allegro. Tutorials from users are common, with topics ranging from real-time lighting to an online Allegro hacker’s guide.

User-created library functions include a port of Michael Abrash’s Z-sorting edge-spanning polygon rendering code, an MPEG decoder, and an FLIC player. There are many utilities available as well, including quite a few sprite and tile editors.

The Allegro games themselves have created quite a following. Allegro now has a webring with over 160 sites, with quite a few dedicated exclusively to Allegro-developed titles. There is also the Allegro Game Reviews Index, which has a small stable of reviewed games.

Then there is the Allegro Game Depot, which boasts well over 200 games. Allegro users become members by contacting the webmaster and having their game evaluated. After becoming a member, the user can upload and update their Allegro games on the site. There are clear-cut categories and a search engine on the web site.

Matthew Leverton, webmaster of the Allegro Games Depot, thinks the reasons for Allegro’s popularity is pretty straightforward. "It is extremely powerful, it is extremely easy to use, it is extremely easy to port, and it is extremely cheap (free). As long as Allegro remains the above, it will be popular." Leverton seems to be banking on its popularity. Though just a depot right now, he plans on adding a multi-topic message board, adding more staff members and providing ratings and reviews for the games. He has other Allegro plans as well. "I will also be releasing a totally new website (unrelated to the AGD) geared towards the Allegro Community that I hope will become a center of information for Allegro developers and game players," Leverton tells us.

Another Allegro group is the Allegro games competition known as The Golden Keyboard. No, first prize isn’t a golden keyboard, but this does give Allegro users an opportunity to compete. "The purpose of the AGC is to encourage people to produce professional games and produce finished code under a deadline. I thought that if some motivational event was run, it might encourage people," says AGC organizer Arron Shutt. The Allegro competition gives small game developers (mostly solo) a forum to showcase their work, and to get involved in a healthy competition. A panel of judges, including Hargreaves himself, annually goes over the software and selects the best in a handful of categories. Looking towards the future, Shutt doesn’t plan on Allegro going anywhere. He is currently ironing out the speed competition, in which the contestants are given a game assignment on Friday night and are given until midnight Sunday to make the best game possible. He also plans on looking for commercial sponsorship, since he finances the annual contest by himself. The importance of small competitions should not be overlooked, says Shutt. "Finishing code is important. If I was employing a prospective games programmer, I would be interested in his ability to produce good code as well as in his qualifications. If someone is motivated enough to develop a finished game for the AGC, that is one more project they can add to their portfolio."

Overall, Allegro is the common thread that allows these different developers and programmers to connect, which in other circumstances they probably would not. The community element, Shutt says, is the main strength of Allegro. "The best part of the whole Allegro experience is people. You tend to avoid a lot of the ego-charged people and just get the ones who are out to help, or eager to learn."

The Future of Allegro

The main goal from Allegro 3.0 to 4.0, according to the Allegro programmers, has been portability. The different ports of Allegro are being combined into one big "super-library". "The aim is to make it very simple to write programs that will compile on any of these platforms with only minor modifications, if any, and it's progressing very well indeed. I think this will make it very attractive for people wanting to write multi-platform games," says Foot. Hargreaves states that, "Most of the code will work unchanged on any OS you care to mention, and the strength of being a nice flexible and easily understood API remains a strength wherever you are running it."

What about after 4.0? As the saying goes, yesterday is history and tomorrow is a mystery. "Over the next few months we’ll be finishing up the porting work and releasing version 4.0. After that, I have absolutely no idea. Peering around corners never works very well, so I’ll wait until we get there to see what there is to be seen," Hargreaves revealed.

Hargreaves plans to stay as head of the Allegro project as long as he enjoys it, which he said isn’t going to change anytime soon. He would, however, like to distribute the power in the Allegro project, since Allegro isn’t his only job. Hargreaves’ day job is lead programmer for Probe Entertainment, an Acclaim Entertainment subsidiary. He’s currently working with OpenGL on a hush-hush project that will eventually be made for Sony’s Playstation 2 and Nintendo’s new Dolphin console. He enjoys both Allegro and working at Probe, but admits it is a lot to juggle. "There are periods every now and then when I just don’t have time to be involved, and in the past Allegro development has completely ground to a halt when this happens." Hargreaves elaborated that, "I’m trying to work things out so this won’t be a problem in the future, so I can delegate control to someone else for a while. It remains to be seen how practical this will be, and if there is anyone else who would even want to do that (smile)."

With the glory comes duty. Emails and updates take up hours of his time, especially with the project being open source. According to Hargreaves, it is a rewarding job, but not an easy one. As he wistfully told us, "Now, if only someone would pay me to develop Allegro as a full time job…"

Impact on Independent Game Development

The success of Allegro shows the possible resurgence of independent game development. Allegro, like the popularity of Gameboy development or Game Developer Magazine’s own Independent Games Festival, recognizes garage game developers and basically says "Hey, you count, too." Small game developers outfits don’t need to license an engine or make a cookie-cutter product, because they don’t spend any money to make the game and they don’t need a return on investment from the players, except perhaps a pat on the back.

John Carmack isn’t losing any sleep over this, but people - not super programmers, just ordinary people - can now turn their concept into a game with intermediate programming skills. The game community can look forward alternative titles that sport a more polished look, using the Allegro library.

The concept of game development products for non-super programmers isn’t new, from the ancient Electronic Arts’ C64 game creation kit (to create "cut and paste" shooters) to the recent Sony Net Yaroze program (which allowed Playstation games to be made with C).

What is new is giving full access to the code, which allows game developers to learn, modify, and hopefully contribute to the Allegro library. Alternatively, game developers don’t have to look at any library code. In short, things are as complex or as superficial as the developer wishes, making the library good for both novices and experts.

As articulated by Hargreaves, "I’m a programmer. If something comes sealed in a box, all I can do is use it, and I’m not terribly interested in that. A programmer without source code is like a mechanic who can’t get the hood open: no use to anyone."

Amen to that.

Damon Brown started programming on his VIC 20 at age eight while winning his first award for writing: The Calbery Award. He is currently at Northwestern University studying for his Masters in Magazine Publishing. His hobbies include solo freeware game development, occult studies and deejaying. E-mail him at [email protected], or check out his website at www.geocities.com/SiliconValley/Pines/6547/.

Read more about:

Features

About the Author(s)

Damon Brown

Blogger

>Damon Brown has been a contributor to Gamasutra since he covered the First IGF and interviewed Shigeru Miyamoto at the 1999 GDC. He likes the fact that when he spends hours playing games he can call it "research and reporting." An avid supporter of independent game development, he creates PC computer games when he isn’t writing about them. Damon received his Masters in Magazine Publishing at Northwestern University in August 2000 and currently works as a freelance writer in Chicago. He can be reached at [email protected] or, better yet, visit his website.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like