Saturday, September 25, 2010

Inform7 Interactive Fiction

I made this interactive fiction project almost a month ago, but I wanted to post about it before I forgot entirely. It was written in Inform7 and it starts off like this:
"Birthday" by Kathleen Tuite
A top hat is worn.
I wanted to make a game for Adam's birthday. One without any art assets. The thought of having to design and build a game, and draw stuff for it, was kind of overwhelming, especially given that I didn't start until after his birthday and kind of wanted to finish within a day or two.

Once upon a time, Adam took this computer science class at UC Santa Cruz: Interactive Storytelling. I wasn't in the class, but I saw him write a crazy text adventure (Play it here! Troy) using something called Inform7. It might be cool to learn!, I thought, so I did.

What is Inform7? It is a free program that lets you compose interactive fiction/text adventures by writing English. Just a whole long list of natural language sentences describing the world or actions in the world. (The sentences don't even have to be organized particularly well... my story starts of rambling about cats and top hats before it even gets into describing the room layout of the world.) Then you hit 'play' and you get a cool little text-based world where you can walk around, interact with things, explore, solve mysteries, etc.

Screenshot of Inform7

The great thing about making a game this way is that you get all this rich, descriptive power for the low cost of writing out a few sentences. This book, written very recently by someone at UCSC, has a more descriptive and awe-inspiring chapter on the descriptive power of interactive fiction. I am no great IF artist (yet?) but here's how I described my couch:

A couch is an enterable supporter in the Living Room. "There is a couch in here, which looks perfectly sittable."


The description is "The couch is dark green leather with a few cat hairs stuck to it."


After entering the couch: say "The couch cusions give way with a little floof and you make yourself comfortable.".

I also added some cats to my game, because Inform7 already knows about things like people and animals:
A cat is a kind of animal.
A cat is either playful, hungry, bored, sleepy or sneezy.

To make the cats more catlike, I found a feline-behavior rulebook in the documentation and adapted it to fit the behavior of my own cats and to try to get them to follow the player around between different rooms.

The end result in my case, which took me about a day and a half to put together, including the time it took to learn Inform7, is playable here: http://superfiretruck.com/if4adam/. (Bonus, there's a 'for release' sentence you can add that spits out a pretty webpage for your game!)

Click here to check it out online!



The goal of the game is to find and eat the birthday cake. The catch is that you have to be in the presence of cats (have them in the same room with you) to enjoy the cake, so you have to find the cats also and have them follow you to the location of the cake. Play it and let me know what you think! I know it's not perfect and there are was to do unrealistic things or get stuck. Feel free to cheat by reading the source code.

1 comment:

  1. Hello, I've been trying inform7 for a while now, and it's great! I like how it's so easy to use, and how much you can do despite that. : D

    I'm going to try your game now!

    ReplyDelete