RPG Tutorial

Regarding The Old Tutorial

The old RPG tutorial was not the most well written of things, and as such has been superseded by this version, which, whilst containing slightly more complicated code, is far easier to actually understand. If you were following the old tutorial then I apologise, the source code is still available but the tutorial itself is not, for various reasons. If you were not particularly far into the tutorial (or are brand new, in which case welcome!) then I recommend that you swap to this new version. Apologies again.

Tutorial

In this tutorial, the second version of its type, we will go through the process of making a simple text-based RPG game in C++. In this tutorial we will make extensive use of the Standard Template Library (STL) and object-orientated programming and so it is recommended that you are at least familiar with both. (Although everything will be explained, so existing knowledge is not wholly necessary.) If you need any reference, then the complete source code for the tutorial is available for download below, with comments. Note that a lot of the code in this tutorial uses the C++11 standard, which should be enabled in your compiler if necessary, as otherwise the code will not compile. A word of warning to the hardcore OOP fans; my personal opinion is that setting variables to private and then providing trivial getters and setters to access them is a waste of code and time, and that those variables should just be made public in the first place. I am aware that many people will disagree, so feel free to implement those functions if you wish, I will not. My preference is also not to include a using namespace std; line at the top of each code file, and instead to prefix the library functions with their namespace. Pretty inefficient whilst writing the code, but I like the clarity of it. Also, including that line is frowned upon in header files, as you force any code that has included the file to also include the namespace. Not really an issue for us, since we’re writing the entire project, but bad habits are hard to break, so let’s not get into them now. Oh, and the code in this tutorial is distributed under a MIT license. Without further ado though, let us begin!

Source Code

01: Dialogues
02: Creatures
03: Back To Main
04: Items
05: Inventories
06: Areas
07: Atlases
08: Battles
09: Menus