An easy to use game library?
.
In case you don't know allegro is an open source
game programming library developed by shawn hargraves. Allegro is
probably one of the most well known game libraries and also one
of the oldest.
Allegro was first developed with the intention of providing easy
access to mode13 in msdos using the djgpp compiler. Because of its
opensource nature other people began submitting their own bits of
code into allegro helping it to grow into a fully featured game
development library with support for many resolutions and drawing
functions. The most recent release (V4.0) has added a huge amount
of support for platforms (All Windows platforms were gaming is popular,
Linux, FreeBSD, QNX, BeOS, Mac) and compilers (just about any compiler
that can run ANSII C++ including Microsoft Visual C++, Mingw, Dev++,
DJGPP, cygwin, GCC).
With the advent of V4.0 allegro has become fairly
complete with many features including,
Easy structure - Pretty much everything on screen
is a bitmap including all images, primitives and the screen itself.
This makes manipulating objects on the screen easy. a bitmap in
allegro is similar to a surface in SDL.
Image file loading - Allegro can by default load
a few popular image file formats such as BMP files and can be made
to load more formats if addons are installed.
Sound file loading - Allegro can by default load
a few popular file formats such as WAV files and can be made to
load more formats if addons are installed.
2D screen drawing - Allegros allows the drawing
of previously loaded files or 2D primitives such as rectangles and
circles.
3D screen drawing - The inbuilt 3D functions are
not as complete as those found in other library's but allegro supports
opengl (the standard in 3D programming) as an addon library.
One of the primary aims of allegro is to be easy
to use for the beginner. This is the area that allegro scores most
highly in. It is very easy for an almost complete beginner to at
least start creating the game because almost all of the hardware
specific details are hidden from them and it is left up to the developer
to design the game. All that is required to make it run on any platform
is adding allegro_init() before any other allegro functions and
END_OF_MAIN right underneath the main statement and allegro will
figure out what needs to be done.
The allegro functions are fairly simple, flexible
and will not take much time to learn for most people. The official
documentation on the other hand is not the best for complete beginners
since it is mostly a technical view of the library functions and
not tutorials for getting started as in other library's such as
clanlib. Although there are a few unofficial sites that offer to
teach the basics of allegro. Go to the bottom of this page to see
them.
The best of these unofficial sites has to be allegro.cc.
As well as allegro files and links to other allegro websites it
acts as a showcase for games from allegro developers. Hundreds of
allegro based games can be downloaded from action to strategy. The
forums are another area of the site that work very well, almost
all questions are answered.
I do think that there should be a few more high
level functions to help simplify game development. I understand
that allegro is a low level game library but since this is clearly
aimed at the beginner, why not for example, have inbuilt functions
for tile maps? Most games created with allegro use tile maps in
one way or another so introducing a standard wrapper to create tile
maps makes sense.
Here's some example code that draws an image on
screen,
#include <allegro.h>
int main()
{
// This is the bitmap that stores the image
BITMAP *the_image;
// The initialization code needed to make
allegro work
allegro_init();
// Self explanatory
install_keyboard();
// Full screen mode with a resolution of 800 by 600
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN , 800, 600, 0, 0);
// read in the bitmap file
the_image = load_bitmap("test.bmp", NULL);
// blit the image onto the screens center
blit(the_image, screen, 0, 0, (SCREEN_W-the_image->w)/2, (SCREEN_H-the_image->h)/2,
the_image->w, the_image->h);
// destroy the bitmap
destroy_bitmap(the_image);
// Waits for user input
readkey();
}
// Some Allegro magic to deal with WinMain().
END_OF_MAIN();
Even though it has a few (small) problems its
advantages still make it one of the best 2D game library available
today. It is more then capable of creating good games, for examples
just take a look at allegro.cc. Looking at the design documents
for allegro V5.0 it seems like allegro is going to keep improving
in both platform support and performance.
Comment
on article
Allegro.cc
- the allegro "Game Developing Community Network".
AGDN
- "Allegro Game Development Network".
LoomSoft
- Has an "Allegro Newbie Tutorial".
|