Visualizing Procgen Text, Part Two

In a previous post (now several months ago — sorry!) I wrote about visualization strategies for looking at procedurally generated text from The Mary Jane of Tomorrow and determining whether the procedural generation was being used to best effect.

There, I proposed looking at salience (how many aspects of the world model are reflected by this text?), variety (how many options are there to fill this particular slot?) and distribution of varying sections (which parts of a sentence are being looked up elsewhere?)

It’s probably worth having a look back at that post for context if you’re interested in this one, because there’s quite a lot of explanation there which I won’t try to duplicate here. But I’ve taken many of the examples from that post and run them through a Processing script that does the following things:

Underline text that has been expanded from a grammar token.

Underlining is not the prettiest thing, but the intent here is to expose the template-screen-shot-2016-09-11-at-4-45-52-pmstructure of the text. The phrase “diced spam pie” is the result of expanding four layers of grammar tokens; in the last iteration, the Diced Spam is generated by one token that generates meat types, and the Pie by another token that generates types of dish.

This method also draws attention to cases where the chunks of composition are too large or are inconsistent in size, as in the case of the generated limericks for this game:

screen-shot-2016-09-11-at-4-45-28-pm

Though various factors (limerick topic, chosen rhyme scheme) have to be considered in selecting each line, the lines themselves don’t have room for a great deal of variation, and are likely to seem conspicuously same-y after a fairly short period of time. The first line of text locks in the choice of surrounding rhyme, which is part of why the later lines have to operate within a much smaller possibility space.

screen-shot-2016-09-11-at-4-45-36-pmIncrease the font size of text if it is more salient. Here the words “canard” and “braised” appear only because we’re matching a number of different tags in the world model: the character is able to cook, and she’s acquainted with French. By contrast, the phrase “this week” is randomized and does not depend on any world model features in order to appear, so even though there are some variants that could have been slotted in, the particular choice of text is not especially a better fit than another other piece of text.

This particular example came out pretty ugly and looks like bad web-ad text even if you don’t read the actual content. I think that’s not coincidental.

screen-shot-2016-09-11-at-4-45-59-pmColor the font to reflect how much variation was possible. Specifically, what this does is increase the red component of a piece of text to maximum; then the green component; and then the blue component. The input is the log of the number of possible variant texts that were available to be slotted into that position.

This was the trickiest rule to get to where I wanted it. I wanted to suggest that both very high-variance and very low-variance phrases were less juicy than phrases with a moderate number of plausible substitutions. That meant picking a scheme in which low-variance phrases would be very dark red or black; the desirable medium-variance phrases are brighter red or orange; and high-variance phrases turn grey or white.

Here “wordless” and “lusty” are adjectives chosen randomly from a huge adjective list, with no tags connecting them to the model world. As a result, even though there are a lot of possibilities, they’re likely not to resonate much with the reader; they’ll feel obviously just random after a little while. (In the same way, in the Braised Butterflied Canard example above, the word “seraphic” is highly randomized.)

Finally, here’s the visualization result I got for the piece of generated text I liked best in that initial analysis:

screen-shot-2016-09-11-at-4-45-44-pm

We see that this text is more uniform in size and color than most of the others, that the whole thing has a fair degree of salience, and that special substitution words occur about as often as stressed words might in a poem.

*screen-shot-2016-09-11-at-5-25-03-pm

There’s another evaluative criterion we don’t get from this strategy, namely the ability to visualize the whole expansion space implicit in a single grammar token.

Continue reading

Visualizing Procgen Text

Lately I’ve been aggressively telling everyone I know to do more visualization of the systems they’re building, and thinking about what that might mean for the procedural text experiments I’ve been up to.

If you’ve played with The Mary Jane of Tomorrow, you’ve probably noticed that some of the poems it generates show a lot more variation and richness than others. That’s easy to observe, but can we quantify it? Can we draw observations about what level of complexity is the most satisfying, and identify portions of the game where more or less complexity would improve the experience? If we’re procedural text artists, how do we decide where to direct our attention?

One of the fun/horrifying things about this particular medium is that it pretty much never feels like you’re done: it would always be possible to add more corpora and more variant templates. Both Mary Jane and Annals of the Parrigues came to an end because I needed to move on to other work, not because I couldn’t think of anything further to add. But one thing I might want from a procgen text tool is help discerning where the biggest blank spots are currently.

The first step towards visualization is of course figuring out what aspects of the system you might want to look at, and in fact I often find “how would I draw a picture of this?” to be a good way of making myself think about the salient qualities of a particular system. Here are the things I decided I wanted to know about the text in Mary Jane:

Size of component phrases: how long is the smallest atom of text in a given composition? When you see something in the text, was that produced by a human or is it the juxtaposition of several pieces selected algorithmically? This is very varied in Mary Jane, with some poems or conversation options picking entire sentences, and other selections being just a word or two long. (Parrigues goes even further and composites town names from constituent syllables, but Mary Jane isn’t going that far.)

