Watch (and hear) the movie first!

      Quoth is a dynamic interactive fiction system, in which authoring is done from a player's perspective, from within the running work. Quoth draws upon the concepts of pervasive anthropomorphisation, executable natural language, and revisionist narrative. The major use of Quoth so far has been for musical livecoding.

      pervasive anthropomorphisation

      In traditional interactive fiction, the player speaks to an ominiscient interpreter. There may be dialogue with "non-player characters", but it is mediated by the interpreter. In Quoth the player is always speaking directly to some item in the universe. The traditional omniscient interpreter is represented by the universe itself.

      This allows for each item in the universe to have a different vocabulary, or even a different "interpreter" altogether. It also provides the player with more fluid interaction with each item.

      executable natural language

      As each utterance from the player is entered, it is treated as Smalltalk source code, compiled into a Smalltalk method, and run. I take advantage of the message-passing syntax of Smalltalk; statements in natural langages such as English may be expressed as sequences of unary messages. The method's receiver is the item to whom the player was last speaking. For example, a player might say, "Where am I?". That sentence would be compiled into a method which:
  • sends the message 'where' to the item to whom the player was last speaking
  • sends the message 'am' to the object answered by the previous message ('where')
  • sends the message 'i' to the subsequent answer
  • sends the mesage 'questionMark' to the subsequent answer
  • answers the result of the final message ('questionMark')
      Therefore, for each word in a given statement, there is a corresponding Smalltalk method. For most of the objects answered by these methods, there is a Smalltalk class that defines their vocabulary. For example, there is a class for the object answered by the 'where' message, and amongst its methods is one for the 'am' message. In this way the system provides a brute-force finite state machine for the interpretation of natural language, driven by input utterances.

      Most of these methods simply answer another state. In particular, those methods for words at which ambiguity remains in the utterance. The 'where' method above would be one of these. When there is no ambiguity, a method actually does something with a side-effect on the player's experience. In the above example, that point comes at 'periodCharacter'. Most so-called "active" methods correspond to the ends of sentences, or, more precisely, their punctuation ('periodCharacter', 'questionMark', and 'exclamationPoint'). Note that the names of these methods can't be confused with natural language words, since embedded capital letters don't occur there (this is another advantage I've taken of Smalltalk's syntax). Although one can argue that there is always ambiguity in a sentence until the final punctuation, in practice this is up to the discretion of the author implementing the words. For example, currently, in the example above, the method for 'am' decides that the only possible continuation is "...I?", ignoring the possibility of continuations like "...I going?"

      As one might expect, this scheme can lead to an explosion in the number of classes in the supporting Smalltalk system, as the vocabulary of items in the universe is developed. So far, this hasn't been a problem, as Smalltalk classes are not unusually large objects, and states are shared between partial sentences. For example, "Where am I?" and "Where are you?" share the class for 'where'.

      Smalltalk traditionally features the notion of method inheritance. Classes are arranged in a hierarchy. Instances of classes lower in the hierarchy understand messages implemented by classes higher in the hierarchy; the Smalltalk virtual machine refers to those higher classes when performing method lookup, in response to a message-send. Quoth augments traditional method inheritance by incorporating the containment hierarchy of items in the player's universe. For example, the player might be speaking with a chair. In addition to understanding messages implemented by a "physical object" Smalltalk superclass, it also understands messages implemented by the room that contains the chair, and the universe that contains the room. This allows the player to have generic conversations with specific objects (e.g., "What is in the room?") and further compacts the size of the implementation.

      The player can also teach new words and phrases to an item, using English. I support this through the addition of a few metaphors which fit stylistically with interactive fiction tradition. Here's a sample teaching session:

-	"Where am I?"

	"You're in the library," replies the note.

-	"Play 4 times."

	"You lost me at '4'," replies the note.

-	"I want to teach you to 'play 4 times'."

	"Great! Welcome to my mind," replies the note. The note's
voice echoes down the large marble hallway in which you now find
yourself. "The ring represents me." Glancing down at your hands, you
see a shining blue ring on your left thumb. "You can speak to me
through it. What you do while you're wearing the ring is what I'll
associate with 'play 4 times'." When you're done, take off the ring.

	  4 is here.

-	  You turn to speak to 4.

	  "Hi there," replies 4.

-	  "Replay what I do."

	  "Okay," replies 4, while drawing a large chalk circle on the
floor around you. "I'll watch what you do while you're in the
circle. When you're done, step outside it."

