Metafilter is a website. A website can be boring or interesting.
April 30, 2006 8:08 PM   Subscribe

Inform 7 Released. Inform is a language used for creating interactive fiction, and is one of the most widely used languages for this task. After several years of effort, Graham Nelson has released a new version of Inform, and is seeking to create a new way of creating IF, with natural language instead of traditional programming code. [more inside]
posted by zabuni (38 comments total) 8 users marked this as a favorite
Here is an example of some source code for the new version of Inform:


The Trailer is a room. "A full-length mirror is the main amenity in here, and that suits you just fine." The full-length mirror is scenery in the Trailer. Instead of examining the mirror, try taking inventory.

The player wears a fedora, a jacket, a shirt, some undershorts, an undershirt, some slacks, a pair of socks, and a pair of shoes.

Underlying relates one thing to various things. The verb to underlie (it underlies, they underlie, it is underlying, it is underlaid) implies the underlying relation. The verb to be under implies the underlying relation.

The shirt underlies the jacket. The pair of socks underlies the pair of shoes. The undershorts underlie the slacks. The undershirt underlies the shirt.

Check taking off:
if the noun underlies something (called the impediment) which is worn by the player, say "[The impediment] is in the way." instead.

Carry out taking off:
now the noun is not underlaid by anything.

After taking off something:
say "You are now wearing[list of uppermost things worn by the player]."

Overlying relates one thing to various things. The verb to overlie (it overlies, they overlie, it is overlying) implies the overlying relation.

The jacket overlies the shirt. The shoes overlie the socks. The slacks overlie the undershorts. The shirt overlies the undershirt.

Before wearing something when something (called the impediment) which overlies the noun is worn by the player:
say "(first removing [the impediment])[line break]";
silently try taking off the impediment;
if the player is wearing the impediment, stop the action.

Before taking off something which underlies something (called the impediment) which is worn by the player:
say "(first removing [the impediment])[line break]";
silently try taking off the impediment;
if the noun underlies something which is worn by the player, stop the action.

Carry out wearing:
if the noun overlies something (called the hidden item) worn by the player, now the hidden item underlies the noun.

Instead of looking under something which is worn by the player:
if something (called the underwear) underlies the noun, say "You peek at [the underwear]. Yup, still there.";
otherwise say "Just you in there."

Instead of taking inventory:
say "You're carrying[list of things carried by the player][if the player wears something]. You are wearing[list of uppermost things worn by the player][end if]."

Definition: a thing is uppermost if it is not under something.
posted by zabuni at 8:08 PM on April 30, 2006

SHRDLU. Gesundheit.
posted by Roger Dodger at 8:11 PM on April 30, 2006

Interesting Roger, I had never heard of SHRDLU, the simularities are interesting. Nothing new under the sun.

Inform may succeed where that failed because it doesn't have to deal with the real world, and the problem space for interactive fiction may dovetail well with the abilities of natural language. Of course, it could easily fail because people who create interactive fiction may need the ambiguities that languages like SHRDLU weren't good at dealing with.
posted by zabuni at 8:19 PM on April 30, 2006

This is a very cool post. I can't wait to check it all out tomorrow.
posted by Roger Dodger at 8:21 PM on April 30, 2006

I've never been entirely sure of my opinion of interactive fiction, but this is a tremendously cool programming language. It even makes me consider writing my little IF story, which is always a good sign. (I'm pretty sure I'm not going to, but still.)
posted by blacklite at 8:33 PM on April 30, 2006

Er, my own little. Obviously I should learn how to write English first.

Anyway. Thanks, zabuni.
posted by blacklite at 8:34 PM on April 30, 2006

