The magazine of the Melbourne PC User Group
What's New in Inform 7?
Trevor Gosbell
|
|
Inform 7 was released on 30 April 2006, ten years to the day since the last major upgrade of the interactive
fiction authoring system. And it's an exciting leap forward.
But first, what is Inform 6?
Inform 6 is one of the most popular IF authoring systems. It was released on 30
April 1996 and has been more-or-less stable since then. The complete system
consists of two parts: the compiler and the library. As with any programming
language, the compiler is the practical implementation of the language. But more
significant is the library, which itself has two parts: the parser and the world
model. The parser contains the procedures for "understanding" the player's
English language instructions. The world model includes all of the rules for
making the game world work consistently (eg. objects stay where they are put,
descriptions of the game world reflect the changing events in the story) and
preventing ludicrous things from happening (eg. the player can't eat a table)
unless specifically programmed otherwise. Together the compiler and library
convert valid source code into Inform story files that can be read by any
Z-machine interpreter.
The architecture of Inform is extensible, allowing reusable packages of extra
rules to be added to the standard library to bring more sophisticated
"behaviour" to IF stories. An abundance of third-party extensions has been
contributed to the IF archive over the years, including some that completely
replace the standard library.
Inform 7
Unlike most software upgrades, Inform 6 is not superseded by Inform 7. In fact
Graham Nelson says that Inform 6 remains "an essential part of
the inner workings of Inform 7". The new version of Inform includes an
Integrated Development Environment (IDE), currently available for Windows and OS
X, and a "natural language" dialect.
It's got some IDE
Graham Nelson deliberately avoids using the term IDE in reference to Inform 7;
he prefers to think of it as an application with a book metaphor, saying in his
announcement on r.a.i.f http://tinyurl.corn/s9y9r:
The Inform user interface is based on a writer's manuscript book, opened to show
facing pages. The author writes on one page, Inform replies on the other. This
dialogue is not carried out in the traditional form of computer programs, but in
natural language.
Nevertheless, it most definitely is a new IDE that includes a source editor with
syntax highlighting, system documentation, integrated Z-machine interpreter, and
tools for recording activity in the interpreter (transcript and skein). Features
of the IDE include single step compile and run, the ability to replay the
previous sequence of instructions on a newly compiled game, detailed (and often
even helpful) error messages, an index that enables various views on the
structure
of the story (including a graphical world map), and automatic packaging of
stories for public release.
It's worth expanding a bit about the skein. While you are play-testing a game in
Inform 7, all commands issued are recorded for later possible playback. The
skein represents those commands as a tree, showing common threads and diversions
in paths that have previously been taken through the story. Along with the
transcript, the skein is a powerful debugging tool, allowing a bit of tinkering
with the command history and the ability to replay a specific sequence of
commands to a given point. All good stuff when sorting out what's going on (and
wrong) in a story.
It's only natural
Many would think the IDE alone would be improvement enough, but the addition of
a kind of natural language programming is a pretty exciting innovation too.
Listing 1 is an example — a small section of the classic Colossal Cave, taken
from the Inform 7 documentation:
Yes programmers, that is a code listing. Not a particularly exciting story as it
stands, but it's valid Inform 7 code that compiles and runs. Some programmers
will hate this verbose, pseudo English style of programming
and others will love it. The possible benefits and drawbacks for inexperienced
programmers are being actively debated on nail and the jury is still out. After
absorbing the Inform 7 documentation, I think beginners would be well advised to
skim through the Inform Designer's Manual (which covers Inform 6) to get a
better feel for what's going on behind the scenes.
Sweet
Inform 6 remains the underlying compiler, so the natural language aspect of
Inform 7 is essentially "syntactic sugar" — a pleasant layer over the mundane
details of Inform 6 code. Of course Inform 7 code isn't really prose
and the compiler doesn't really understand natural language: the grammar rules
are stricter than normal English and you can't say just anything and expect
Inform 7 to understand — it still needs to be programmed. In my initial dabbling
with Inform 7 I've found that I can't follow if-then and repeat loops without
indentation, so my code doesn't look much like ordinary written language.
Possibly the best thing about the natural language approach is not immediately
obvious — the ease of writing new rules for the game world. To my mind, it's
easier and more "human" to write your rules out in English than in the more
formal logic of unsweetened Inform 6 code. For example, something like this
(from Emily Short's worked example "Bronze"):
Instead of taking the jigsaw puzzle: say "If you took it, the pieces would fall
apart."
Or from the Inform 7 documentation:
Instead of eating something in the presence of Lady Bracknell, say "Lady
Bracknell disapproves thoroughly of gentlemen who snack between meals, and there
are few disapprovals in this world quite so thorough as Lady Bracknell's."
These are pretty shallow examples but the same idea is easily extended to do
some really sophisticated things in the game world.
Time will tell if this natural language approach is a
practical way to write programs, but it seems like fun and the ability to phrase
simulation rules in recognisable English is powerful.
Polished Performer
Graham Nelson and his team have
been working on Inform 7 for three years; and the effort has been well worth it.
At the time of writing, Inform 7 is in public beta release, so a few rough edges
are to be expected but it is a polished and professional offering. The new tools
in the IDE are incredible and incredibly useful and they can only help speed the
IF development process in Inform. And the natural language implementation is an
exciting initiative. Sure it's not "real" natural language but it has the
potential to attract new authors to interactive fiction and rekindle the
interest of those who have put IF on the back burner.
Now if you'll excuse me, I've got to go and dust-off some long-abandoned IF
projects...
Listing 1
"Cave Entrance"
The Cobble Crawl is a room. "You are crawling over cobbles in a low passage.
There is a dim light at the east end of the passage."
A wicker cage is here. "There is a small wicker cage discarded nearby."
The Debris Room is west of the Crawl. "You are in a debris room filled with
stuff washed in from the surface. A low wide passage with cobbles becomes
plugged with mud and debris here, but an awkward canyon leads upward and west. A
note on the wall says, 'Magic word XYZZY'."
The black rod is here. "A three foot black rod with a rusty star on one end lies
nearby."
Above the Debris Room is the Sloping E/W Canyon. West of the Canyon is the
Orange River Chamber. |
Reprinted from the June 2006 issue of PC Update, the magazine of Melbourne PC User Group, Australia