Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

Writing Text Adventure Games

22 Dec 2012

How to write games such as Colossal Cave Adventure – also known as Adventure – or the Zork series? There are several frameworks helping you write your own.

I'm on about interactive fiction, here. The frameworks enabling you to write such text adventure games present approaches which are sometimes radically different. Here's an overview.

1 Inform 7

While Inform appears to be the leader in the field, I find it all more complicated than it needs to be – especially in version 7 – and I never managed to get very far with it. It seems that Chapter 3: Things is the best place to start – at least there's an example you can try out.

Running the Inform executable itself isn't explained as far as I could see, but just executing it launches an interactive interface that's fairly straightforward to use. Note that an index is generated which includes a map – a pretty neat feature: you'll need to fix it, though, because the image paths are wrong, so just sed through it.

2 Inform 6

2.1 Documentation

In fairness, you're still better off with Inform 6 which is easier to work with, more programmatic. The documentation it comes with isn't bad either. Note that you may want to start with Chapter II: Introduction to Designing. There's good examples too in /usr/share/doc/inform/demos.

2.2 Building, Running

That was pretty much guesswork on my part but in essence:

inform galleries.inf
jzip galleries.z5

If you're using a shared, interactive login service, note that you can easily build jzip locally and that there's no need to actually install it to build stand-alone executables:

jzexe galleries.z5 path/to/jzip

2.3 Shortcomings

3 TADS

The trouble with any version of Inform is that it was designed to write stories in a natural language, and I find that only makes things more confusing. TADS, however, is more about programming, with all the useful tools you might find convenient to describe your world. Besides, the documentation is a lot easier to follow and get you started in no time at all.

3.1 Getting Started

Best way to get started is probably by trying to follow A Very Simple Game tutorial. It covers how to start a new game and build it. In a nutshell:

  1. Create a directory where you'll put your files.
  2. Create the following t3m file, which is essentially a makefile of sorts:

    -DLANGUAGE=en_us
    -DMESSAGESTYLE=neu
    -Fy obj -Fo obj
    -o goldskull.t3
    -lib system
    -lib adv3/adv3
    -source goldskull

    Note that there is an example of a t3m file in /usr/share/doc/tads3-dev/examples/ but it's horribly complicated and obviously machine-generated anyway, so let's just say it doesn't apply.

    The t3 file is the output file, the source file is implicitly the t file and there is a reference to an obj directory which you need to create. Therefore:
  3. Create the obj directory.
  4. Copy the advanced starter game, which you'll be modifying directly:

    % gunzip -c /usr/share/doc/tads3-dev/examples/starta3.t.gz > goldskull.t
  5. Build with:

    % t3make -d -f goldskull
    Where -d compiles for debugging and -f implicitly refers to the makefile.
  6. Play with:

    % t3run goldskull

    Where goldskull implicitly refers to the generated t3 file.

4 References