Introduction

What better way to code a game tutorial than to have the complete design all made for you.
Tranz Am is a game released about 1983 by Ultimate (now Rare).
It's a simple game of driving across the barren American wilderness in the year 3472 (i.e. it called for minimal graphics and coding, and America seemed cool to a bleak 1980's Britain). The object of the game is to gather 8 cups, avoid obstacles and the Deadly Black Turbos (black cars to you and me). Or, as the review says, 'Transam follows the tradition of quality graphics and original aims... there are four car controls and also pause.'.
The lessons will take us through game configuration, animation, graphics handling, tile maps, collision detection, path-finding and game control to name a few.

Software and Libraries

The tutorial uses the following libraries for development of the game: Excluding Allegro, all of this software is included in the download. The Mappy playback library is a single file that performs all tile map activities, such as loading a game map, displaying it, etc. and is included here. To initially create a map you need a map editor, this is not included. The first or second lesson creates a fly-by to show the map, so the editor is not necessary. But obviously you'll need it for tinkering and creating your own.
Currently a binary version exists only for Windows but works under Wine. However, the source code is available that can be compiled against winelib. Get the editor from www.TileMap.co.uk. A beta JAVA version is available too. Older versions for DOS exist, and possibly an OSX version.

Download

You have a number of options: If you only want to follow this tutorial, get the tutorial only, not the full version. All versions are available from the AXL Download site

Installation

Setup

All the code/binaries for the tutorial are within the 'AXL_Projects\tutorial' directory. It contains the following directories: Each sub-directory within the tutorials/code folder contains one lesson. Each tutorial folder contains all the files necessary for compiling and running that tutorials. The idea of the tutorials is that each one builds upon the previous to form the game in simple steps. The 'code' directory also contains the following sub-directories: When a new lesson is started (lessons are listed in the menu to the left under 'Tutorial') it will have a version number, e.g. 'Article 1'. All the files for that lesson are stored in that same numbered directory, e.g. All the code for Article 1 is stored in the tutorial/code/version1. The files will include header files (*.h), source code (*.cpp) and make files that target a few compilers (*.vcproj for Visual Studio 2005/VC8, *.dev for Dev-C++)
For Visual Studio users, instead of loading up each tutorial there exists in the code directory the file Tutorials.sln - opening this will load up every tutorial into the solution window.
Note for Dev-C++ users. When compiling each project, clear out the temp directory (e.g. run the CLEAN menu option) as it tends to reuse old .o files and may give compiler errors.

Manual Project Creation

If you are not using any of the above systems (Visual Studio 2005/VC8, DevC++) or you have moved some files around, do the following: NOTE:mappyal.c *must* be compiled as a C file (don't ask me why). Because Dev-C++ is a bit crap (it cannot target c++ and c files in the same project), it is for this reason that the DevC++ project uses the pre-built mappyal.o file. Add the mappyal.a file to your Dev-C++ project. If your compiler is like this, compile all cpp files as C++ and mappyal.c as a C file.

Lessons

The lessons are broken down as follows:

  1. Setting up our game's framework, ensuring it compiles and displaying a graphic
  2. Loading the map and scrolling it
  3. Defining and placing the car
  4. Updating the Car's fuel, temperature, speed and distance
  5. Adding a menu system and using the AXL Configuration class
  6. Bringing the Map alive, changing animations, countdown timers
  7. Adding national and local radar
  8. Placing and creating Enemy Cars
  9. the A-Star algorithm
  10. Applying A-Star to the enemies
  11. Moving the enemies : unfinished
  12. To finish : unfinished

Click on Article 1 for the first lesson. The first and last lesson are pre-supplied as Windows executables just in case you want to know the extent of the lessons :)