The Beginner's Guide To Roguelike Development
This guide is a collection of articles intended for those who have never really sat down to write a game before. Ideally, you’ve gone through a book like C++ for Dummies or preferably C++ Primer Plus by Steven Prata. You know what a function is. You know what variables are and how to use them. If you’re smart, you might know how to make and use classes – and if you’re really, really smart you might even know how to use pointers.
My point being: you know C++. My hope is to show you how use it to make a game.
There is a fundamental difference between knowledge and experience: I’ve seen a 50-year-old PhD getting schooled by a self-taught freshman straight out of a Nigerian boarding school who had cut his teeth making games in his spare time. This guy knew how to program; how to use a programming language like an painter uses a brush and canvas. It was absolute art.
Fact is, you are leaving study and theory behind and are entering the noble world of the making of things.
Let’s get started, shall we?
Scope and Requirements
The purpose of this guide is to provide a beginner
programmer some of the foundational concepts required to design and program a
console-based game. It is intended as a resource for new developers of
Rogue-like (RL) games to help reduce the learning curve and encourage more
people to try their hand at making one.
This guide is intended for someone who knows the C++ programming language but has little to no experience in applying the language to the creation of an RL. As such, it offers little instruction on the C++ language itself. If you require a resource for learning C++ I would recommend C++ Primer Plus by Stephen Prata as one of the best books I have ever read on the subject.
All examples were developed using the Microsoft Visual C++ 6.0 compiler/IDE and are intended to run in Win32 console mode.
A Note Regarding Console Output
For most ANSI C/C++ compilers operating in 32 bit mode, console I/O support lacks two very necessary features when displaying text: you cannot explicitly position where text is drawn on the console and you cannot change the color. To add this functionality, RL developers use 3rd party console libraries, the most popular by far being the ‘curses library as it has cross-platform support.
This is not a guide on how to use curses. In addition, for some there is difficulty installing this library. Because of this, the guide does not use ‘curses and instead communicates with the Windows operating system using a minimalist class developed for this guide. All programming examples utilize this class.
Translating the examples found in this guide to ‘curses or any other console I/O library should require nothing more than renaming the function/method calls – the concepts remain exactly the same and frees the guide from version compatibility issues in the future.
About the Author
Craig Stickel is a Computer Engineer, born and raised in a delightfully small town in Alberta, Canada. He currently resides in a slightly bigger town near Calgary, Alberta, Canada. Experienced in over 9 different programming languages for over 7 different processor architectures - he currently is employed as a designer, electrical engineer and firmware/software developer for a small R&D company.