[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 my blog post on NPC initiative, which describes how NPCs might manage a list of things to say in the future.]
Alabaster has a threaded conversation system, which is my way of saying that it keeps track of which quips follow naturally from which others. That’s important because it allows the game to prompt the player with the quips that he’s most likely to want to use next (and, even if such hinting is turned off, to parse input more intelligently).
Responses to the player.
Thanks to its awareness of threads, the Alabaster system allows for a hook, the subject-changing activity, which comes between the PC’s comment and the NPC’s reply. For reference, the full sequence for handling a conversation action 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 (SUBJECT-CHANGING HOOK)
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.
In transcript, that might look like this:
>ASK LUCY ABOUT DIAMONDS
(1) “Are diamonds your favorite gem, Lucy?”
(2a) She looks surprised by this question. (2b) “Yes, ever since I was a child.”
(3) Overhead the seagulls wheel and cry.
(4) “I do wonder what my mother did with the family rubies. They were missing when she died,” Lucy says.
And for a non-conversation option:
1. PC’s action is handled however is appropriate.
2. (Optionally) If the NPC has something else planned to say, he now starts a new conversation thread by saying the next thing on his list.
which would produce a transcript like this:
(1) They glitter at you malevolently.
(2) “I do wonder what my mother did with the family rubies. They were missing when she died,” Lucy says.
When an NPC goes to discuss a quip introduced by the player, he automatically checks whether that quip is relevant to the current conversation thread. If not, the subject-changing activity occurs and the NPC removes from his planned conversation any optional items, on the grounds that these will no longer be relevant to the new context of conversation. (See discussion of “optional” conversation here.)
The subject-changing hook also allows the NPC to notice and comment on the fact that the player has just changed the subject. This is something I’ve liked to do, where possible, as far back as Galatea, on the theory that if you treat your NPC like a topic encyclopedia, she should notice and object. The threading makes this easier to do, if it’s desirable.
There are even times when this function might support the desired dynamic of the game rather than just discouraging an undesired one (treating the NPC like a book). For instance: in one of the scenes of my longer WIP, there is a character who starts a conversation about, and wishes to keep discussing, subject A. The player has reasons to want to interrogate this character about B instead. The character will use the subject-changing step to complain that the protagonist is being rude if the player keeps steering the topic back to B before conversation about A is finished — though the character will then go ahead and answer the questions.
The subject-changing hook might also be the right place for other kinds of bookkeeping in certain sorts of games: one could imagine a game in which the NPC is trying to find out something from the protagonist and mentally notes when the protagonist avoids certain lines of conversation.
New NPC-directed conversation.
As we’ve seen, if the NPC is about to say something new (step 4 in the sequence above), there will be a beat of some kind to show that the conversation has reached a natural pause first. Or, if the NPC is speaking during a turn when the protagonist was silent, the protagonist’s other action — examining something, waiting, manipulating an object, whatever — itself becomes the grounding beat.
I find that in most cases the presence of the pause before a change of subject is enough to give the effect of a natural flow of conversation. There may be times, though, when we want the NPC to comment more explicitly on a new quip he’s about to introduce. Right before the NPC speaks, we might provide some bridging text using the following logic
— if the new thing he’s saying is one of the optional quips, we know that it belongs to the current conversational context. In that case, he doesn’t need to excuse a change of subject at all; no text is printed.
— if the new quip mentions a subject that is also mentioned by the previous quip, we might use that shared subject as an explicit bridge and produce something like, “Speaking of the queen, …”
— if the new quip doesn’t have any modeled relation to the previous discussion at all, we might have the NPC say something like, “To change the subject completely, …”. (Obviously the specific text will depend entirely on the characters, mood, etc.)
Generally I really like the way this model works, as a way to produce smooth and reasonably plausible conversation that doesn’t override the player too often (by having the NPC interrupt constantly with his own thoughts) but doesn’t leave him hanging with nothing to talk about, either.
However, there is one issue I’ve run into: if the player is doing a lot of conversation uninterrupted by other activity, the rhythm (comment, response, optional beat, and optional follow-up, each in its own paragraph) becomes predictable and a bit wearing.
The monotony can be broken up a bit if the protagonist or the NPC sometimes speak in multiple paragraphs, if the grounding beats are well-written, and if the NPC sometimes objects to subject-changes (though this effect is comparatively rare). But there may be times when it’s desirable to get more fluidity using some partly-randomized prose generation techniques.
Alabaster handles this by keeping track of some extra information about quips. For instance: is an NPC’s response in a given quip very brief? If so, it might be possible to follow that quip by a grounding beat and change of subject in the same paragraph, like so:
>ASK LUCY ABOUT DIAMONDS
(1) “Are diamonds your favorite gem, Lucy?”
(2) “Yes, ever since I was a child.” (3) Overhead the seagulls wheel and cry. (4) “I do wonder what my mother did with the family rubies. They were missing when she died,” Lucy says.
rather than the paragraph-by-paragraph version we started with. (The source code, with heavy commenting, is here.)
I haven’t decided yet whether to pull back these features of Alabaster into the core library. I’m happy with the way they work in that particular game, but they do require more rigor from the author in terms of marking which quips may safely be combined — this doesn’t seem like the kind of prose style judgement call that a computer can make — so retaining this feature makes writing the conversation that little bit more work.