Parsed Programming With Inform 7

Text adventure games are an interesting branch of the extremely varied tree of videogames. While Spacewar started the 2D Multiplayer Shooter genre in the late 60s, you’re not going to mistake Pixeljunk Shooter for Spacewar. On the other hand, Colossal Cave (also from the 60s) looks pretty much the same as all other text adventure games, because text looks like text. Like books, text adventures are all about what’s written. Unlike books, the reader drives the story via their own input, and gets feedback according to what the author has told the computer to do.

Text adventures are almost all second-person perspective and present tense, something that is extremely rare in non-interactive fiction. “You are in a room. The daylight streams in through the window, making you squint slightly.” instead of “Conan was in a room. The daylight streaming in through the window made him squint slightly.”

You type into a parser what you want your in-game character to do and the game will describe what happens next:

“>close curtains”

“You close the curtains, though it is still quite bright in the room.”


“The south door is locked.”

“>unlock door with key”

“You do not have a key to unlock the door. Perhaps there is one hidden in the room somewhere.”

…and so on. The parser breaks down the phrases the player types in into commands that the game acts upon. Behind the scenes, the game keeps track of all the nouns (rooms, objects, creatures), the verbs the player can use (moving, taking items, wearing things), special events, and so on. If all goes well, the player doesn’t run into too many generic error messages and is able to figure out what commands to type to get through the game.

So far, so simple. AGT and others did all this a long time ago. But Inform 7 is different. Inform 7 has taken things a whole step further.

AGT made some big steps towards making adventure games easy to write. Creating a room is as simple as typing:

Top of Cliff

You are standing near the edge on the top of a tall cliff. To the east is a sheer drop of several thousand feet. To the north, west and south are paths that lead down the side of the mountain.

Now, that’s fine. But it’s very similar to programming in a programming language, especially when you get into Dummy Verbs and Meta-Commands. That still was a lot simpler than trying to write your own game from scratch in Pascal or whatever. But the way Inform 7 would do it is:

Top of Cliff is a room. “You are standing near the edge on the top of a tall cliff. To the east is a sheer drop of several thousand feet. To the north, west and south are paths that lead down the side of the mountain.”

Same functionality: much, much, much less like programming.

The clever part of Inform 7 is that they took the idea of parsing player commands and put parsing in the compiler. Writing a game in Inform 7 is just like typing a story, except you have to fix illogical statements (bugs) as you go along. The compiler will take care of translating your plain English into the actual code, and it will give you error messages in plain English. Sort of like what your English teacher might tell you, though exponentially more picky.

This is brilliant, and it’s a pity I had ignored the Interactive Fiction* scene for the last few years or else I could have written about this years ago. I don’t know if I’ll finish the game I just started (I have a bunch else to do right now), but it’s definitely a very interesting way of making games. Inform 7 is not going to replace C++ anytime soon, but it’s pretty much the way to make text adventures.

*Ever since the Internet became popular the cool name for text adventures is “Interactive Fiction”.

This entry was posted in Game Development, Video Games. Bookmark the permalink.

One Response to Parsed Programming With Inform 7

  1. midiguru says:

    Inform 7 is very attractive, and especially to non-programmers, because it tries to give you the impression that you’re not programming, you’re simply writing a story. Lots of authors of text-based games like I7 a lot, for that reason among others. (It also has a very nice integrated development environment.)

    Having written two complete games in it, I’ve become rather disenchanted. I’ve recently reverted to Inform 6, which is, frankly, programming — there’s no nice veneer of “just writing a story.” But in many ways, I6 is actually easier to use. That’s my personal opinion, anyway. I’m sure I’m in the minority.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s