- Learn C++ - https://www.learncpp.com -

Introduction to Roguelike gaming

I play many different kinds of video games, but Roguelike games are some of my favorites. Before I go into the why, let me introduce Roguelike games to those of you who are not familiar with them.

The Roguelike game genre was created all the way back in 1980 when a game named Rogue [1] was released. In Rogue, your character walks around an two-dimensional ascii dungeon, fighting fantasy monsters (represented by ascii letters), finding items (represented by punctuation), and trying to survive. Later, quite a few other now-well-known games were released -- including the “Big 4”: Angband [2], Nethack [3], ADOM [4], and Crawl [5]. Nethack, released in 1987, is probably the most well known of all the traditional Roguelike games, and it’s popularity has made it a part of computer culture and lore.

Even though many of you have never played a traditional Roguelike, it’s very possible you’ve played a non-traditional one. Diablo [6] and Diablo II [7], the famous games by Blizzard, shares many features with typical Roguelike games, only with fancy graphics, a refined user interface, and in real-time.

There are several things that make Roguelike games really cool -- first, unlike most traditional games, they are HIGHLY randomized. Almost everything is different every time you play: the dungeons, the creatures you meet, the items you find. This gives Roguelike games an immense amount of replay-ability, which is why they are still popular even after all these years. Second, they are HARD, requiring the player to utilize any resources at hand in an attempt to survive. And when your character dies, he or she dies forever. Beating one of these games is a real challenge, and doing so is a real accomplishment. Third, and most relevant to this blog and website, these games are often open-source. This not only means they’re free (which is hard to beat), it also means we can take a look at their source code (many are written in C or C++). While most of them have not been coded using modern coding methodologies (and hence are not suitable candidates for learning how to program), what they do offer is the chance to take a look at and discuss some very interesting algorithms in a simplified context.

Many young programmers decide to learn C++ because they ultimately want to write games (I did at one time). Roguelike games are an ideal place to start, because they allow the programmer to concentrate on the structure of the code instead of having to spend all his or her time creating art assets and making things look pretty. The innate simplicity of the user interface of Roguelike games (essentially being just ascii text) makes them an excellent testbed for learning and implementing new ideas and algorithms that can then be generalized to fully graphical games, such as Massively Multiplayer Online Role Playing Games. And they run on almost any computer, even old monochrome HP workstations.

Despite the apparent simplicity of writing a roguelike game, many new programmers find themselves in over their heads once they get into the details of writing a roguelike game. Roguelike games can be deceptively complex once you look under their hoods, requiring an intersection of artful decision making, algorithmical knowledge, good programming habits, and persistance. And that is precisely what makes them so interesting. :)

How do you write a random dungeon generator? Or a random item generator? How do you do efficient field of view calculations, where a player can only see what is lit by his light source, and walls or other terrain obstacles block line of sight?

There are all questions that I would like to eventually explore on this blog. I think it would be interesting to do a tutorial series on the subject, to show how a Roguelike game can be built from the ground up in C++. In the meantime, while I am still working on the C++ Tutorial, I will occasionally discuss various general topics in Roguelike gaming on this blog.

Feel free to check out some of the major roguelike games in the genre and get a feel for them. Just make sure you leave yourself enough time to get addicted. Because they’re an awful lot of fun.