Inform Work Notes

I’ve looked at Inform 7 two or three times in the past two years, each time devoting several days to it and then saying, “Nahhh.” After poking around for a few hours over the past couple of days with the latest version, I think maybe I can deal with it. Maybe.

My earlier reservations have not evaporated: I still feel that “natural language” programming is the wrong way to go, for several reasons. First, it requires materially more typing than conventional code. Second, statements that appear sensible to a human reader (that is, to the author) and will compile may not in fact work.

For an example of the first problem, consider the following code, first in Inform 7 and then in TADS 3. The two blocks do exactly the same thing.

The troll is a man. Understand “fearsome” and “intimidating” and “muscular” and “ogre” as the troll.

troll: Man ‘fearsome intimidating muscular troll/ogre’ ‘troll’

As far as I can see at the moment, almost every block of I7 code written during the course of game development will suffer from about the same amount of excess verbosity. For an example of the second problem, consider these two statements, both in I7:

The troll carries a club.

Instead of taking something when the troll carries the thing, say “The troll sneers at you. ‘You tryin[‘] ta get clobbered, bub?'”

My goodness, how could there possibly be a bug in that code? But there is. If the game includes the second statement, the troll will stop the player from ever picking up anything, even if he isn’t in the same location as the player character. The correct version is this:

Instead of taking something when the troll contains the thing, say “The troll sneers at you. ‘You tryin[‘] ta get clobbered, bub?'”

The difference: I’ve replaced “carries” with “contains.”

Interactive fiction programming is, of necessity, much concerned with the containment hierarchy — that is, with which objects are inside of, on top of, underneath, or behind other things. In this example, the word “carries” can be used to set up the containment hierarchy (thus making the club object a “child” of the troll object), but it cannot be used to test the containment hierarchy. Any native speaker of English can see at a glance that the two versions of the statement mean the same thing (indeed, “carries” is more sensible than “contains”!), but Inform can’t. Nor does it issue a compiler error. It just interprets what you’ve written in some bizarre manner and generates buggy game code.

If you’re not a programmer, it may not be obvious … but in a conventional programming language, making a mistake of this sort is somewhat more difficult. Not impossible (I’ve done it), but you have to work harder to fool the compiler.

This entry was posted in Interactive Fiction, technology, writing and tagged . Bookmark the permalink.

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