June 15, 2008

Introducing Parchment

A few weeks ago, I started a small project to create a user interface for something called a Z-Machine: a virtual machine created by Infocom in the late 1970’s to run their text adventure games—the most famous among them being Zork, which is apparently what the “Z” in Z-Machine stands for. These games, as their name suggests, are completely text-based; Infocom’s 1984 masterpiece The Hitchhiker’s Guide to the Galaxy, for instance, opens with this passage:

    You wake up. The room is spinning very gently round your head. Or at
    least it would be if you could see it which you can't.
    It is pitch black.

At this point, the player is presented with a prompt, where they can type what they want to do using natural english sentences; entering turn on light, for instance, would attempt to make the player turn on the room’s lights. For the most part, these games were like literary puzzles; at the beginning of Hitchhiker, for instance, the first “puzzle” is to figure out how to see things, and the next is to get over your morning migraine.

The interesting thing is that the virtual machine powering Infocom’s games lived past the company’s demise, which occurred in the late 1980’s: in the early 90’s, it was reverse-engineered by a clever mathematician-poet named Graham Nelson. A small but vibrant community rose up around this time, at first with the intent to create their own Infocom-style text adventures; but some of their works eventually surpassed anything Infocom had ever published. Because of the fact that some of these “games” were really more like interactive versions of novels or short stories rather than traditional puzzle-based adventures, the community decided to call them “interactive fiction”.

If modern video games like Halo and Grand Theft Auto are like movies, then interactive fiction is the literary equivalent. And in-line with this analogy, one of the many practical advantages of creating IF is that—unlike most video games that require programming and music and graphics—it’s eminently possible for a lone author to create something enduring.

Perhaps due to this low barrier, one of the things that I find particularly inspiring about the interactive fiction community is its diversity, especially in comparison to the modern industry of video game development. Unlike the video game industry, authors aren’t expected to have a technical background, and so the tools the community has created generally don’t assume any: one of the most popular programming languages for IF, called Inform 7, was actually designed by some of the most talented authors in the field, and the result is a fascinating rule-based language that reads much like literature.

Curiously, though, actually experiencing interactive fiction could be a bit cumbersome, as I found when trying to introduce friends to the genre: first, a user would have to download and install an interpreter application which was capable of decoding and providing a user interface for the work itself, which was contained in a story file that the user would have to download separately. Then, the user would have to open the story file with the interpreter. The amount of work involved in playing such a seemingly “low-tech” game seemed a bit out of proportion in comparison to the more multimedia-rich offerings available on the web through sites like Kongregate, which allow games to be shared and played with the click of a hyperlink.

Aside from that, though, there was another issue I had with most of the interpreters I’d used, which was that they didn’t seem to pay much attention to typography—for instance, they didn’t offer any mechanism for the author of a game to specify its typographic design, so as to let the typesetting honor the content in the best possible way.

The more I thought about it, the more the web actually seemed like an ideal place for interactive fiction to be experienced, rather than merely a more convenient one. HTML and CSS, for instance, provide far more flexibility for typography and layout than any desktop technology I know of, and the notion of a page with constantly-increasing length is much more suited to the medium than a computer terminal. Furthermore, recent advances in browser technology set forth by HTML 5 and implemented by standards-compliant browsers like Firefox, Safari, and Opera make it possible to save and restore games just like desktop interpreters, as well as play them while offline, all without the need of any special plugins like Flash or Java.

I actually found a Z-Machine interpreter already written in JavaScript, in the form of Thomas Thurman’s open-source Gnusto; the only problem with Gnusto was that it was a Firefox extension instead of a web application. So I took a look at its source code, removed the engine from the rest of the XUL-based user interface and decoupled it from its XPCOM dependencies, and used John Resig’s excellent jQuery library to make my own web-based user interface for it.

I called the result Parchment, because I wanted playing interactive fiction titles to feel as natural as reading from and writing to a sheet of paper.

Parchment, like Gnusto, is open-source; its Google Code project page is at http://code.google.com/p/parchment. It still has a number of bugs and missing features. One of the most rewarding parts of creating Parchment has been the feedback I’ve received from the interactive fiction community; the kind and enthusiastic people at rec.arts.int-fiction have been extremely helpful by providing me with encouragement, suggestions, advice, bug reports, and even code contributions.

While I’ve learned a great deal about web development from writing Parchment—it’s my first “real” web application, at least since the days when CSS was too cutting-edge to be useful across browser implementations—I’d like to focus on such things in later posts and conclude this one by linking to Parchment-powered versions of some of my favorite interactive fiction titles. These should work if you’re using at least Firefox 2, Safari 3, Opera 9, or Internet Explorer 6.

  • Wishbringer, written by Brian Moriarty and published by Infocom in 1985, was the first text adventure game I ever won, when I played it in 2004. Yes, 2004: unlike a lot of interactive fiction afficionados, I didn't play many of the genre's classics as a child, and certainly never completed any of them. This game was designed to provide a pleasant introduction to the genre, so the puzzles aren't particularly hard, but they're not trivial either. If you'd like more information, check out my Wishbringer review and see the Wishbringer Infocom Gallery page, which contains images of some of the great "feelies" that came included with the game's packaging.
  • Plundered Hearts, written by Amy Briggs and published by Infocom in 1987, was Infocom's first and only foray into the romance genre. It's also the only game of this genre that I've ever played or heard of, period. Set in the Carribean during the 1600's, it features one of the earliest examples of a strong female lead in a computer game. It's also a little harder than Wishbringer; see my Plundered Hearts review and the Plundered Hearts Infocom Gallery page for more information.
  • The Hitchhiker's Guide to the Galaxy, written by Douglas Adams and Steve Meretzky and published by Infocom in 1984, is one of the most infamous text adventure games ever made. It's also one of the hardest, in part because of the clever use of puns and wordplay required to solve its puzzles.
  • Photopia is the first of my selections that wasn't a published commercial game, but was a product of the modern era of interactive fiction. Written in by Adam Cadre in 1998 and winner of that year's community-wide Interactive Fiction Competition, this title is a touching interactive story that doesn't actually feature any puzzles. See Cadre's website for more information about this and other works of his.
  • Galatea, written by Emily Short in 2000, received the Best of Show prize in the community's Interactive Fiction Art Show of that year. Like Photopia, it's not a traditional adventure game; rather, it's like an interactive portrait, in which the player can converse with Galatea, the mythical statue-come-to-life created by Pygmalion. There is no "win condition" for the game and no real puzzles per se, but the plot is highly multilinear in that the player's conversation with Galatea can end in a wide variety of ways, some of which are more satisfying than others. See Short's website for more information about this and other works of hers.

If you liked any of these, you can actually play any game created by the interactive fiction community at http://parchment.toolness.com. Enjoy!

© Atul Varma 2017