Introduction
Designing and programming games is anything but easy. One needs to understand the game logic (algorithm) and the graphics manipulation techniques, the core of the game, and good planning and synchronization between these, to design a game. And I don’t think anyone would debate the fact the graphics alone makes a huge impact on games. That means the core logic needs priority and concentration than the eye candy graphics.
To begin programming the games and their graphics we need to have the basic concepts of game programming clear, as well as a good graphics and I/O tool which does not drag a beginner into the complex world of syntaxes, datastructres, procedures, complex internals, etc. Thus, I’m sure everyone agrees that starting with OpenGL or DirectX programming becomes quite a job for beginners. So game making needs very good management and planning at first, then it needs coding knowledge, and a good programming tool or API is needed to complete the task smoothly. Selecting an API is very important, it should be simple and is usable and also powerful at the same time which will let you spend more time on the planning the game and code the techniques. Now all the properties are difficult to find.
In this article we will introduce you with a 2D and 3D game and graphics library called Allegro, primarily to be used with C Programming Language, which brings you a great platform to start game programming. Though you still will need to know the basic techniques and algorithms to design the core, but Allegro is a great API which takes a good care of the graphics, sound, I/O and all the other components. So you can do the core design with more concentration, and then create the multimedia components, and the I/O using Allegro with great simplicity. Allegro does this by hiding the complex internals with its simple abstract datastructres and similarly simple routines. And all this is not only for beginners, but this library also has the power inside for advanced and professional-level programming. Read the whole article to know about Allegro in details and jump start into allegro programming
From the history books
Allegro used to stand for Atari Low-LEvel Game ROutines when it was written written from scrap in C for the 1985’s personal computer platform Atari ST by Shawn Hargreaves. However, since over time the Atari ST platform was discontinued thus development of Allegro also stopped, only to resurrect again in 1995 with Borland C++ and DJGPP compilers. When the development again stalled with Hergreaves getting more involved in other important work of his own, interested people came forward and kept the project going.
Allegro now stands for Allegro Low LEvel Game ROutines, a recursive acronym and the graphics and game library is primarily to be used with C and C++ languages. It indeed is a free software, however, the project, headquartered at alleg.sourceforge.net, likes to called it ‘giftware’ that gives you the right to use, modify, redistribute, and generally hack about in any way you like, and you do not have to give us [the developer community] anything in return.
The latest “work-in-progress” (unstable) release of Allegro is version 4.9.10.1 Released on May 4, 2009, this will go on to become version 5 through updates. In this article we will be discussing Allegro 4.2.2.
What’s in it
Graphics
To design a game different, sets of routines are needed that cover different fields of the design-graphics being one of them, and probably the most important field. 2D graphics is covered very well in Allegro with basic graphics routines like pixel, line, circle, arc, rectangle, triangle, z-buffered polygon, bezier spline, flood fill, etc, along with their different variations that brings in flexibility and ease. Its distinctive feature is Allegro has callback functions for basic shapes, which let you draw it abstractly.
Loading image formats like BMP, TGA, PCX, LBM are natively supported. Other formats can be loaded after suitable plug-ins are install. PNG and JPEG support were added in v4.3.10. The loaded images can be resized and effects like lighting, and blending can also be added. Also supported are things like blitting, direct draw to screen or bitmap, and clipping.
A separate set of sprite handling routines allow you to include bitmap sprites and manipulate them (pivot, flip, rotate, scale, stretch, etc). Support of transparent and animated sprites packs more power in sprite programming. Support of Run-length-encoded (RLE) sprite and compiled sprite lets you balance the performance and size of the game. Reduction, alpha blending, gouraud shading of sprites and bitmaps allow you to add more effects. Allegro also lets you directly access the video memory.
3D graphics routines of Allegro enables you to draw basic 3D polygons and render them with MMX or 3DNow! extensions. Although Allegro 4.2.2 doesn’t offer much variety and gives no hardware acceleration with its 3D graphics routines but they can be implemented along with proper mathematical manipulations to make some 3D graphics. This drawback is filled by the AllegroGL library which enables you to make OpenGL-rendered graphics with a separate set of AllegroGL’s 3D routines to use with OpenGL coordinates. Double/triple buffering, scene rendering, hardware scrolling, mode-X split screen are also supported by Allegro natively. From Allegro 4.3.x release, AllegroGL is a part of Allegro development, and will also be an integrated part of Allegro5. In the latest versions there is no different Allegro and AllegroGL.
Realistic games need a “physics engine” which drives the different game objects obeying physical laws. Sounds cool, but they are actually mathematical manipulations done as per different physical laws to the proper graphic elements, which develops the need for graphic-oriented math routine. The real headache is to write these routines efficiently. Allegro comes with the medicine of this headache with its own math routines containing fixed-point trigonometric and algebraic functions, 3D math routines that has almost all required matrix and vector operations, and manipulation routines and quaternion math routines, for easier rotations and accurate interpolations.
Allegro supports 32bpp (over 16 million) colours, as well as lower depths (8, 15, 16, 24bpp) with a gasping 1600×1200 resolution. Conversion between RGB and HSV colour formats is also supported. Transparency effects, patterns drawing and alpha, colour, burn and many different blend effects, and palettes can also be used.
Obviously Allegro can benefit from the graphics driver that’s installed.
There are various graphics drivers which are supported by Allegro:
- X Window, DGA, fbcon, SVGAlib,VBE/AF,mode-X,VGA drivers under UNIX
- GDI, DirectX with fullscreen under Windows
- Quartz under MaxOS X
- BwindowScreen, BDirectWindow under BeOS
- VGA 13h mode , mode-X ,SVGA upto 32bpp under DOS
In the currect unstable releases, that will eventually become Allegro 5.0, AllegroGL has been included in addition to an OpenGL and Direct3D driver. The FreeBE/AF project at www.talula.demon.co.uk/freebe is a free implementation of accelerated VBE/AF drivers, which adds portable 2D hardware acceleration under a number of cards.
Sound
But, a game is not only about the graphics, the sound needs to be equally good. Similar, to graphics the sound detection in Allegro is automatic, and it can work with your currently installed sound driver. Digital sample routines natively support VOC and WAV file formats to be loaded and played directly (OGG support has been added in v4.3.10), and add basic effects like echo, frequency up/down, volume up/down, vibrato, pan, sweep, etc. Additional sound libraries let you load other file formats. Allegro can play MIDI files and lets you control the notes, panning, pitch, bend, loop, drum mappings, etc. You can apply up to 64 effects simultaneously. Audio streaming routines help you play huge audio files sizes, as well as streaming audio.
What about an on-line multi-player game where players communicate through voice commands? No issue really! Allegro has sound recording routines that let you make voice commands on a multiplayer game, or implement voice recognition in your program.
Finally, the sound drivers supported by Allegro are:
- OSS, ALSA, ESD, aRts, JACK, SGI AL under UNIX
- Direct Sound WaveOut and MIDI drivers under Windows.
- CoreAudio, Carbon Sound Manager, QuickTime Note Allocator under MacOS X
- Adlib, Sound Blaster and its variants, AudioDrive, Ensoniq, etc, under DOS
- BSoundPlayer, BmidiSynth under BeOS, and more
Input/Output
The most essential thing in game play are inputs from the player’s end. Programming inputs through keyboard and mouse with Allegro is quite easy using the inbuilt global variables that get you all the parameters and values you need. Keyboards and mouse are auto detected and configured with only a function call. Even joysticks can be programmed with same ease after proper calibration. Allegro comes with advanced high-resolution timers and interrupts, which let you finely control game play with efficiently. It also has multi-threading features.
A game is never complete without a good interactive GUI, which lets the users select options from interactive menus. To service this need, Allegro also has an object-oriented dialog manager, with text boxes, push buttons, radio buttons, check boxes, menus, file browser and all the essential objects that use the same keyboard and mouse inputs. Allegro’s configuration routines help saving and loading different configurations, including hardware settings.
How about a game story video, or a cut scene in your game? Allegro has a very simple solution to this matter as well, with its range of FLIC routines which play Autodesk’s FLI and FLC animations with only a line of code.
Fonts
Allegro gives you a many options for printing texts and fonts. Although the default text format is UTF-8, it also supports other encoding formats and conversion between them. The different text functions and their variations let you place text on any position of the screen without much calculation. You can use GRX, BIOS (.fnt) fonts, as well as fonts from bitmap images and other sources. Installing an additional library enables Allegro to support True Type Fonts (ttf). TTF support was added in the work-in-progress release v4.9.
The Grabber Utility
Now, analyse this: a game needs sprites, level maps, files, animations and other important game data. Distributing a game executable with separate bitmaps, sounds, movies all unencrypted and uncompressed would be difficult to manage, update, as the size and number of the files increases, and would also be insecure. Thinking of a third-party compression/decompression/encryption library for the data normally comes to mind. But this also brings along the trouble of finding and installing a proper one, in addition to learning it. All this trouble goes away when you are introduced to Allegro’s Grabber utility, and datafile feature. They let you pack all of your sprites, sound, animations, level maps, and all other types of file into one single compressed datafile, which can be optionally also be encrypted. Allegro datafiles use the LZSS compression algorithm. These datafiles bring in great flexibilities in making games. For example, separate datafiles containing different level data are easy to distribute and to develop, without altering other levels, lets save bandwidth, and makes less development mess. To manage these datafiles from inside the program, Allegro has file and compression routines.
Writing programs with Allegro become easier because of the variety and simplicity of inbuilt predefined types, structures, and global variables. For example, the ‘mouse_x’ and ‘mouse_y’ global variables give you the mouse positions on screen at any time. The most fascinating feature of Allegro is it provides callback functions to almost every basic functions which brings great control and flexibility and let you program an abstract variant of a certain function. Like with the callback variant of the ‘line’, using the ‘do_line’ function you can draw an abstract linear formation with the pixels arranged as you like.
Perhaps the best feature of Allegro is that it is cross-platform, which lets your program to run in almost all the popular OSes, and hardware platforms, and your code to be compiled in a very wide range of compilers. So you don’t have to worry about modifying your code to support different environments. A source code once written could be compiled under any OS, with any compiler (with Allegro installed) without a single modification in the program, avoiding the huge amount of conditional compilation preprocessor directives and related complications.
It supports all major OSes like:
- DOS
- UNIX
- GNU/Linux
- FreeBSD
- Darwin
- Irix
- Solaris
- Windows
- BeOS
- QNX
- MacOS X
As for compilers, it supports:
- DJGPP
- GCC
- Microsoft Visual C++
- Borland C++
- Dev C++
- MinGW32/Cygwin
- Digital Mars Compiler
This library is basically a C/ C++ addon library. For those who are not into C/C++, there’s no reason to be disappointed … other language binding editions like Python, Perl, Pascal are also are available. Check alleg.sourceforge.net/bindings.html for more information, on how to use Allegro with other languages.
Phew! That’s a long list of features offered by Allegro, wasn’t it? Guess you’d now like to know how to get started.
Sneak into Allegro5
We talked about Allegro 4.2.2, now we just take a sneak peak into Allegro5 which is yet to be released. and see what it has to offer us. Allegro5 has lots of plug ins and other libraries inbuilt as a part of the Allegro5 project, which we need to add externally with the 4.4.2 version, like ttf, ogg, wma, jpeg, gif supports integrated AllegroGL are available in Allegro5 natively. Allegro5 has so many features changes, add-ons, fixes and even changes in syntax. Actually allegro5 is a complete rewrite of the allegro library. Although allegro5 is not backward compatible with the previous versions, as per the official website developers are working on so that it is easier to port into allegro5. To get the latest information and features of Allegro5 check out unstable latest release features in the official website : http://allegro5.org/
Getting your system ready
You can install Allegro from source or directly install binaries. Have a look at your distribution’s software repository; chances are it’s available there also.
You can try the below command as root in redhat based systems.
yum install allegro yum install allegro-devel
Also to get all the other extra plugins form your repository execute the below to get a list
yum search allegro
Dev C++ finds devpacks through the IDE and can install it. Also, just in case you want to test the unstable release (uses cmake to build), check out the readme file inside to get the installation instructions, of course after downloading the appropriate package. Get a tutorial on how to install Allegro 5 Here http://software.skoobalon.com/docs/a5_tut_install_gcc.php Note that you don’t need to install AllegroGL manually in this case, as it is inbuilt in v4.3.10 or greater releases.
We will continue describing source installation.
Visit alleg.sourceforge.net/wip.html and download the latest stable release – allegro-4.2.2.tar.gz. Scroll down the page to get non-Linux downloads. We will all install the AllegroGL library, so that OpenGL support is available. For that visit allegrogl.sourceforge.net/wiki/Download and click the download link to download the latest version –alleggl-0.4.3.tar.bz2.
We continue installing Allegro 4.2.2 from source packages. Assuming you are installing the library from source in GNU/Linux with GCC, extract the contents of allegro-4.2.2.tar.gz in a directory and cd into the extracted directory as follows:
tar xvfz allegro-4.2.2.tar.gz cd allegro-4.2.2
Now, you need to convert the files to UNIX format and set the proper makefile:
chmod +x fix.sh ./fix.sh unix
Now configure, and make the library-the passed parameter lets you to make both dynamic and static executables:
./configure --enable-static=yes make
Become root, and install the library into your system:
su make install
Next open the /etc/ld.so.conf file and append the line /usr/local/lib in it. Run /sbin/ldconfig to load the update.
echo /usr/local/lib >> /etc/ld.so.conf /sbin/ldconfig
To make off-line documentations, execute:
make install-man make install-info
To generate a 475-page handy documentation file in the allegro-4.2.2/doc/ directory execute below as normal user: (First command for a pdf file, second command for a dvi file, third command for a postscript file)
make docs-pdf ### for a PDF make docs-dvi ### for a DVI file make docs-ps ### for postscript file
Now cd into the setup directory and run the “setup” executable to configure Allegro for your system:
cd setup ./setup
This step is not very important, as Allegro auto detects hardware configuration.
Now, to install the AllegroGL library, extract the contents of the package (alleggl-0.4.3.tar.bz2), and cd into extracted directory:
bzip2 -d alleggl-0.4.3.tar.bz2 tar -xvf alleggl-0.4.3.tar cd alleggl
Set the makefile for UNIX, configure and then make
chmod +x fix.sh ./fix.sh unix ./configure make
Become superuser, and install the library:
su make install
And that’s the end of Allegro and AllegroGL installation.
Getting Started With Coding
To get started and run a program right now, we will present some samples
Check out the below sample programs.
/*Allegro 4.2.2 Syntax*/ #include <stdio .h> #include <allegro.h> #define RED makecol(255,0,0) #define GREEN makecol(0,255,0) #define BLUE makecol(0,0,255) #define BLACK makecol(0,0,0) #define WHITE makecol(255,255,255) int main(void) { allegro_init(); install_keyboard(); install_mouse(); install_timer(); allegro_message("This is the first allegro program (Press OK)"); set_color_depth(8); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0)) { allegro_message(allegro_error); exit(0); } textprintf(screen,font,10,10,WHITE,"Screen Resolution %dx%d",SCREEN_W,SCREEN_H); rect(screen,20,20,300,130,GREEN); circle(screen,SCREEN_W/2,SCREEN_H/2,50,WHITE); putpixel(screen,SCREEN_W/2,SCREEN_H/2,RED); line(screen,300,300,200,200,GREEN); triangle(screen,500,500,500,550,300,550,BLUE); show_mouse(screen); while(!key[KEY_ESC]) { textprintf(screen,font,30,30,RED,"Mouse Pos x:y=%3d:%3d",mouse_x,mouse_y); textprintf(screen,font,30,50,BLUE,"Mouse Scroll Pos: %3d",mouse_z); textprintf(screen,font,30,70,GREEN,"Mouse Left Button Pressed:%3s",((mouse_b&1)?"Yes":"No")); textprintf(screen,font,30,90,GREEN,"Mouse Right Button Pressed:%3s",((mouse_b&2)?"Yes":"No")); textprintf(screen,font,30,110,GREEN,"Mouse Middle Button Pressed:%3s",((mouse_b&4)?"Yes":"No")); textprintf(screen,font,30,200,GREEN,"Raw Mouse :%d",mouse_b); rest(5); } allegro_exit(); return 0; }
Description: The above program is more or less self descriptive. Before doing anything you need to include the “allegro.h” header file. The “makecol()” function converts the colour passed as the red green and red values as parameters to pixel format as per the current video mode needs. Before we call any allegro function, we need to initialize it with “allegro_init()“. Keyboard and mouse are initialized with “install_keyboard()” and “install_mouse()“. In line 11 we initialize the timer. The “allegro_message()” prints any passed formatted text in a dialogue box. Before we initialize the graphics driver we define the colour depth with which we will be working. We set it 8 here with “set_color_depth(8)” the “set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0)” function is used to initialize the graphics with the first parameter describing the graphics driver (here it is auto detected with the GFX_AUTODETECT_WINDOWED macro) the next two set the screen resolution (to 800x600). This function returns zero on success. The next set of statements are very much self descriptive drawing the basic shapes with Cartesian coordinate values, and colour values. Note that each such draw functions has a “screen” at its beginning. Its a global bitmap pointer of the current screen. The first parameters denote the destination bitmap where we are going to draw. Here we draw in screen, so the bitmap pointer is “screen. The function “show_mouse(screen)” shows the mouse pointer on “screen“. The global “key” array contains a series of flags indicating states of each key. We can check the key status of the alpha numeric keys using “KEY_A” .. “KEY_Z” “KEY_0” … “KEY_9” as the index in array “key” (check manual for all keys). So the while loop executes while the Escape key is not pressed. In the loop the three textprintfs prints the screen resolution, mouse cursor position, the mouse button and scroll status, and is updated in each iteration. The coordinate of the mouse cursor is accessed through the values of global variables, “mouse_x” and “mouse_y“. The scroll wheel position is retrieved with the “mouse_z” variable. The “mouse_b” is the variable representing the mouse press depending on the value it contains. Left Right and Middle click is represented with values 1,2,4 respectively. “allegro_exit()” closes the allegro system.
We now make a program to load a .tga .pcx or .bmp image.
/*Allegro 4.2.2 syntax*/ #include <stdio .h> #include <allegro.h> int main(int argc, char *argv[]) { BITMAP *image; if(argc==1) { printf("nUsage: program_name /path/to/tga/picn"); exit(0); } allegro_init(); install_keyboard(); set_color_depth(32); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0)) { allegro_message(allegro_error); exit(0); } image=load_bitmap(argv[1],NULL); if(!image) { allegro_message("Error Loading%s",argv[1]); return 1; } blit(image,screen,0,0,0,0,SCREEN_W,SCREEN_H); //stretch_blit(image,screen,0,0,image->w, image->h, 0,0,800,600); while(!key[KEY_ESC]); destroy_bitmap(image); allegro_exit(); return 0; }
Description: Note that we have defined 32 bit colour to show the picture properly displaying all of it’s colours. The last while loop waits for a ESC press, so we can see the picture. At first the image passed through command line is tried to load in the BITMAP variable image. It is checked for if the loading was successful. The blit function copies the rectangular area starting at screen position 0,0 with the width and height of the window (which we get from SCREEN_W and SCREEN_H) from bitmap “image” to bitmap “screen“. The commented statement “stretch_blit” function is an advanced version of blit, which supports resizing the source bitmap. stretch_bilit copies a rectangular area starting at position 0,0, with the width and height of the loaded image (which we get from image->w and image->h) into a rectangular area starting at 0,0 with width and height of the screen, from the bitmap “image” , into “screen“. This resizes the picture and shows the full picture on the screen, than just showing a 800x600 segment as in the simple “blit” function call.(Check manual for details)
At last we present a code with which you can drive a shape with the arrow keys around the screen.
/*Allegro 4.2.2 syntax*/ #include <stdio .h> #include <allegro.h> #define MAX 50 #define MIN -50 #define MAX_POINT 100 int main(void) { int x,y,dx=0,dy=0; allegro_init(); install_keyboard(); install_timer(); set_color_depth(8); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,1280,1024,0,0)) { allegro_message(allegro_error); return 1; } x=30; y=30; while(!key[KEY_ESC]) { if( key[KEY_UP] ) dy--; else if( key[KEY_DOWN] ) dy++; else if( key[KEY_LEFT] ) dx--; else if( key[KEY_RIGHT]) dx++; else { if(dx!=0) dx=dx-dx/abs(dx); if(dy!=0) dy=dy-dy/abs(dy); } if(dx > MAX) dx=MAX; if(dy > MAX) dy=MAX; if(dx < MIN) dx=MIN; if(dy < MIN) dy=MIN; x+=dx/2; y+=dy/2; if(x > SCREEN_W-30) { x=SCREEN_W-30; dx=0; } if(y > SCREEN_H-30) { y=SCREEN_H-30; dy=0; } if(x < 30) { x=30; dx=0; } if(y < 30) { y=30; dy=0; } textprintf(screen,font,15,15,15,"x=[%3d] y=[%3d] dx=[%3d] dy=[%3d]",x,y,dx,dy); circlefill(screen,x,y,10,15); vsync(); circlefill(screen,x,y,10,0); } allegro_exit(); return 0; }
This code is left for you to figure out how it works.
Check out the examples directory for excellent examples to check out the real power of allegro, and the allegro manual for each and every functions and its works. Here are some screen shots of some basic click and play games that I made with no time. I have these games codes made and they were playable in CLI with character graphics. What I just did is added a graphics layer programmed with allegro and called the appropriate functions of the core program. Though these might not seem impressive, I would tell you go to the last section of this article and see some great game screen shots, and get some Allegro game links.



