TextWorld (Inform 7 & machine learning)

Inform 7 is used in a number of contexts that may be slightly surprising to its text adventure fans: in education, in prototyping game systems for commercial games, and lately even for machine learning research.

TextWorld: A Learning Environment for Text-Based Games documents how the researchers from Tilburg University, McGill University, and Microsoft Research built text adventure worlds with Inform 7 as part of an experiment in reinforcement learning.

Reinforcement learning is a machine learning strategy in which the ML agent gives inputs to a system (which might be a game that you’re training it to play well) and receives back a score on whether the input caused good or bad results. This score is the “reinforcement” part of the loop. Based on the cumulative scoring, the system readjusts its approach. Over many attempts to play the same game, the agent is trained to play better and better: it develops a policy, a mapping between current state and the action it should perform next.

With reinforcement learning, beacuse you’re relying on the game (or other system) to provide the training feedback dynamically, you don’t need to start your machine learning process with a big stack of pre-labeled data, and you don’t need a human being to understand the system before beginning to train. Reinforcement learning has been used to good effect in training computer agents to play Atari 2600 games.

Using this method with text adventures is dramatically more challenging, though, for a number of reasons:

  • there are many more types of valid input than in the typical arcade game (the “action space”) and those actions are described in language (though the authors note the value of work such as that of BYU researchers Fulda et al in figuring out what verbs could sensibly be applied to a given noun)
  • world state is communicated back in language (the “observational space”), and may be incompletely conveyed to the player, with lots of hidden state
  • goals often need to be inferred by the player (“oh, I guess I’m trying to get that useful object from Aunt Jemima”)
  • many Atari 2600 games have frequent changes of score or frequent death, providing a constant signal of feedback, whereas not all progress in a text adventure is rewarded by a score change, and solving a puzzle may require many moves that are not individually scored

TextWorld’s authors feel we’re not yet ready to train a machine agent to solve a hand-authored IF game like Zork — and they’ve documented the challenges here much more extensively than my rewording above. What they have done instead is to build a sandbox environment that does a more predictable subset of text adventure behavior. TextWorld is able to automatically generate games containing a lot of the standard puzzles:

Screen Shot 2018-08-26 at 2.19.51 PM.png

Continue reading

Narrative Design Toolkit (Gamisolution)

narrativedesignThe Narrative Design Toolkit (available in both English and Spanish) is a deck of cards intended to help the user think through the creation of a new plot, starting with a twelve-card representation of the Hero’s Journey as the basis for elaboration.

As the picture shows, it’s got a simple but stylish design, and includes cards in different colors to represent events and character archetypes, drawing on the writing of Jung and Propp, Campbell, Rodari, and Vogler. Cards include elements such as “the Shadow,” “the Innocent,” “the Grump,” et al. (I think some of the more personality-driven archetypes may have been supplied by the creators of the deck, since they alone don’t have an alternative attribution on them.) Meanwhile, it skips some of Propp’s more specific and startling elements, such as “The hero follows bloody tracks” or “someone pursues the hero, rapidly transforming himself into various animals.” (Though even that’s not as wild as some of the stuff in S. Thompson’s motif index of folk literature, featuring motifs like “Cow drops gold dung” and “Council of fishes decide to get rid of men (who eat fish)” and “Sun and moon born of lizard”. I could page through that stuff all day.)

I myself probably wouldn’t call this a toolkit for narrative design overall so much as a toolkit for plot generation — but that’s still an interesting and useful thing, potentially. Different writers wrestle with different aspects of writing, but “I hate plotting!” is a more common cry than one might think.

Those who’ve been tracking this blog for a while will know that I’m skeptical of the Hero’s Journey and especially of its overwhelming prevalence in game narrative how-to books; also that I’m a total sucker for card decks designed to inspire creativity or to teach IF methods or to tell stories. Likewise tabletop RPGs that offer interesting rules for inventing plots and characters, and the whole challenge of thinking procedurally about the working elements of story. So I went into this unsure whether I’d turn out to like it a lot, or find it very exasperating.

The recommended method for using the Narrative Design Toolkit is perhaps a little underspecified relative to one of those RPGs. It suggests that you:

  1. Lay out cards 1-12 representing the stages of the hero’s journey, then
  2. Swap, remove, and/or replace those cards with other cards in whatever way you wish.