-	"Speak to the ring."

	"Hi there," replies the voice of the note, through the ring.

-	"Play."

	A note rings out.

	"Okay," replies the voice of the note, through the ring.

-	You step outside the circle.

	A note rings out four times.

	"Okay," says 4.

-	You take off the ring.

	"Okay, thanks for teaching 'play 4 times' to me," replies the
ring. You are once again in the library.

-     "Play 4 times."

      A note rings out four times.

      "Okay," replies the note.

-     "Play 5 times."

      A note rings out five times.

      "Okay," replies the note.

      Behind the scenes, the system is taking the natural language states traversed by the player and generating Smalltalk code from them. The chalk circle, for example, is a metaphor for a Smalltalk block closure. From the above exchange, the system generates the method body:

	self literal timesRepeat: [subject play]

      It's much more verbose than typical programming, but is very accessible to an uninitiated audience in a livecoding situation (see "motivation and influences" below). It's also still pretty fast to write, since the system has extensive prompting and auto-completion facilities (see the movie for examples). Indeed, writing has to be fast for the system to be usable in livecoding performances. What makes the system dynamic is that new classes and methods, and changes to existing ones, are made while the system is running.

      revisionist narrative

      Another distinction in play from traditional interactive fiction is that the system interacts with the player as each character is typed, instead of waiting for an entire line to be sent. Every character that the player sees is put there by the system (rather than being a mere "local echo" of what they have typed). This allows the system to revise what the player has typed, so as to create a more literary transcript of play.

      Some examples are familiar from previous command interpreters, such as the "shells" found in Unix systems. The system can auto-complete an utterance, or suggest possible next words, based on what has been typed so far and the currently implemented states. Other examples involve more radical transformations of typed text, typically representing a shift in voice. A player might type '"Look at the room."', but the transcript might show 'You look at the room.' (without quotation marks). A player's partial text might be interrupted entirely when another item in the universe (such as another player) makes an unsolicited remark to the player.

      motivation and influences

      I've been fascinated by interactive fiction since encountering Crowther's original "Adventure" on a VAX 11/780, and later, Infocom's "Hitchhiker's Guide to the Galaxy". I tried my hand at writing a game (in BASIC) soon after my introduction to "Hitchhiker's", but soon became overwhelmed by the details of managing a large collection of items, and dissatisfied with the simple "verb-noun" parser I wrote.

      School intervened, and years passed. I learned more sophisticated programming languages like Lisp and Smalltalk. In 2004 I found Nick Montfort's wonderful book, "Twisty Little Passages". While reading that book, a history of the genre and an exploration of its potential, several possibilities occurred to me. I had been tinkering with the idea of a "Smalltalk shell", as a more accessible version of the traditional Smalltalk "workspace". I had also been an improvisational musician for many years, and, through the TOPLAP group, I was wondering how I might use Smalltalk for musical "livecoding" in front of an audience.

      Writing code live for an audience presents severe challenges. The main one, of interactivity, seemed to be met nicely by the dynamism of Smalltalk. But equally great was that of accessibility for the audience. Most people don't understand a given computer programming language. Even Smalltalk, while very similar to English, can be hard to follow. And beyond the issue of syntax is one of attention focus. Most programming environments make use of many overlapping visual components, and it can be tricky to know where on the screen to direct your attention if you're not the one doing the programming.

      Interactive fiction seemed like a great simplifier. By using English as the programming language, more people would be able to follow individual expressions. By using an interactive fiction interface, the audience's attention would be focused where it needed to be. I set to work.

      Quoth made its debut at the Transmediale festival in Berlin, in February 2005. I made a customized musical version called musique littérale (a counterpart to musique concrète). Although the vocabulary I had implemented to that point was very small, it was well received. The sheer novelty of a musical interactive fiction livecoding system is enough to get an audience on your side for at least a few minutes. :)

      future work

      I'm eager to do more live musical performances with the system. My "studio time", however, is spent on larger infrastructural concerns. I want to make programming itself more accessible to people, and I think Smalltalk is a great starting point. I have developed a minimal version of Smalltalk, with a new collaborative progamming model. The project is called Spoon, and I intend for Quoth to be its first sample application. I'm working on a release system that can install and run Quoth, and provide tools with which one may modify it, and work on new projects.

      If you're interested in any of this, I'd love to hear from you!


      Craig Latta
      24 September 2005
      28 January 2011