Modeling conversation flow: interrupting the player

[This is part of a series of discussions on the craft of modeling conversation. For previous installments, see my original Homer in Silicon article which lays out the basic elements of the model, and previous blog posts on NPC initiative and subject changes, and transitions in player speech.]

There’s a hacky moment in Alabaster to do with interruptions.

During one of the first moves of the game, you can ask Snow White about something while she’s waiting for an answer about whether you’re going to escort her to the forest. So, if you talk about something else instead, she gets angry and interrupts. In the first implementation, she waited for the subject-changing hook to object; but I didn’t like the effect of that, so I decided to have her actually interrupt the speech in progress. Whatever the player is saying, after the first few words, she’ll leap in: this is done by dumping the quip content to indexed text and running a regular expression to automatically detect a safe break-in point. This happens regardless of which question you’ve asked her (and there are dozens of possibilities). For instance:

“Why do you –”

She sets her jaw as she realizes you are changing the subject.

“–avoid the Queen’s mirror? Many of us have stood before it, and taken no harm.”

If you asked this under any other circumstance, this question would just print as “Why do you avoid the Queen’s mirror? …” without interference.

The strength of this is that it let me introduce this feature across dozens of possible quips the player might say here, without having to edit the quips themselves. As this sample demonstrates, though, the weakness is that the algorithm for producing break-in points is pretty basic. Here we have Snow White looking irritated before the gist of the player’s comment is really clear at all.

Still, sometimes it works a lot better, and I found that it was still more interesting than using the subject-changing hook to show her anger in this particular context, so I left it as it was.

I didn’t refine the interruption system further in Alabaster because I only wanted to use this effect once and didn’t want to significantly overhaul the system or tweak every single quip. In that context it didn’t seem worth doing, but I’ve given some more thought now and then to how this might be implemented better.

Let’s start from the assumption that we are not going to do a really rigorous implementation in which the code somehow models the informational content of every bit of spoken dialogue and generates the NPC’s reactions on a word-by-word basis, allowing the NPC to leap in and respond based on his knowledge and mood at absolutely any point in the player’s speech. That sounds awesome, but it totally breaks the existing quip-threading model: it becomes much more flexible for short-term effects, but loses the model features that contribute to coherent story-telling over multiple turns.

Moreover, the complexity of an information-content model and the amount of effort that would have to go into encoding each bit of information rapidly puts such a system into the “impossible for a single human being to develop for” category — and one of my major goals has been not only to develop a system that produces plausible narration of conversation but does so in a way that a single author can write for in a reasonable number of hours. In other words, it needs to be easier to write for than the existing options, not harder.

A lighter approach, though still somewhat onerous for the author, would be to include some markup in quips — just a bracketed phrase, probably, like [possible-interrupt] — that would check for whether the NPC wants to jump in at that particular moment. This phrase would then run an activity to print the interruption text and set any mood counters or flags. It would certainly be more work than my original approach, because it requires hand-editing of many quips, but it would produce smoother results.

I think this would work, but to be honest, I’m not crazy about it yet. I wonder whether there might be some third kind of markup

A final note: if we wanted the NPC to follow up an interruption with an angry response or refusal to answer, that’s something we should do at the next step, without relying on the interruption hook. As you may recall if you read earlier posts on this system, the sequence of conversation looks like this:

1. PC’s comment (which can be multiple paragraphs, but usually isn’t)
2a. NPC challenges a change of subject, if relevant
2b. NPC’s response (which can be multiple paragraphs, but usually isn’t)
3. (If step 4 is going to happen) A grounding beat is produced to mark a pause in the conversation, to pave the way for
4. (Optionally) If the current conversation thread is at an end, and if the NPC has something else planned to say, he now starts a new conversation thread by saying the next thing on his list.

So any interruption effects happen during step 1, and the reason they’re tricky is that they require breaking up what is naturally an atomic step, printing the player’s speech — either breaking it up mechanically using indexed text, or more organically but laboriously using hooks the author has put into every quip that might trigger such a response. But we can easily meddle with step 2 with something like

Instead of Lucy discussing a sensitive quip when Lucy is offended:
say “Lucy sniffs pointedly and refuses to reply.”

