In this article, I'll guide you through making RPG's with Inform 7.
It is certainly possible to make RPG's in other IF platforms (such as TADS, ADRIFT etc). However, I have chosen Inform 7 due to its ease of use and portability to almost every OS (the Z-machine is even on mobile phones now!).
An important note: To write and test this example RPG, I will be using Inform 7 build 6G60. If you wish, You can use the code featured in this article with the latest version (6L38). However, some of the code may not work.
An equally important note: I will asume that you know how to write Inform 7 code. If you do not, read the excelent Inform manuals. Also, there is the Inform 7 Handbook.
As you know, extensions are chunks of code which can be included in your Inform code.
There are two popular extensions for writing combat in Inform games.
If you choose to use Armed, I'd advise you to use this version designed for Flexable survival.
a new beginning
Time to get started developing. In this example RPG, we'll create a one-roomed rpg with a bunch of monsters.
You can use whatever extension you wish. In this tutorial, however, we will be using Armed DR by Harry Gates (download link is above).
Open Inform on your computer, choose "start a new project" and fill out the text boxes. (For example, we'll call this project "Kill or Be Killed".)
Once you can read the source text, type the following text (making any changes as you type):
The story headline is "A Tutorial RPG".
The story creation year is 2015.
The story description is "A tutorial of creating an RPG with Inform 7.".
This information makes up the "bibliographic data" of your game. Now, include any extensions:
Include Armed DR by Harry Gates.
writing the introduction
Most IF games feature an introduction. You can leave this step out, if you wish. However, I'd advise you to write an introduction for your game. To do this in Inform, type the following text (and make any changes):
When play begins, say "Time to kill some monsters and stuff!".
(You can do other things in a when play begins rule, such as randomizing any stats, moving objects, etc. Just make sure you write a colon (:) after the words "when play begins". Here's an example:
When play begins:
move the magic mcguffin to the super evil cave;
say "Go find the magic mcguffin!".
weapons, monsters and rooms! Oh my!
In this section, we'll implement weapons, monsters and rooms in Inform.
The simplest thing to implement in Inform is a room. In this tutorial, all of the action will take place in one room: the cave of blood.
Type in the following code (and make any changes):
The cave of blood is a room.
"The walls of this cave are covered in blood, and the smell of death threatens to overwhelm you.".
The player will automatically be placed in the first room found in your source code.
An intigral part of a combat-focused RPG is monsters. All sorts of monsterous enemies can be implemented with Inform, from a werewolf who eats the corpses of the dead to a minataur with never-ending hatred for centaurs.
A "monster" kind is not implemented in the standard rules. However, we can make one of our own:
A monster is a kind of person.
Here are the monsters which we will implement in our game:
An orc, a troll and an axe-wielding minataur.
They, as with rooms, are easily implemented:
The orc is a monster in the cave of blood.
The troll is a monster in the cave of blood.
The minataur is a monster in the cave of blood.
You can change the stats of each monster, like so:
The max health of the troll is 125. The damage resistance of the troll is 5.
The max health of the orc is 130. The damage resistance of the orc is 7.
The max health of the minataur is 115. The damage resistance of the minataur is 4.
(Note that the damage resistance stat requires the Armed DR extension.)
weapons, weapons and more weapons!
Now, it's time to implement the tools of the trade: weapons.
Each monster has a weapon. The minataur, as said earlier, will have an axe. Let's give the troll a bludgeon (because... you know... a troll isn't complete without a club.)
And... Let's give the orc a rusty sword.
Here's the code that will implement our weapons:
The orc is carrying a blade called the rusty sword. The maximum damage of the rusty sword is 12.
The minataur is carrying a blade called the axe. The maximum damage of the axe is 15.
The troll is carrying a bludgeon called the bloody club. The maximum damage of the bloody club is 17.
ending the game
Every game has to end at some point.
we can end ours by tracking whether all three monsters are dead, thinks to a kind of rule called an every turn rule.
Such an every turn rule could be coded like this:
if the minataur is dead and the troll is dead and the orc is dead, end the game in victory.
We've now got a fully working RPG. You can now release the game by going to the release menu (alt on windows, ctrl+Option+M on the mac), pressing right arrow until you get to the release menu and pressing enter on the release option.
Of course, there are things you could do, to give your game more detail: adding descriptions to your monsterss and weapons, adding additional rooms/monsters/weapons, etc. However, this simple tutorial has come to a close.