Rogue Detective started off as an attempt at the annual 7 Day Roguelike competition, wherein one aspires to create a full roguelike in a mere seven days. Entrants are allowed to use previous work, provided the final game is a new roguelike unto itself.
This year, the competition fell in one of the two weeks of my holiday from work. Being one of the many proud staycationers so prevalent in England, this meant I would have the full week to develop a game! I heard about the competition one day in advance of its start, which gave me a little bit of time to start mulling over a few ideas I had.
At the same time, I started considering at my options regarding development. I already knew what my editor would be: Emacs, of course! I figured if I was going to pull this off in a reasonable time frame, I’d need to use a language I was comfortable developing in. That meant a choice between C(++) and Python. Given how I’d recently worked on a Python game, the language was still fresh in my mind. Indeed, for speedy development I am in general more comfortable in Python.
Editor sorted, language sorted.. Now I needed to consider what libraries might exist out there to help me. I vaguely remembered NetHack using the curses library for terminal stuff, so the first thing I did was check for Python bindings. Sure enough, a Python library for curses existed. At this point, I hadn’t even considered a graphical roguelike. I knew I had no chance to produce something pretty, so I would stick to ascii. I started work on getting an @ symbol wandering the void. This is not the most thorough approach to library selection, but yeah! Limited time means limited research.
I hadn’t quite realised what I was undertaking: A complete roguelike from scratch, save for terminal character manipulation. Given only a week, surely the typical entrant would have to take the whole time to finish something even remotely playable, eschewing work and a social life?
Meanwhile, my friend Ariff was considering entering the same competition. The first thing he did was check for the already existing roguelike libraries that could help. Of course! Why wouldn’t something so obviously useful exist?
For Python, there already exists the libtcod library. Rather than build everything from scratch, libtcod provides users with useful functionality such as built-in dungeon generation, pathfinding, line of sight algorithms.. And to top it off, the whole thing is portable: Rather than build off a terminal-based library, it uses the SDL library. So while programs now have to run in a non-terminal, there’s very little messing about with getting games working on multiple platforms AND with full colour!
So it’s a no-brainer, right? Using this library, I’d be able to get to work on the meat of my game idea immediately! Maybe this wouldn’t be such an impossible task after all.
Of course, I’d already gotten an @ symbol walking around.. And it would be a shame to waste ‘all that work’.. Long story short, I made the questionable decision to continue with my own ‘from scratch’ engine. This was probably due to a mix of hubris and ignorance. Sufficed to say, I didn’t finish in seven days. It turns out that unless you’ve implemented things like path-finding and field of view before, they can be more than a little time consuming!
So the dream of a roguelike in seven days was dead on arrival. But this wouldn’t kill the dream of a roguelike in totality. Over the past month I’ve continued to work on my little game, and over the next few posts I’d like to go through some of the basics of roguelike development using my repository’s history to guide us. It will definitely not be a guide on the proper usage of source control (one branch for life!), but I think maybe it’ll be useful for me to solidify the process and maybe useful for people reading if they want some insights on how a newbie might write a roguelike.