So all in all rather a loose grammar. However, I did sit down and follow these rules.

Continue reading

Notes on the Direction of Inform

Yesterday Graham Nelson spoke to the Oxford/London IF Meetup about what he has been doing with Inform recently, what has and has not been successful (in his view), and where the project is going next. The slides and text are now available here.

Because the talk is intended for a mixed audience, it does explain some things that readers of this blog may already know well, but by the later part of the talk is introducing some new elements.

Generominos (Kate Compton)


Generominos is a deck of cards designed to help the user think of possible generative art and visualization projects. Some of the cards describe input types (words, images, geographical locations, etc); others describe output formats (3D printed shapes, light changing glass, and so on); and then there are a number of cards that describe ways of transforming one type of data into another. The ideas generated would be suitable for lots of applications, from alternative game controllers to computational-creativity crafts to data visualizations to museum installations.

There are additional project modifiers that suggest purposes for the project (making a creative activity for a senior center, for instance, or put it someplace where no humans can see it).

The cards make a cool teaching (or self-teaching) tool, both around process — how might you change one kind of data into another? — and about specific techniques. Kate has a wide experience with generative art forms in both physical and digital space, which means she includes ideas like “express your output in colored fire” or “attach a webcam to a microscope to observe microbes moving” or “get ocean condition data from NOAA’s API”. Even with a fair amount of experience in related spaces, I found a shuffle through the cards suggested a lot of possibilities I hadn’t considered. So it’s an interesting place for beginning-to-intermediate users to start thinking about generative art design. It also provides a bit of framework for more advanced users: you can add your own cards as you think of new methods and inputs, and then play with how those might generate interesting new combinations.

The flip side of this: the cards may suggest a cool project that would be prohibitively difficult or expensive to build at home, or that would require a dive into new code or algorithms to realize. And in some cases, a little more context might be useful. For instance, the card on word2vec accurately explains that you put a word in and get a vector out, but there’s not enough room on the card to talk about the ways word2vec is often used to get from one input word to another, or to calculate analogies.

So actually building a project based on these ideations is possibly not a beginner-level task; or, to be more precise, the cards may not give enough information for a beginner-level user to tell which concepts would be accessible enough for them to implement from scratch. One might need to do some additional research into particular techniques, or be encountering the cards in a classroom or workshop context.

Bonus recommendation: Rich Vreeland gave some great talks at the AI Summit this year about the procedural music for Mini Metro and about sonification in general as a way of understanding data (instead of or alongside visualization). If you happen to have GDC Vault access for 2018, that material is definitely worth checking out.

Mailbag: IF Infrastructure From Scratch

I reached out to you a while ago to ask about your consultation services / fees and you told me that you weren’t taking on any new clients.  I respect that.  I was hoping you might “mailbag” my question or maybe have a little advice off the top of your head.  Any help would be greatly appreciated!  I posted this on the IntFiction forums as well and just hoping to get a little bit of your expertise / feedback.

I am working on a CYOA sandbox visual novel project. My buddy wrote a framework in C# / Unity and I’m currently writing the story in OneNote / Scrivener with articy:draft doing a lot of the node-work / structural organization. I used SimpleMind to do some high-level mapping for the sandbox but it’s been very clunky. I reverted to using Excel so I could bring direct mathematical tests into my work for planning and it’s been really tough to combine the cell-based organizational structure with blocks of text.

Creatively – I don’t write well in little bubbles…at all. I prefer writing in a Word / WordPerfect / Scrivener / Notepad setting. It’s easiest for me to see all the text, re-read what I need to, edit, etc. I’m at a point where the story is getting difficult to test / debug / and translate into Unity. At the end of the day – whatever tools I use – I have to be able to hand my work over to the developer and make sure he understands everything in as neat / concise a manner a possible.

Here’s an example of some of my code:

