Complete Roguelike Tutorial, using python+libtcod

From RogueBasin
Revision as of 01:25, 14 September 2017 by Kyzrati (talk | contribs) (→‎Other languages)
Jump to navigation Jump to search

This tutorial is for libtcod 1.6.0 and above.

If you would prefer to do the tutorial for an older version of libtcod, you can get there through one of the links below. Be aware that the only way to get bug fixes, is by upgrading to the latest version. There are no bug fix releases of older versions.

For libtcod version 1.5.1, here is the older version of this tutorial.
For libtcod version 1.5.0, here is the older version of this tutorial.

Short introduction



Why Python?

Most people familiar with this language will tell you it's fun! Python aims to be simple but powerful, and very accessible to beginners. This tutorial would probably be much harder without it. We insist that you install/use Python 2.7 and go through at least the first parts of the Python Tutorial. This tutorial will be much easier if you've experimented with the language first. Remember that the Python Library Reference is your friend -- the standard library has everything you might need and when programming you should be ready to search it for help on any unknown function you might encounter.

This tutorial is for Python 2 only, and it is strongly recommended you use the latest Python 2.7 release.

If you choose to use earlier versions of Python 2, you may encounter problems you need to overcome.
If you choose to use Python 3, be aware this tutorial is not compatible with it and you are on your own. (See "other languages" below.)

Why libtcod?


If you're using Windows, download either the Win32 or x64 build from bitbucket. Various samples are prebuilt and included, and can be used to both experiment with the various features and see what is possible.

For other platforms, you're going to have to compile them yourself. Maybe someone who owns a MacOS machine might compile builds for the libtcod project?

Other languages

There are no known versions of this tutorial for other programming languages than Python, for libtcod 1.6.0. However, you can hop back to the tutorial for 1.5.1 and find some option there to work from.

Here you'll find completed ports, one for Python 3 and libtcod (revising this tutorial "with good coding practices kept in mind from the beginning") and another for Python 3 and TDL, created by /u/TStand90 for r/roguelikedev Tutorial Tuesday 2017.

A separate work-in-progress port of this tutorial for Python 3 and tdl (a pythonic cffi port of libtcod) can be found here.

Start the tutorial

Follow the first link to get started!

  • Part 1: Graphics

  • Part 2: The object and the map

  • Part 5: Preparing for combat

  • Part 7: The GUI

  • Part 8: Items and Inventory

  • Part 9: Spells and ranged combat

  • Part 13: Adventure gear



  • Real-time combat
  • Scrolling maps