9 thoughts on “Modeling conversation flow: interrupting the player”

  1. “I wonder whether there might be some third kind of markup”

    Your sentence cuts off there without a period, and I get the impression you didn’t mean for that to happen. It is thought-provoking, though. ^_^

    You’re tagging developments and subject changes in quips already ([notice corpse] in the narration, [pact-exists] in Snow White’s speech, [queue go-ahead-and-cut as postponed optional] in the PC’s speech), and so I don’t think marking up the PC’s speech with [possible-interrupt] tags is such a stretch. The [possible-interrupt] tag would be even slightly less troublesome to maintain than the more semantically specific [bring up the magic mirror].

    I think it would be great to have [possible-interrupt] tags be optional, keeping the regex hackery around for when it suffices. I see two solutions for making these work together:

    1. Keep a global variable around to keep track of whether an interruption has already been inserted into the quip. Then, if [possible-interrupt] has been used, the regex-based routine will know not to bother.

    2. Have a rule something like “To say possible-interrupt: say ‘{possible-interrupt}’;” (with curly brackets or any other unusual delimiter), and then tweak the regex-based routine as necessary so that it recognizes when the breaking point has been chosen for it and when it should decide for itself. This has the bonus that, for instance, if the [possible-interrupt] tag is put in between two sentences, a regex can recognize that, and then the em dashes can be left out if that’s more appropriate.

    I haven’t actually done anything at all with Inform 7 yet, though, so if my solutions are unusual or broken, that’s why.

    1. Oops — an unfinished thought, which I thought I’d erased again. But your suggestion is a good one, because it doesn’t impose any extra work on the author unless he wants to do it. I think I like implementation 2 best, but I’ll think about this more.

  2. Very interesting.

    Of course, in practice, this response only happens when we’ve *failed* to change the subject. Successfully changing the topic usually means raising a new topic of greater importance to the listener, more spectacular in their mind, than the old one was.

    So:

    “Why do you –”

    She sets her jaw as she realizes you are changing the subject.

    “–avoid the Queen’s mirror? Many of us have stood before it, and taken no harm.”

    But:

    “There’s a sale at Spencer Gifts for tween goth paraphernalia.”

    She gapes. “REALLY?!”

    Probably could be done by assigning an importance number to each topic. I wonder if that could be used in conjunction with an apparatus for giving the NPC some control over the conversation…

    Conrad.

  3. There are a number of edge cases I can think of that make me wonder if the system might be too restrictive.

    > ASK DOUG ABOUT HIS JOB

    “So young man,” you enquire, “have you thought any more about getting a job to pay for this place?”

    He turns his back to you. “Leave me alone! My job is my music.”

    Music? Even with the volume low, his “music” has been keeping time with your headache.

    > ASK DOUG ABOUT MONEY

    You begin to spit as you address the back of his head. “How are you-” Doug twists the dial on his stereo to drown you out. “-GOING TO PAY FOR THIS APARTMENT?”

    He shifts his gaze upward, refusing to answer.

    >TELL DOUG ABOUT WIFE

    “DO YOU REALIZE HOW MUCH PAIN…” you start, but this kid is just not getting it. “TURN DOWN THAT MUSIC AND LOOK AT ME WHILE I’M TALKING TO YOU.”

    He turns to face you, grabs your arm, and looks you right in the eyes. “No.”

    You stand there flabbergasted as he heads for the door.

    > GRAB DOUG

    You reach out to stop him, but the music seems to be affecting your depth perception.

    Doug stomps downstairs.

    > TURN OFF MUSIC

    You hit the stereo until it quits pounding. If only your ears would.

    You hear a slam followed by a car starting up. That’s odd. Doug doesn’t own a car.

    >INVENTORY

    Your keys are missing. That ungrateful bastard!

    1. I think it ought to be possible to do all of that, though as a bit of a special effect: use indexed text to upper-case the output whenever the stereo was turned up; implement “grab doug” as an action-in-context in the way I describe in another article later. The response to TELL DOUG ABOUT WIFE has the protagonist actually interrupting himself, but that could be done by writing a rule a bit like this:

      Instead of discussing something when the stereo is loudest:
      let N be indexed text;
      let N be the comment of the noun; [ie, write as indexed text the thing the protagonist is supposed to start saying]
      let N be the first five words of N; [as defined elsewhere, but not hard]
      say “‘[N in upper case]…’ you start, but this kid is just not getting it.”;
      try discussing turning down the music.

      That gives you the shouting, the transition, and then the move of conversational topic to something new, and the music-turning-down becomes the context of further discussion to which Doug then reacts.

      1. Wow, that could work, and it has enough flexibility that it might take about 3 times more detail to have it flow naturally for about 90% of play-throughs (ie: looking outside and chasing him instead of grabbing him and taking inventory), and an equal amount of work for each possible scene result (ie: getting thrown out yourself or actually reaching the kid).

        But I wonder if there’s a better way to do interruption points. For instance, the interrupted “DO YOU REALIZE HOW MUCH PAIN…” wouldn’t work as well if it had been any shorter. That’s the point at which the player can infer the rest of the sentence, and at that point, the protagonist would see Doug’s eyes glaze over. Similarly, the previous quip should be cut longer in that case, to “HOW ARE YOU GOING TO PAY…” But there also might be quips too short to interrupt, such as a pure insult (“WHERE DO YOU GET OFF?”).

        Annotations within the text seem cleaner, but you wouldn’t be able to see check for their presence if they are code ([interruption]), and it’s a bit ugly to do so with some other markup ({interruption}). It seems less clean to use fields: the wife quip interruption is after word 5.

        And for the sake of completeness, there would be non-scene-enders like:

        >ASK DOUG ABOUT DOUG

        With great fortitude, you shake it off and collect yourself for a moment.

        “Doug, tell me you’re taking care of yourself.”

        He turns to face your with a hunger in his eyes. “YOU BASTARD! Are you going to claim you care?” His expression turns flat and he reaches out as if to strangle you.

        But this can be handled by checking for specially-marked quips or changes of subject.

Leave a Reply to Emily Short Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s