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!

34 Responses to “Introducing Parchment”

  1. Justin Dolske Says:

    Wow, awesome! Now I just need to get ahold of “Nord and Bert”.

    And isn’t “Leather Goddesses of Phobos” a romance? No? :-)

  2. Dennis G. Jerz Says:

    What a great tool! Thanks for your hard work. I’ve been looking for a convenient way to cite a saved game in an academic article… I can give a line number for a poem or a page number for a novel or a time index for a movie, but there’s no comparable way for me to let a reader jump right into a saved IF game in order to experience a brief bit of interaction. Yes, I can ask them to download the saved games, but even though that seems like a trivial task to anyone who knows IF, it’s just complex enough to make readers go “Forget it!”

    So I’m very excited about the possibility of being able to link to saved games… I wasn’t able to get that feature to work, but I see that it’s mentioned in your bug list, so here’s hoping it’s possible to fix the problem. (I’ve tried in both Firefox 2 and IE6 for Windows XP.)

    Thanks again for this great tool. I’m going to teach IF in two classes this fall, and I’d love to be able to have my students sample each other’s IF works and, using Parchment URLs, blog about their experiences.

  3. ex gnusto user Says:

    This looks awesome and fascinating in equal measure. I suspect when I sober up my opinion will will only be reinforced. Anything that makes software written for the Z-machine (or indeed IF generally) more accessible is a Good Thing. Thumbs up!

  4. namekuseijin Says:

    Yes, I’ve been watching this project closely for a while and sending links to friends. I hope we soon can digg this and let the world know there is interactive literature to counter the interactive B-movies that action games have become. :)

    BTW, the term “interactive fiction” was used in Infocom’s much acclaimed HHGG. They were previously marketing their games with the trademarked term “INTERLOGIC” but this seemingly didn’t quite say much about what it was really about, so they began giving subtitles according to some literary genre, prefixed by “interactive”. This is much more approachable and less puerile then “text adventure”. So, there…

  5. Ken Kennedy Says:

    Dude, this TOTALLY rocks. Thanks. I’m forwarding info on this to the PlayThisThing folks, as they sometimes review Z-Machine games, and have to give the “you need to d/l an interpreter” deal every time. This makes it seamless!

  6. Mike Beltzner Says:

    Well, I know what *I’m* doing for the rest of the week!

  7. Andy Kosela Says:

    This is definetly a great tool to make IF games more accesible to people. Although personally I prefer frotz and playing games in a text terminal, this is something which many people will find very useful.

  8. gru Says:

    This looks great, making IF instantly accessible from web pages!

    Two suggestions for minor improvements:

    Make PgUp/PgDn work for scrolling (there’s no scrollbar and up/down are for command history).

    Display a warning before the user tries to navigate away from the page, like e.g. Gmail does on the compose screen.

  9. Staś Małolepszy Says:

    Wow, this is awesome. You just brought my today’s productivity down to zero :)

    I’m particularly excited about the CSS support. Looking forward to your future posts to learn more about it!

  10. Charlie Evett Says:

    The web-player doesn’t seem to be working for me (Firefox 3 rc2). I get the list of titles but when I click on one I just get a blank page.

    No errors in Error Console.

    URL was:
    http://parchment.googlecode.com/svn/trunk/parchment.html?story=http://parchment.toolness.com/if-archive/games/zcode/geb.z5.js

    for example.

  11. Chuckybuck Says:

    Neato! I’m going to try this out dude. By the way you failed to remove the Leave-Comments option on your Livejournal entry.

    Also, just curious if you’ve ever played Homestarrunner.com‘s tribute to text based adventure games “Thy dungeonman” and the monochrome Apple II-like “Thy Dungeonman 3″ Great for laugh’s on a slap-happy Saturday night.

  12. db48x Says:

    This is brilliant. Excellent work!

  13. Aza Raskin Says:

    Wonderful! I’m looking forward to when when get IF which takes advantage of more advanced typographical styling as well as intra-person IF interaction. In other words, what innovation comes from IF being on the web.

  14. Chuckybuck Says:

    Hmmm, I tried out Rogue (ah brings back memories). Unfortunately once I get as far as typing in my name the screen goes blank and stays that way.

  15. Charlie Evett Says:

    Well, it’s working for me now. No idea what might have happened.

  16. namekuseijin Says:

    Charlie Evett, the link you gave is working for me in FF3beta4. It may take a while for the game to load and for the IF engine in javascript to process it, but at least that one definitely works.

    Perhaps the website has been dugg or slashdotted? ;)

  17. Andrew Wilson Says:

    I think the second Hitchhiker puzzle was meant to be a massive hangover, not a migraine.

    This is really great. I’m so looking forward to being eaten by a gru.

  18. D’log :: blogging since 2000 » The Lost Crown Says:

    [...] investigate this software — especially since future web browsers will be increasingly able to run sophisticated code without any plug-ins, potentially opening up lucrative new niche audiences for point & click adventures after [...]

  19. Atul Says:

    Oye, sorry for the really late response everyone. Hopefully some of you will still see my replies in this comment stream.

    @Dolske: LOL, I actually have yet to play Leather Goddesses. :)

    @Jerz: Hmm, the URL-saving feature should work on all browsers, but it’s not necessarily exposed in the most user-friendly way right now. I’ll email you to discuss this further.

    @namekuseijin: Ack, my bad about the etymology of “interactive fiction”–now that I think about it, I do remember seeing the term on the box covers from the Infocom Gallery. Thanks also for your continuous support of the project on the forums and elsewhere. :)

    @beltzner: Hmm, if you managed to play IF *and* launch FF3 in the same week, I’m impressed!

    @gru: Good suggestions–I’ve added them as issues 46 and 47.

    @charlie: Sorry about that, we really need to add a “loading…” screen to Parchment. Glad things worked out for you in the end.

    @chuckybuck: Sorry about that, zRogue is actually probably the “ultimate test” of Parchment since it supposedly uses some crazy obscure Z-Machine opcodes to do its stuff. Even after fixing a major bug this weekend that fixes issues with a lot of titles, zRogue still doesn’t work, so I made a new ticket for it. Hopefully we’ll have it fixed soon.

  20. Thomas Thurman Says:

    I am *so* pleased to see there’s still life in the Gnusto code!

    The original design of Gnusto was to run as a web-based thing (well, the *original* version ran from the Linux command line); it was only after I realised that it would be really difficult to find a way to make it work with as many browsers, JS UI libraries being rarer things in those days, and me not having access to anything that could run Explorer to test it, that I decided to move over to Mozilla. After that Eric Liga came along to help out, and we put together Gnusto as far as it went, but after a while XPCOM changed its structure enough that keeping it up to date was a fairly large difficulty and we both went on to other projects. The UI was always the most time-consuming and, frankly, the most boring part. Spec conformity was the interesting thing.

    Some people have thought, by the way, that I wrote the original version because I wanted a Mozilla-based interpreter, or something like that. It was actually because I thought it would be a fascinating project, from a computer science angle, to write a just-in-time translator from Z-code to an interpreted language, and JavaScript was convenient. (I remember I stayed up until dawn to write it.) So everyone who calls Gnusto a Z-machine interpreter is actually technically wrong– it’s a compiler. I don’t really mind, though. :)

  21. ᛏᚦ » Blog Archive » Parchment Says:

    [...] HOLY CRAP SOMEONE HAS FORKED GNUSTO IS THIS NOT SO COOL THIS IS SO COOL THANK YOU WORLD the end. [...]

  22. Thomas Thurman Says:

    (Oh, if you track this in ohloh.net, since any further work I do on the Gnusto engine will presumably be to help out Parchment, do you want to merge the two projects?)

  23. Atul Says:

    Hey Tom! We should definitely merge the two projects, it’s good to know you’re out there. :) And having read much of the Gnusto source code, I can definitely agree with the computer science angle–I’d never really known how a JIT worked, and being a high-level implementation of one, Gnusto was a nicely readable introduction to its mechanics.

    That’s really unfortunate about the XPCOM changing so much; this is indeed one of my misgivings about Mozilla chrome-space in general–because the majority of its users are core Mozilla developers who know it inside-out, there isn’t much of a desire or need to keep it well-documented or stable, which in some ways makes it quite agile (well, uh, as agile as something like XPCOM can be), but can also make things quite burdensome for newcomers and third parties.

  24. Marc Says:

    I have spent a few days working on a project to allow users to play interactive fiction from their web browser (therefore allowing the use of CSS and HTML tags). I started by developing a very simple home-made IF authoring system which allowed links and displayed exits and inventory items on the same screen. My project had many limitations because of my simple game engine (compared to other systems like TADS or Inform) and it was not portable because it was based on CGI scripts that work on my Linux computers but probably won’t work elsewhere.
    I had already started to consider the possibility of a firefox z-machine extension… And today I find out about gnusto and Parchment! The only thing I can say is “thank you for your great work!”.
    Now I only have to find out how to get a copy and make it work for me. Thanks again.

  25. Parchment on the iPhone at Toolness Says:

    [...] recently spent time making Parchment work properly on my new iPhone [...]

  26. Wiley Says:

    Is there a downloadable package so I can implement it myself? Google code roundabouted me to a directory full of javascript snippits with no documentation. I’m currently using Flaxo on my site, but the prospect of being able to style the output with CSS is really attractive.

  27. Jason Orendorff Says:

    Hey. Is the source available anyplace other than by starting at http://parchment.toolness.com/ and following URLs? The IF community should be using this everywhere. A little more packaging effort might go a long way.

    Oh, and there might be a feature or two I’d be interested in implementing…

  28. Dannii Says:

    Jason, the project’s site is at http://code.google.com/p/parchment

    The files can be downloaded, you need just parchment.html, parchment.css and the lib folder.

    And any help for bugfixing etc would be greatly appreciated!

  29. matt w Says:

    Hi, I don’t know if this is the place for a bug report, but in a couple of games from the IFComp I’ve gotten a bug in Parchment when disambiguating. To see this in action, go to Byzantine Perspective and type “fix goggles.” The author didn’t get the bug when running in her own interpreter, so it may be a Parchment bug. Thought I’d let you know. E-mail me (or leave a comment on my blog) if you want more detail about the bug (and the other place I found it).

  30. Jason Brown Says:

    Hi. First of all i would like to compliment you on Parchment. I have been using Inform 7 for some time, and really like the interface. Second I was wondering if there was any way that you can think of to implement Parchment on one website that would host many different IF’s that could be contributed by different authors. A novel idea.

  31. aguy Says:

    Please wait while Parchment loads.
    Retrieving story file…

    i cant pass this screen. It cannot load the js file :(
    either with firefox 3.6 or ie 8

  32. Atul Says:

    @aguy: I think that this was a bug caused by some recent changes to the source code, but my understanding is that Dannil has resolved them, so things should work now!

    @Jason: Thanks! Dannil has some plans to implement a “virtual library” to do the sort of thing you suggested. You can find out more and participate at the Parchment Google Group.

  33. Twitblob at Toolness Says:

    [...] the past few years, I’ve made a number of little Web applications that are actually just HTML [...]

  34. Floyd Says:

    Great work! An Infocom-Interpreter which works offline on my kindle!
    To make the kindle experience even better, here my feature requests:

    - the border around the input is ugly (seems only to show up on kindle)
    - scrolling does not work really good on epaper. If you could turn it into paging, this would be great!
    - and if this paging could work through the page forward and backward buttons of the kindle, this would be awesome. I guess these buttons are mapped to page-up/down.