Writing Text Adventure Games
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
- I don't know if it's possible to automatically generate maps like with Inform 7, but that would be useful. Maybe it's easy enough to write a tool using Graphviz and looking for strings looking like
_to
. - Programming conversations isn't as straightforward as you'd expect. Having
Tell
react on the right topics isn't obvious. - I haven't found any interpreter with
readline
capabilities, which makes trying things out tedious.
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:
- Create a directory where you'll put your files.
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
Thet3m
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.t3
file is the output file, the source file is implicitly thet
file and there is a reference to anobj
directory which you need to create. Therefore:- Create the
obj
directory. Copy the advanced starter game, which you'll be modifying directly:
% gunzip -c /usr/share/doc/tads3-dev/examples/starta3.t.gz > goldskull.t
Build with:
Where% t3make -d -f goldskull
-d
compiles for debugging and-f
implicitly refers to the makefile.Play with:
% t3run goldskull
Where
goldskull
implicitly refers to the generatedt3
file.