Number of alternatives: if a phrase was picked from a list, how many other options were there? Number of options is going to determine how unique a particular element is in your experience of the text.

Salience of selected phrase: why did we pick this piece? How many pieces of information about the world model did it have to match in order to be selected? (And to combine those two points, if we picked a highly salient phrase, how many other options were there of equal salience?)

Continue reading

Writing Interactive Fiction With Twine (Melissa Ford)

WritingInteractiveFictionA curious and fascinating thing about Melissa Ford’s Writing Interactive Fiction with Twine is how it combines hypertext craft advice and Twine syntax tutorials with design expectations largely derived from parser-based interactive fiction.

This is a 400 page book about Twine fiction whose index lists Anna Anthropy once (in a passage discussing how she did geographical description in one of her games) and Porpentine never — though it does refer, without attribution, to the tiny Twine jam Porpentine ran. Steve Meretzky and Brian Moriarty appear, but not Michael Lutz or Tom McHenry or A. DeNiro or Caelyn Sandel or Dietrich Squinkifer, nor Michael Joyce or Shelley Jackson or other luminaries from the literary hypertext tradition either. The book has early and prominent chapters about how to design puzzles, inventory, and a room layout; fonts, text transitions, and CSS effects come quite a bit later, despite being much more common than inventory systems in practice. The section on genres starts with a helpful definition of the word “genre,” then runs through bite-sized descriptions of some common fiction genres — rather than, say, trying to describe the range of genres represented in current Twine fiction. The section on story structure explains terms such as “climax” and “exposition” from scratch, assuming essentially no writing-workshop-style experience from the reader.

This writing style, along with the tendency to draw examples from Narnia and Harry Potter, suggests that the author intends the book to be accessible to younger users as well as adults. It would probably be a bit over the head of most young children, but I could picture a motivated tween handling it just fine. Possibly that accounts for a decision not to explore much of the most innovative content for which Twine has been used. If you’ve read Videogames for Humans, almost none of what you saw there is replicated or even mentioned in this book.

Continue reading

Beyond Branching: Quality-Based, Salience-Based, and Waypoint Narrative Structures

This blog post has a more than usually technical title, for which I apologize. It’s inspired by some recent conversations in which I hear people saying “branching narrative” to mean “narrative that is not linear and in which the player has some control over story outcome,” apparently without realizing that there are many other ways of organizing and presenting such stories.

There is a fair amount of craft writing about how to make branching narrative thematically powerful, incorporate stats, and avoid combinatorial explosions, as well as just minimizing the amount of branching relative to the number of choices offered. Jay Taylor-Laird did a talk on branching structures at GDC 2016, which includes among other things a map of Heavy Rain. And whenever I mention this topic, I am obligated to link Sam Kabo Ashwell’s famous post on CYOA structures.

This post is not about those methods of refining branching narrative; instead it’s describing three of the (many!) other options for managing the following very basic problem:

My story is made of pieces of content. How do I choose which piece to show the player next?

In this selection I’ve aimed to include solutions that can offer the player a moderate to high degree of control over how the story turns out, as opposed to affect or control over how the story is told.

I’ve also picked approaches that are not primarily based on a complex simulation, since those — from Dwarf Fortress to Façade — tend to have a lot of specialist considerations depending on what is being simulated, and often they’re not conceived of the same way in the first place. So with those caveats in place…

Continue reading

Set, check, or gate? A problem in personality stats

As I’ve mentioned here before a few times, I’m working on a project for Choice of Games, and it’s once again brought me up against a challenge I’ve run into a few times before when writing for Fallen London and to some extent with Versu. As mental shorthand, I’ve come to think of this as “the check-or-set problem,” though really it should maybe be the check-set-or-gate problem. It is as follows:

When you’re writing in a choice-based medium backed with stats – so ChoiceScript, StoryNexus, Undum, Ren’Py, possibly a hand-rolled Twine system, or inklewriter if you choose to use variables extensively – you have to decide how to treat choices that relate to personality stats.

When I say personality stats, I do not mean “all stats that might make up the protagonist’s profile.” Choices that have to do with resources – how much money you have left, how many classes you have time to take – are comparatively easy to deal with because there are typically obvious narrative contexts where your resources might go up or down, or where your supply of a resource would come into play. I’m not considering that type of stat here.

No, the challenge comes in when dealing with personality traits where we’re trying to collect that data from the player and then reflect it back. In ChoiceScript, I’m especially talking about opposed stats. For instance, in ChoiceScript one might have the opposed stat of Daring/Practicality, where a score of 20% might represent that you are very daring and a score of 80% might represent that you are very practical. Both ends of the spectrum correspond to actual personality characteristics, rather than just the absence of something. And each end might be desirable in a different situation.

