How to write a roguelike game...

Click here to return to ADOM Central.

I often get asked about details concerning the implementation of specific parts of a roguelike game. Usually (when my time permits) I try to answer such questions in the necessary detail. Some questions though repeat quite often and concern pretty basic stuff. Thus I decided to see how long it would take to write the basic framework for a simple roguelike game.

The result of some hours of work is QHack (the abbreviation for Quick Hack). QHack is the basic framework for a simple roguelike game. The sources are freely available and you are allowed to use them for your very own needs, as long as I receive the deserved credit for the part QHack has in that.

QHack is intended to provide the basic stuff one needs to create a roguelike game. It does only the very basic stuff like setting up a map and saving/restoring it, setting up some monsters and getting the player to move. The sources are kept as simple as possible and all detail is missing. This hopefully will help you to grasp the basic concepts for writing roguelike games. Please note that the structure of QHack is extremely simple and pretty limited. It is not possible to write a game with the scope of Nethack or ADOM with these sources, although you quickly will understand to expand the concept to fit the needs of your roguelike game.

Click here to download the QHack sources (34k in ZIP format). If you decide to use them or have any opinion about them, please email me about it. I'm curious to hear your thoughts.

The sources are written in C and in the current state require a make utility to compile them (your preferred development environment probably provides such a tool). If you really want to start writing a roguelike game, here is some more advice:
  • Get a decent development environment (e.g. DJGPP + PDCurses for DOS (see e.g. http://www.delorie.com for details) or GCC + NCurses for Linux. C seems to be a great implementation language, although Java also might be a good choice.
  • Try to start out small and work from there. Try to keep possible future developments in mind to prevent excessive redesign just to add some new concept.
  • Don't try everything at once.
  • Learnhow to design software by modularizing your program and by doing theoretical design first.
  • Try to write platform-independent code by defining tyopes that are the same across all platforms and by putting all the platform-dependent stuff in one or more separate modules (definitely all IO stuff [both to screen and disk], random number stuff, variable types, directory handling, ...).
  • Try to get a clear idea of what you would like to achieve before you start to write your game.
  • Be sure that you want to spend the better part of several years or your spare time to get the game finished. Starting a project is simple, getting it done is the difficult part.
  • Refer to rec.games.roguelike.development for useful advice.
  • Have fun working on your game. If it isn't fun, it won't be good.

QHack is owned by Thomas Biskup. All Rights Reserved.

| Last Modified: | Suggestions? EMail me.