Compiling
To compile a program with Allegro routines we need to link it to proper libraries. Allegro supplies a program called allegro-config that’s created and installed while installing the library, which does all this mundane things on your behalf. To compile a program, you need to execute:
gcc source_code.c `allegro-config --libs`
or:
gcc source_code.c `allegro-config --shared`
or:
gcc source_code.c `allegro-config --static`
Please note that those are not single quotes in the above commands, but back ticks (the key below the ESC button). Any of these basic commands creates an a.out executable file. The difference is: while running the first and the second command makes a shared executable file, the third one makes a static executable file. You can of course include other GCC options as per your need. You can execute allegro-config without any options in terminal to see more linking options. And to know what all libraries are linked, execute allegro-config –libs.
To compile an AllegroGL program (with Allegro 4.2.2) you need to additionally link -lagl -lGL and -lGLU, along with the previously mentioned compilation command. So, it becomes:
gcc source_code.c `allegro-config --libs` -lagl -lGL -lGLU
Check http://wiki.allegro.cc/Category:IDE_configuration to configure Allegro for your IDE. Different platform-specific details could be found at “Platform specifics” section of the manual from www.allegro.cc/manual and docs/build in Allegro’s extracted directory.
!!So, What are you waiting for? Start making a top scrolling space shooter!!
Going Further
Apart from Allegro’s inbuilt tools (grabber utility, colour mapping, text conversion), there are other tools, utilities, and add-on libraries available that adds more power to Allegro.
To get more image, sound formats, and many more libraries and tools check www.allegro.cc/resource/Libraries and www.allegro.cc/resource/Tools
Utilities like Allegro Sprite Editor, and Allegro Font Editor helps you to make your fonts and sprites, and they can be downloaded from www.allegro.cc/depot/utility/listing.
Information on Mappy, a map editor that has also been used to make commercial games, is available at www.tilemap.co.uk.
Resources help and tips
Allegro has excellent documentation. Apart from the documentations we built and installed while installing the library, additional documentation is available for download at alleg.sourceforge.net/api.html. Almost all official documentations are included in the downloaded packages, so I would ask you to check those first under the docs/, examples/, tools/ and the subdirectories inside the extracted allegro directory.
Download the Allegro vivace tutorial from http://www.glost.eclipse.co.uk/gfoot/vivace. This is a great tutorial which teaches different game programming techinques in a very organized manner with lots of examples for Allegro 4.2.2.
The official FAQ is at alleg.sourceforge.net/faq.html (or docs/html/faq.html in the extracted directory). As for tutorials check alleg.sourceforge.net/docs.html and www.allegro.cc/resource/HelpDocuments
allegro.cc is the major unofficial Allegro website, which supplies you with compilers, add-on libraries, tools, Allegro games and more. The Allegro.cc forum www.allegro.cc/forums is a small, yet an active forum where can venture in times of doubt.
As for AlleroGL, it also comes with a well organised offline documentation. Check /docs/html/index.html inside extracted AllegroGL directory. For more information and details, go through the readme.txt, howto.txt, and quickstart.txt files inside AllegroGL extracted directory. To check out online tutorials, point your browser to allegrogl.sourceforge.net/wiki/Resources.
Now let us now get some tutorials about Allegro5.
The Allegro5 tutorials and documentation are on the make everywhere. We have found some of them. Check http://software.skoobalon.com/a5.php For Allegro5 Tutorials. This is an excellent site for learning Allegro5.
For Allegro5 documentations you can just make a visit http://alleg.sourceforge.net/a5docs/refman/index.html
Check the Allegro wiki at wiki.allegro.cc for more articles, and visit nehe.gamedev.net and www.swiftless.com for OpenGL programming tutorials.
And if you are still hungry for reading more you might as well read the feature at www.gamasutra.com/features/19991026/allegro_01.htm
These documentations are more than enough if one is already introduced to basic game design techniques and has some experience with C Programming. For a game design newcomer, first he needs to understand the game design logic, and algorithms. For those I would refer a book, which does both the job, as it teaches game design with Allegro and AllegroGL library called “Game Programming All In One” (Latest 3rd Edition) by Jonathan S. Harbour. With this 700+ paged book, and its companion CD you will fly into game design with Allegro, with a step-by-step approach with professional game examples. Get a sneak peak of this book by searching for the title at books.google.com
Looking forward
Developers are hard at work, and you can expect version 5 very soon. The latest work-in-progress release reflects features which would be available in it and the library surely has undergone huge changes. First off, version 5 comes with a lot of plug-ins and add-ons bundled in one package, like AllegroGL, GIF, JPEG, OGG, lots of drivers, true type font plug-in, and tons more. It has updated all the internals like I/O event management systems etc. included OpenGL and DirectX drivers, new and rebuilt routines, and new advanced features. The visual difference in Allegro 4.2.2 and 5 is some change in syntax, new abstract datatypes, modified and new routines to make the new features and updates ported in,keeping them clean and simple. Check alleg.sourceforge.net/changes-4.9.html to have a look at the version updates and the differences.
Allegro 5 documentations are not quite impressive at this moment, as it is still under development. Though documentations are improved in with the 4.9.8 release. Check out the new documentations of Allegro5 here http://alleg.sourceforge.net/a5docs/refman/index.html. This site http://software.skoobalon.com/a5.php has come up with some great tutorials for Allegro 5. Allegro 4.2.2 programmers might have to face some difficulty porting their codes from 4.2.2 to 5 due to the new syntax and structure. If you go through the features in the Allegro official website, then you can easily understand that Allegro 5 is coming with a more advanced API with more easy routines, and a huge collection of features. As for when Allegro 5 will be out? The answer I got at their IRC channel was: “it will be done, when it is done!”
At The End Of The Day
To design a good game, one has to understand game design techniques and algorithms. Advanced and complex libraries and syntaxes diverts the concentration of the learner from learning game design, to the graphics coding complexity. Beginners are put off by these syntactical complexities, complex implementations, and structures. Allegro’s main speciality is its simplicity and the power it delivers, hiding the unnecessary and complex internal details of the system from the user, and lets them concentrate more on the core game logic design, by making the graphics coding simple.
A lot professionals use Allegro, a lot of games including commercial paid games have been made with Allegro. Being open source, users get a great programming library which is even used by professional programmers.
The word “allegro” means a piece of music, that is full of life and up-tempo. Similarly, the Allegro library brings the “allegro” in programming, and renders the dreams of making real games come alive with 32bpp colour and OpenGL rendering.
Attached Files Download
Click here to download all the sample codes used in this article
Allegro Game Screenshots






Links and References
- Allegro home page: alleg.sourceforge.net
- Allegro5 home page: allegro5.org/
- AllegroGL for Allegro4.2.2 , Download page : http://sourceforge.net/projects/allegrogl/files/
- About Shawn Hargreaves: www.talula.demon.co.uk
- Community site: allegro.cc
- Wikipedia: en.wikipedia.org/wiki/Allegro_library
- Game Programming All In One, 2nd Edition, by Jonathan S. Harbour
- Freenode IRC Channel: #allegro
Update Information
03.06.10 : Minor changes in post structure.
First Publish Information : This article was first published in Linux For You Magazine December 2008 issue under Creative Commons License. Editing will be done to keep updated.
Author : Arjun Pakrashi
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License
BARA ayon nijeke bara ki GM SIR vabish.BOCACHDA
I have learn some good stuff here. Certainly worth bookmarking for revisiting.
I wonder how much attempt you set to create the
sort of wonderful informative website.