So here is the trick about personality stats. Some of the time you might be asking the player to make choices to establish character, in which case choosing to do something Daring should set the player’s Daring stat higher for future reference.

At other times, you might be using stats to determine whether the protagonist has the personality or skills to pull off the approach the protagonist just chose: are they Daring enough to do this skydiving stunt? In that case, you’re checking previously established stats to decide what result to report to the player.

Finally, you might use the player’s stats to determine whether a given choice is available at all. Perhaps a player with low Daring simply isn’t offered the skydiving option. Now you’re gating the option based on stats. At that point you have to make an additional decision about whether to show the player that the option exists but is just greyed out currently (*selectable_if, in ChoiceScript), or whether you want to conceal that option completely from players without the proper stat profile (regular *if).

Greyed out options advertise that alternate possibilities exist, which is useful for communicating to players when past actions are creating consequences in the present moment. On the other hand, secret options that appear only when you have the right knowledge or stats can be fun to discover on replaying.

If you don’t have a consistent strategy around when to check, set, or gate, you’re likely to confuse the player. I find this especially true in ChoiceScript, where the UI does not offer any warning about the mechanical implications of a choice: you just get “Skydive!” and no automatic information about whether that’s going to make you a more daring person or conversely test your previous daring.

For instance, here there are some narrative cues – this is the first move of the game, so we must be setting, and also the use of the past tense tells us that the player is establishing backstory and character aspects rather than taking a risk in the present moment. But nothing about the UI in this scenario distinguishes between setting and checking:

Screen Shot 2016-02-12 at 11.05.02 PM.png

The first move of The Daring Mermaid Expedition by Andrea Phillips

StoryNexus, by contrast, shows the player if a stat is going to be checked to determine chance of success, and gives information about what the current success odds look like. This level of mechanic-surfacing gives the output a more game-y flavor but also (in my opinion) provides the player with a greater level of control:

Screen Shot 2016-02-12 at 10.57.53 PM

One branch of the Feast of the Exceptional Rose, Fallen London

Undum sort of splits the difference by keeping the stats table permanently on screen in a sidebar, so while you might not know in advance what a link is going to do, you’re likely to be more aware of what is happening link-wise than in a ChoiceScript game in most UI configurations:

Screen Shot 2016-02-12 at 10.59.31 PM.png

The opening of Mere Anarchy by Bruno Dias

inklewriter, meanwhile, doesn’t automatically surface variables at all. And though there are personality stats underlying 80 Days, and though you sometimes get a message saying that yours have changed, you can never see a chart of all of them, and you don’t know when they’re being checked. You do get a number (see the lower lefthand corner) that describes your relationship to your master Fogg, but there’s quite a lot else happening here, to which the player doesn’t have access:

inklescreen.png

A screen showing limited status information in 80 Days

It largely works, I think, because those personalizing stats aren’t really the most important aspect of the game, and there’s a lot of state – cash flow, location, routes known, etc. – that the player does get to see. So our sense of agency focuses on those.

Below the fold, some thoughts on the different possible strategies for writing personality stats content.

Continue reading

Procedural Text Generation in IF

In the Missing Tools discussion some time ago, one of the things people mentioned wanting more of in IF was procedural text generation, which here is meant specifically as the ability to have the computer describe complex world model states or story events without having to hand-author every possible variation.

This is an area where there’s a lot to learn from work going on in academic research, but as far as I’m aware there’s relatively little communication. As I mentioned in my ICIDS writeup, James Ryan at UCSC and Dr. Boyang Li at Georgia Tech’s Entertainment Intelligence Lab are doing work on a) how to better represent a richly complicated world model and b) how to procedurally alter narrative features such as the tone of narration. One of the things we particularly don’t seem to do in hobbyist IF, perhaps for lack of resources, is experiment with large word databases such as WordNet or crowd-sourced work in particular areas like that used on Scheherazade.

Speaking for myself, I’ve also tended to stumble towards solutions in this space based on trial and error and the needs of my own projects, rather than having a strong grounding in the relevant academic work. Most of what we’ve needed — and most of what we’ve done — is pretty much work in the shallowest end of this pool.

And, of course, text generation for parser IF comes with special additional challenges, in that the player usually expects to be able to refer to any generated noun or noun phrase element; therefore if we generate a description of a thing as “blue”, the system also needs to remember how we described that object and accept the input “blue” to refer to it.

Here are the things I’m currently aware of. Unfortunately, I’m inevitably more aware of the internals of my own libraries and games than I am of other people’s work, so if I left out something cool that you did, please by all means say something in the comments: I am eager to know about it. In particular, there may be a lot I don’t know about under the hood in Kerkerkruip.

Continue reading