\INSTRUCTION((ONCLICK.CELLPHONE)(=)(0)) // sets the variable that counts the number of clicks to zero – variable declaration


     \INSTRUCTION((ONCLICK.CELLPHONE)(+)(1)) // adds 1 to the counter variable

     \CONDITIONTEST((ONCLICK.CELLPHONE)(=)(1)) // tests the counter variable – boolean (true / false)


               \ITEMDESCRIPTION((CELLPHONE)(ONCLICK)(This is your cell phone)) // cell phone description on the first click



               \CONDITIONTEST((ONCLICK.CELLPHONE)(=)(2)) // cell phone description on the second click


                         \ITEMDESCRIPTION((CELLPHONE)(ONCLICK)(This is STILL your cell phone))



                \CONDITIONTEST((ONCLICK.CELLPHONE)(>)(2)) // cell phone description on every click after second


                           \ITEMDESCRIPTION((CELLPHONE)(ONCLICK)(Why do you keep checking your cell phone?))






The bottom line: Some of what I do is creative writing – storytelling, dialogue, and narration / item / entity descriptions, etc. And the other part of what I do is basically writing the instructions to the developer so he knows when to call which functions and how the visual novel is basically supposed to operate. Does that make sense? It’s super time-consuming because I have to partition portions of my mind to work on the tasks separately. My biggest hurdle to overcome is finding a medium in which to do this. I can’t write everything in Unity because I don’t know the C# code and that’s really what my buddy is there for. I’d write everything in Scrivener but I need the math functionality.

Continue reading

Mailbag: QBN System Variants

Hello Emily,

I was reading through your blog and, in your post dated May 25, 2017 you describe several narrative systems, and the last one you write about you name it “System with Dynamic Requirements”

I’ve been working for a couple years now (on my free time) on a system that is very similar to what you describe: A tool to create narrative very similar to the way QBN does but with dynamic requirements for actors and locations.

The main difference is that it is a system to run over a real time game and the choices are done by gameplay inputs instead of selecting or letting the game select.

The tool provides a visual-node interface to create attributes and rules. The player actions trigger events on the system (i.e. looting a body trigger and event and we can create a rule on the tool that say “when loot event is triggered add attribute looter to the player”) and the attributes are evaluated continuously by the rules and giving results (i.e. If player have looter attribute with a value higher than 5 add world attribute “looter missions activated”)

Of course, there are the dynamic requirements that I’m using as I think the player’s engagement will be higher if the characters used on the story are people they “choose” to met in the game instead of previously designed so I can check if at one point they helped someone to escape or to acquire some item or whatever and later check the list of actors and use that one to be part of the story, or I can check between the locations in the world and create a mission that use a location with a certain attributes instead of always the same location for the same mission.

My question is: Do you know about other projects working on the same line?

Sort of, depending on how precisely you define “the same line”.

I know of projects that make use of Node-RED to visually define rules for various purposes other than interactive narrative rules.

I know of IF games, including my own, that allow the player to unlock new gameplay and story sections with any item that matches some general requirement; and sometimes a puzzle will have multiple solutions, but the specific solution the player picks turns out to be important or expressive in some way, or is used to judge the protagonist’s character.

I know of experiments with dynamically-gated story elements — most (but not all) of these tools in the academic space rather than among hobbyist IF tools or (for that matter) commercial video game tools. You may be interested in Ian Horswill’s Dear Leader’s Happy Story Time, described here in an academic paper with references and mentions of other related academic projects, or here in a video talk. (The references here provide a lot of potential further searches, with context.)

I know of realtime games that serve up specific beats depending on what tags are currently matched about world state. See Elan Ruskin’s work for Left4Dead, covered in this excellent talk. This is salience-based matching for various world states, which then in turn influenced the design of the dialogue-fitting in Firewatch. Not the same as constraint solving, but relevant to some of your other points about wanting to unlock specific story beats if the player has the right background.

I do not know of an existing tool with all the features you describe: a visual interface to create the rules for a dynamic-conditions interactive narrative system, applied to a realtime experience. (That’s not to say no one’s building one. I just haven’t seen it.)

That said, I’d like to suggest that you’re opening not just a technical space but a challenging design space, and you’ll want to test your assumptions about the player experience. There are some finished, public examples of games that do play a little in this space. For instance, games in the Fable series assigned story importance to figures the player had spent time with. I would suggest, based on my experience with that, that your initial assumption (“the player’s engagement will be higher if the characters used on the story are people they “choose” to met in the game instead of previously designed”) may not be true in all cases.