Posted by midiguru on September 20, 2008
I think I’m about ready to give up on Inform 7 yet again. I hate to do it, both because the IDE (integrated development environment) is extremely nice, and because it’s such a popular authoring system for interactive fiction.
But It’s driving me bats. For two reasons:
First, the “natural language” programming paradigm, which seems to be immensely attractive to new authors, soon loses its appeal as you begin trying to do complex things, or even simple things that are not entirely standard.
A native speaker of English can typically phrase a given idea in a variety of ways (“Bob is standing on the cat’s tail,” “The cat’s tail is beneath Bob’s shoe,” “Bob is standing. His shoe is on the cat’s tail,” “On the tail of the cat is the shoe of Bob, who is standing,” and so on). Most of the time, Inform can only accept one wording of a given idea. Other wordings that seem both entirely sensible and entirely equivalent to Inform’s desired wording either will not compile, or will compile but won’t produce the desired results.
The I7 home page gives, as one of its key examples of the felicity of natural language programming, this sentence: “The prevailing wind is a direction that varies.” The fact that Graham Nelson (the author of Inform 7) feels this is a good example tells us a great deal, because to a native speaker of English, the sentence is gibberish. First, the wind is not a direction. The wind is a movement of air. Second, directions do not vary! They are fixed. North never becomes west (though it could perhaps do so in interactive fiction, at the cost of badly annoying anyone trying to play the game in question).
This sentence does in fact have a meaning in Inform 7. It means that the phrase “the prevailing wind” is being defined as a variable, and that this variable is to be initialized in such a manner that it can take on only one or another of the values defined within I7 as a direction. That is, the prevailing wind can be assigned the value north, northwest, or west, etc., but it can never be assigned the value 7 or “Tuesday.”
Is that clear to the non-expert who reads the sentence?
Second, the manual is a mess. This is perhaps especially surprising because the manual for Inform 6, which was Graham Nelson’s first authoring system, was a marvel of clarity. (In case you’re new to interactive fiction, I should perhaps explain that Inform 6 and Inform 7 have about as much in common as ice cream and a bicycle.)
What is being called “the manual” distributed with I7 is not in fact a manual at all. It’s a fairly reasonable tutorial; if you work your way through it faithfully, from start to finish, you’ll learn a heck of a lot, and the concepts unfold in a reasonably sensible order. But if you’re trying to look up some specific technique, and would like to read a complete, coherent discussion of that technique within a self-contained section of the “manual,” you’re doomed.
A single example will have to suffice. Chapter 12 is called “Advanced Actions.” This, one would think, would be the place one would go if one wanted to create a new action for one’s game (perhaps spearing a fish with a spear whose tip has to be sharpened first in order for the action to succeed — that seems reasonably advanced, in that it involves two objects, one of which has to be held and also has to pass the test [isSharpened=true]). But after two pages, one of which is devoted to a diagram of the manner in which I7 processes actions (that is, player commands), Chapter 12 goes scampering off after the question of how one writes code that will enable the player to give orders to other characters in the game (“Bob, spear the fish”). This material belongs in an entirely different chapter, one on the handling of non-player characters.
There is, in fact, such a chapter. It’s in a second, parallel document called the Recipe Book, which is also included in the distribution. But as can be deduced from its title, the Recipe Book is mainly a tutorial as well. It mostly eschews formal discussion of the minutiae of proper or functional code in favor of presenting numerous examples (the recipes), one of which may or may not have chunks of code that you can copy and adapt to your own purposes.
To develop a clear, logical understanding of I7 by reading the Recipe Book, one would need an extraordinarily well developed intuition.
As far as I can see, the only way to actually learn I7 is to post questions on the rec.arts.int-fiction newsgroup. As a publicity gimmick, this is a winner: 90% of the posts on r.a.i-f are about I7, which guarantees that it will be highly visible to anyone who is interested in interactive fiction. As a way of documenting the programming language, it’s … rather informal.