Train Game (working title) is a game about trains! Woo! You control a train which you drive around a 3D world picking up cargo, trundle it about, and deliver it for PROFIT; whilst avoiding disasters like falling off the rails, hitting other trains, bad weather, or privatisation. Imagine Elite but with trains instead of space craft. Can’t believe no one’s thought of it before.

It’s going to be more of a game than a train simulator, largely because I know very little about train-mechanics. Ho hum. To be honest, I think this will make it rather more fun.

It’s very much a work-in-progress, but you can download a demo below which has these features:

  • An OpenGL-based 3D render. It will happily render large worlds using quad-trees to split up the terrain. It’s not overly optimised, but I get decent frame rate on low-end cards: 30-60 FPS on an Intel GMA 945, 60-120 FPS on an Nvidia G105M – not exactly the most powerful hardware on the market…
  • It has a built-in map editor which lets you edit the terrain, paint the track, add stations etc.
  • You can drive the train! It accelerates and slows down, moves in reasonably realistic way, and you can control which way it turns on points
  • You can try and stop at stations if you like, but there’s no reward :-(

Screen shots

Driving the train around a small map

Driving the train around a small map

Driving towards a station

Driving towards a station

The game engine supports quite complex track layouts

The game engine supports quite complex track layouts

The FLTK-based editor used to create levels

The FLTK-based editor used to create levels

All the models are made in Wings3D.


The game is released under the terms of the GPLv3. You can get the source code here:

It should build fine on Linux – this is where I do most of my development. It has (at least) the following dependencies: OpenGL, GLEW, Boost (>= 1.37), Xerces-C++, CMake, SDL, SDL_image, and FreeType (sorry!).

To build, unzip the source code, and cd into the newly created directory. Now do the following:

$ cmake .
$ make

Hopefully all will go well (email me or complain in the comments below if it doesn’t!). Now you can play the game by running:

./bin/TrainGame play coal_mine

(You can substitute figure8 or points for coal_mine there.)

To use the editor, run:

./bin/TrainGame edit <map_name_here>

You can edit existing maps as well as create new ones.

Windows users! You are not forgotten! I have successfully compiled and run the game on Windows using Visual Studio 2008, but that was nearly a year ago so it may take a bit of work to get it running again. You’ll still need all the same dependencies as above. Install them and then use the CMake GUI to help it find their library/include directories.


Playing the game is fairly straightforward. Use the mouse to move the camera (it’s always directed towards the train). Use the following keys to control it:

  • Up and down arrow to speed up and slow down the train.
  • b to toggle the brake on and off.
  • Left or right arrow keys switch nearby points.
  • Tab toggles between different views.

When using the editor, click and drag with the right mouse button to scroll the map. The currently selected tool is shown in the drop-down box in the top right. Click and drag with the left mouse button to apply that tool to an area – e.g. connect the endpoints with track, raise the area, delete everything, …

Feedback appreciated!