Libtcod and Roguelikes

Digging around in a friend’s python scripts and editing them for my own use got me thinking about games like Dwarf Fortress, NetHack and even old space trader games like Elite and Freelancer. Generally, Roguelikes are characterized as being text/console based games, with randomly generated dungeons, and often times randomly generated items (an item named “bubbly potion” might heal you in one game, but kill you in the next).

Perhaps the most interesting Roguelike to come along in recent years has been Dwarf Fortress, which has sort of been defining it’s own incredibly complex, detailed sandbox genre. By complex, I mean that some people complain about playing it at an acceptable rate on modern hardware, as they might complain about a more graphically intense game like Battlefield 3.

That said, the seeming simplicity of the game genre would seem to make it rather easy to code one up from scratch, and make your own customizations as you go along. Alternately, if you could find a NetHack-style Roguelike framework, you could take the “rendering engine”, apply your own back end, and create a different genre of game, like a Space Trader perhaps. I was happy to find the Libtcod library.

Libtcod gives you a huge amount of Roguelike features right out of the box, and in about 500 lines of code, you can be up and about scooting your little @ symbol around the screen, fighting monsters and exploring randomly generated dungeons. There’s a great tutorial that will walk you through getting the @ symbol on the screen, to building a randomized dungeon, to fighting monsters in it. You can find the tutorial here. It includes standard features, and in addition things like 24 bit color, alpha transparency and support for bitmaps. It’s a fancy piece of kit. If you want an idea of what it can do, take a look at and download Pyromancer, a visually stunning game built on top of Libtcod.

What blew me away was that in addition to what he’s done with Libtcod (well, he wrote it, afterall!) – is that someone took this graphically intensive ASCII interface – and then built a windowing system – Umbra – on top of it. Let me take you through this again – console, text only game, color 24 bit text only game, application platform.

Umbra looks and feels like this (skip ahead to the 0:55 mark):

Anyways, I am relearning Python, digging through the tutorial bit by bit. It’s written simply enough that you have a functional game by the end of the tutorial, and is modular enough that you can go about modifying bits without too much fear of permanently breaking other things. There is a C++ version, but I am spending a lot of time digging in to Python code these days, and Python feels faster to modify and test than C.

This entry was posted in computing, Games and tagged , , , , , , , , , , . Bookmark the permalink.

One Response to Libtcod and Roguelikes

  1. Thanks for sharing your info. I really appreciate your efforts and I will be
    waiting for your next write ups thank you once again.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>