The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

Allegro Vivace/Introduction

From Allegro Wiki
Jump to: navigation, search

About the Tutorial

Allegro Vivace is a tutorial aimed at helping people learn how to write games in C/C++ for various platforms (e.g. Windows, MacOS X and Linux), using the Allegro 5 game programming library. It is based on the tutorial written by George Foot. The goal is to introduce the reader to the Allegro 5 game programming library and basic game programming concepts that are of importance.

Target Audience

This tutorial assumes at least a basic knowledge of C/C++ programming. It also assumes that you know what Allegro 5 is, where to get it and how to install and set it up so that it works with the compiler of your choice. If you have trouble understanding what the tutorial is trying to teach, then it might be a good idea to go back to your favorite C/C++ programming book and brush up on your skills.

Requirements

  • A working compiler
  • Allegro 5.0.0 (or a later version)

Before we start...

This tutorial is employing a top-down approach, which means that we begin with broad and general concepts that are important to understand when trying to create your first game and then delve deeper into how you actually implement these concepts using Allegro 5.

Reading only this tutorial won't be enough though. It is always a good idea to consult the manual when new things are introduced to learn about the intricacies that is outside this tutorial's scope. The examples included in the Allegro 5 distribution are also a good resource for learning how to use the library, as they often focus on one detail of the library in an often straight-forward manner. It is also important to try out everything yourself. Play around with the soure code, and try to make it your own. A lot of what you need to know is often learnt best by experience.

A general piece of advice is to start small. Don't aim to create a complete game at first. Begin with the parts that make up a game, like making things move, responding to user input, etc. The first games you create should be simple, but they don't necessarily have to be clones of Pong or Tetris. Try to think of a fun game mechanic and implement that. When the core gameplay is done, only then should you focus your attention on the details and polishing. A common mistake is to try to create an RPG (or worse, an MMORPG) as your first serous attempt at creating games. If you're not a genius, it's often too hard without the right amount of experience.

A big issue in writing games is inspiration -- if you can't think of something to write, then you can't write it. At first you will probably either not think of anything, or think of too many ideas which seem far too complicated to implement. If you can't think of anything, relax and read this tutorial. Use the example programs as a base, add new things to them and personalise them. As you read through you will get a better idea of what can and cannot be done. Look at commercial games, too -- see if you can firstly see how they do what they do, and secondly improve upon them. Don't assume it's completely out of reach -- as you gain experience you will be able to see different ways of doing things. Remember, the authors wrote it somehow; it must be possible.

If your ideas are too complicated, the above point applies again -- the more games you write, the better you are at writing them and the more games you are able to write. In almost all situations for beginners, the key point is to start simple and get a working game early on, then build up from there. This technique does have its disadvantages but for now it should be fine.

Last of all, games are supposed to be fun; that's their purpose. You cannot write a fun game if you're not enjoying writing it. Good luck!