"natural" programming languages are great when you are learning the language (especially when you're a non-programmer), not-so-great when you've finished your IF coursework and are ready to do a serious project.

I can't imagine trying to do a major IF project like Facade in a natural programming language. It'd be fifty times the size of your average novel.
posted by xthlc at 8:42 PM on April 30, 2006

That looks completely bizarre and very neat. I will have to look at it more closely.

It looks like it would be hard to keep track of, though.... regular languages are short enough that you can get a great deal of meaning into a small space. It makes it harder for amateurs to work with, but when you're a professional, the compact representation can often help debugging.

Hazarding a guess, it looks like that language would be very, very hard to debug, simply because it's so verbose.
posted by Malor at 8:46 PM on April 30, 2006

Malor: From what I've heard it's somewhat hard to debug, but the IDE and docs are both excellent.

Of course, I'm basing this off of an afternoon of playing with it, so YMMV, but I was really impressed with the skein and the transcript tools.
posted by Remy at 9:19 PM on April 30, 2006

As a counterexample of Inform 7's readability, here's a routine from another one of the examples. I think it points out the limitations very well:

Before a creature trying accepting something when the person asked is occupied:
let N be the carrying capacity of the person asked;
let N be N minus 1;
if the number of things carried by the person asked is greater than N
try the person asked trying dropping a random thing carried by the person asked;
end if.

posted by majick at 9:21 PM on April 30, 2006

I know nothing about it, but another language intended to solve this kind of problem is Ren'Py.
posted by Steven C. Den Beste at 9:56 PM on April 30, 2006

Is Interactive Fiction ever seen as comparable to real literature, as an art form?
posted by stbalbach at 10:05 PM on April 30, 2006

I have to agree with xthlc. I've done some rudimentary coding in Inform. I've worked through "cloak of darkness", and coded my own simple 3 or 4 room set piece with about 20 items in it. Once you understand a language, natural language is only going to slow you down. It's much simpler to read code that's dense and in short snippets. And if the code in majick's example is "natural" language, I guess I don't understand what's naturnal about it. It reads like gibberish.
posted by cosmicbandito at 10:08 PM on April 30, 2006

Huh, this seems to be a functional style computer language, similar perhaps to Haskell (once you get over the syntax).

The problem with writing things out in 'natural language' is that you're using words that look like English to stand in for something more formal. Similarly, while it may read well (for the simpler cases at least), there are a large number of ways to write the same statements in everday english that aren't valid in this language.

I guess a good IDE could help with this though. I've never worked with a system like this before, I'm just skeptical about how much more useful or intuitive it is than a more traditionally styled domain specific language in this area would be.

I do like the style of conjugating verbs when you define them.
posted by Rictic at 10:22 PM on April 30, 2006

stbalbach, some fans consider the "Hitchhiker's Guide to the Galaxy" interactive game to be the best of the incarnations of HHGTTG.

The section where you have to get a babel fish from the machine is truly a masterpiece.

(Boy was that a long time ago!)
posted by Steven C. Den Beste at 10:31 PM on April 30, 2006

This is a very cool post. I can't wait to check it all out tomorrow.

Just what I was thinking.
posted by StickyCarpet at 10:38 PM on April 30, 2006

I fear that if I tried to code anything in this language, my code would end up in a maze of twisty passages, all alike...
posted by Windopaene at 11:49 PM on April 30, 2006

This is great! I've been slowly teaching myself inform for a long time now but the new version looks incredibly cool. I cannot wait to take it for a test drive.

Is Interactive Fiction ever seen as comparable to real literature, as an art form?

It comes pretty close sometimes. I know when Adam Cadre's Photopia was released there were quite a few people making those comparisons.
posted by LeeJay at 12:26 AM on May 1, 2006

Beat me to it. Photopia's amazing.
posted by Tlogmer at 12:38 AM on May 1, 2006

It is pitch black. You are likely to be eaten by a grue.
posted by MythMaker at 1:19 AM on May 1, 2006

Wow. It's been almost ten years since I wrote anything in Inform. I kind of liked the syntax of Inform 6, but I look forward to playing with this. Looks like an excellent IDE, at any rate.
posted by hades at 1:21 AM on May 1, 2006

The problem I've always had with these games is the learning curve to work out the language you have to use. For me, the first five minutes is always spent typing random nouns and verbs just to figure out what works - by that stage I've lost interest. In other games, I'm distracted by the purely linear nature. Ages spent wandering around some dark tunnel, trying every possible iteration of directions until you happen to find something interesting. That's not fiction, it's torture. I guess I'm speaking from a fairly small sample size, though, feel free to point me in the direction of examples of the genre that don't conform to these constraints.

I remember trying to write an IF / Adventure Game on my Amstrad, a long long time ago, with an effort made to avoid just these problems. The parser was designed to be very liberal with its interpretations. Almost any combination of noun and verb would do something. You could say "w" or "west" or "go west" or "walk west" or "run west" or or "skip west" or "jetski west" or "wander occidentally" and you'd end up being west of your current position. I also intended it to be very non linear. There were at least four completely separate ways you could get to the end of the story. Alas, that old 3" disk got corrupted. The program was written in BASIC and involved a lot of GOTO statements, I remember.
posted by Jimbob at 2:54 AM on May 1, 2006

Great post zabuni...
posted by runkelfinker at 3:17 AM on May 1, 2006

Jimbob, I know exactly what you mean: but in fact doesn't a larger vocabulary make things more difficult? Say you only have "go" and "with". When you're on the beach with the jetski you try "go west" and get "That is across water, and you ain't that holy!". So you do "look" and "exam" and find a jetski hidden under some seaweed: aha! you think, and try "go west with jetski", and you get "You zoom into the sunset, well done!"

Now instead of "go west with jetski" you have to do "jetski west" or "ski west" or some other alternative word. That's more effort, not less. I guess you're arguing that "go" or "ski" or "jetski" should all work, right? But then where's the fun of finding and working out that you should use the jetski? "Go west" "You find a jetski and go west." And that's kind of missing the point.

I suppose I'm arguing that a smaller vocabulary actually allows you (and the developer, importantly) to focus on the interesting roleplaying/problem-solving issue of combinations and events (e.g. a coin, a string, and a vending machine) and not the underlying mechanics (what words do I use for "tie" and "insert into machine while holding string"?)

That or natural language processing and human-level AI. Now that would be cool, but I don't think I'll live long enough to see that...
posted by alasdair at 3:53 AM on May 1, 2006

Now instead of "go west with jetski" you have to do "jetski west" or "ski west" or some other alternative word. That's more effort, not less. I guess you're arguing that "go" or "ski" or "jetski" should all work, right? But then where's the fun of finding and working out that you should use the jetski? "Go west" "You find a jetski and go west." And that's kind of missing the point.

Well, I guess the advantage I had with the game I tried to write, was that it was written from scratch in BASIC - no "Interactive Fiction" language, like Inform. Indeed, with all those nasty GOTO statements, I could even give each room it's own vocabulary, if need be. If there was a jetski in the room, I could adjust the language as such. Clearly, not the best way to write things, but it allowed for exceptions to the rule, if you like.

As an example of the kind of problem I had, here's the sort of interaction with a game I just found on one of the IF sites I got to through this site.

Visible items: Dead Messenger, Amulet
(For a start, a "dead messenger" isn't an item, is it?)
>look dead messenger
I don't know what "dead" is.
>look messenger
I see something!
>get amulet
>use amulet
I don't know how to use!
>throw amulet

At this point, I'm wondering where the humour / excitement / fiction comes into the equation. Once again, a single example. Each to their own, I guess.
posted by Jimbob at 4:44 AM on May 1, 2006

...By which I mean, when you say, throw amulet it should result in "You grab the amulet and throw it hard into the darkness. After a few seconds, you hear a distant clatter, echoing through the cavern. That didn't achieve much, apart from a few dents on its previously lustrous metal." When I say use amulet it should result in "How would you like to use it? I hear they look nice worn around one's neck." Maybe I'm just picking an example of a poorly written game, but this seems pretty common.
posted by Jimbob at 4:48 AM on May 1, 2006

some fans consider the "Hitchhiker's Guide to the Galaxy" interactive game to be the best of the incarnations of HHGTTG.

It's certainly the best text adventure game I ever played.

And you can now play it online.
posted by PeterMcDermott at 4:53 AM on May 1, 2006

For those mulling over writing their own interactive fiction, can I put in a plug for TADS, the Text Adventure Development System? Its idioms are meant to give C++ coders a tingly feeling, I believe, and TADS v3 makes many, many theretofore complicated things quite easy. There's a TON of source code out there to study, some of it (like the author's 'Ditch Day Drifter') very helpfully commented for learning purposes, and unlike the code above, you won't get the cognitive dissonance of extremely unnatural 'natural' language - Graham Nelson is awesome and his 'Craft of Adventure' is a classic, indispensible bit of writing on IF, but for reasons other commenters have articulated the Inform 7 code looks bloody murderous.

Before I'd ever written a line of 'real' code I was able to put together very simple TADS games, and once you know the language a bit the traditional loops and data structures really free you up.

Anyone who claims HHGTTG is the best interactive fiction game ever has not played much interactive fiction, sorry. I love it - one of my best childhood memories is that Babel fish puzzle - but is the place to look for far more informed opinions on what the best stuff is.
posted by waxbanks at 5:31 AM on May 1, 2006

Inform may not fly in this day and age, especially with children. Why? Because this type of entertainment medium requires imagination.
posted by rinkjustice at 5:56 AM on May 1, 2006

I haven't messed much with Interactive Fiction since Infocom was still in business. But here is a link to Galatea created by Emily Short, who is involved with Inform 7. Check it out, Jimbob, it may change your mind...
posted by Roger Dodger at 6:27 AM on May 1, 2006

Jimbob: Graham Nelson, author of Inform, feels the same way you do. In the Player's Bill of Rights he lists the right "Not to have to type exactly the right verb" and several other related rights. Later, he suggests that a game be playtested to find the kind of verbs a player will try, and to include sane replies:
The days of play-testing are harrowing. The first thing to do is to get a few “friends” and make them play for a while. Look over their shoulders, scribble furiously on a piece of paper, moan with despair and frustration, but do not speak. Force yourself not to explain or defend, whatever the provocation. Expect to have abuse heaped on you, and bear up nobly under the strain. To quote Dave Lebling (on testing ‘Suspect’, from an article in the “New Zork Times”):
“Sorry, I’ve been hired to mix drinks and that’s all.”
Many games don't get this kind of playtesting, or else you're the playtester.

Myself, I've never been a big fan of Interactive Fiction, but the Thy Dungeonman trilogy is a laugh a minute, because it's deliberately every cliche of interactive fiction (most recently, the addition of "graphics") and because the games can each be solved in a half hour or so, instead of the frustrating "never" of the Infocom 4-in-one sampler. (Granted, I must have been about 10 when I got that disk for my Commodore—maybe the puzzles weren't really that hard)
posted by jepler at 6:39 AM on May 1, 2006

I believe I was misinterpreted: some fans believe that the game is the best of the HHTTG incarnations.
posted by Steven C. Den Beste at 10:33 AM on May 1, 2006

That example code looks like an excerpt from a particularly obtuse translation of the I Ching. :(
posted by aparrish at 12:58 PM on May 1, 2006

I was totally going to post this, but then I got sucked into the documentation and fiddling about. 12 hours later...

One interesting thing about this is that the language itself is really Inform 6 in fancy new clothes - if you've ever done any inform coding, you'll be able to see the obvious parallels with inform 7 despite the natural language use. But there are new structures that fall from natural language that lend themselves well to the genre. There is more typing with the natural language system, and but I suspect the idiom will have its strengths when I get used to it, so that will be interesting to see.

As far as literate IF goes - Mr Plotkin's So Far is what I'd recommend - especially if you're a puzzle fan.

But anyhow - Inform is the reason I code for a living today. I compiled my first file (with any language) with it back in '95 so Inform 7, an old language wrapped in a new language wrapped in an IDE shaped like a book is a personal BOTW for sure.

Be sure to check out (you know, on usenet) for other reactions and developments.
posted by Sparx at 2:29 PM on May 1, 2006

ugh, this looks awful. Inform 6 was something I might have liked to play with, someday, but Inform 7 seems to have crossed the line between a programming language and a list of blather. I forsee that TADS will become much more popular in the near future!
posted by vorfeed at 2:32 PM on May 1, 2006

Yeah, vorfeed, I can't decide. I've written stuff in Inform 6, and this one looks promising for easier debugging and wealth of prefab logical concepts. "If player has been..."

On the other hand, the precious 19th century jargon -- the
"skein" and other features -- suggests the Victorian pretenses of the IF community have really gone out of control this time, and are going to scare away people who'd just like to write a fun Planetfall knockoff. This ain't the Diamond Age, whodi...
posted by Kirklander at 3:18 PM on May 1, 2006

This really looks fantastic actually. Cheers Graham!
posted by snoktruix at 6:46 AM on May 2, 2006

Just wanted to drop a note I'm working on a documentary on text adventures (GET LAMP) and I'm sometimes surprised who's lurking about, so if you were involved with text adventures a while back, I'd like to talk to you.
posted by jscott at 5:38 AM on May 5, 2006

« Older Maybe now Starfox will run at 60fps instad of 15   |   2400 Newer »

This thread has been archived and is closed to new comments