Developing a new conversation extension

I’ve gotten to a point in my WIP where the conversation system is limiting what I want to do. But I don’t think it would take much to change it into what I want.

I’m using Eric Eve’s “Conversation Responses,” but I’m already mangling it so that most of what it does is redirect to my own code. Up until now, that’s worked fine, but now I want to do more with NPCs saying things spontaneously on their own … or even potentially multiple NPCs responding during a single turn. Also, I may have some characters temporarily unable to speak.

So I took a step back and asked myself, “how should conversation work?” And I came up with a pretty simple answer, that to my knowledge has never been implemented. Then again, I don’t know how Emily Short does conversation, so maybe I’m wrong. Here’s how it goes.

When the player types a command to say something, the check rules determine whether the PC is able (and willing) to speak. If they are, then the check phase ends.

The carry out rules determine who heard the PC.

The report rules tell what the PC, and only the PC, does.

Then the every turn rules come along. A rule loops through every NPC who heard the PC and each one has a chance to respond. Kind of like ReactAfter, I guess.

Has anyone ever done it this way in I7? If so, I’d like to hear how it went. And I’d be curious whether you’d be interested in using such a system, and what benefits and drawbacks you think it might have.

The structure of my conversation extension is something like this, though with more checks.

– because conversation is often contextual, it doesn’t have the player speak at all if there’s no one there for him to speak to.
– the parser checks against named conversation options to see whether it can match any available comments for the player to speak; if there are several possible things to say, it disambiguates
– the player’s comment is then printed; any facts mentioned by the comment then become “known” to all the people in the room at the time, which means that if you’re doing something dependent on what characters have found out what information, they can all respond accordingly
– the speech action concludes
– during every turn rules, I call the conversation rules for the other characters; this is the point at which they can give responses to what’s just been said, refuse to answer, or change the subject to talk about something else.

I am completely inexperienced, but it sounds great.

Crowds could be addressed. Meeetings designed.

I wonder whether one could make it a mystery as to who or what answered and leave it for the player to find out?

Could a Com-System be created with varying ranges?

Hmmm… the idea sound great.


The idea of multi-lateral conversation sounds great, but it implies that what each character says, presumably, would be based not only on what the PC said, but also what each of the other characters has already said. Looking at the number of possible permutations with even a few characters involved, it strikes me that keeping the whole thing from getting out of control could be quite a task. Good luck!

Robert Rothman

I actually already have a system in place for that, although it wasn’t originally intended for something so complex.

In essense, there will be a Changing the Subject activity. Every player has their own current interlocutor and their own current subject. When they get the opportunity, they will speak their thoughts about the subject to the interlocutor (or to the general assembly, if no interlocutor is selected). Then everyone listening will perform the Changing the Subject activity. Each player also has a “speech motivation” which tells what prompted them to want to say something. It could be that someone asked them a question, showed them an object… or that they thought of something spontaneously. The activity will decide, based on the way the new subject is being suggested, whether to preempt the current subject that they were originally planning to talk about.

Most conversation verbs will set these variables automatically (with the interlocutor getting the motivation of “asked/told/etc” and everyone else getting the motivation of “overheard.”) But there will also be say-phrases to trigger the activity manually. This will enable a flow of conversation, e.g.:

triggers Bob to talk about his shoes. Perhaps he’ll mention that he bought them at Giga-Mart. This will trigger the subject “Giga-Mart” as “suggested.” Now the PC’s current subject is Giga-Mart, so it will appear as a conversation suggestion to the player.

A neat side effect that I imagine here is that anyone saying anything could trigger bystanders to respond. But since the Every Turn rule only runs once per turn, they will wait until next turn to speak (provided they’re triggered in the proper order). That will give the player the chance to preempt what they were going to say. Potentially it could make for a very lively interchange!

That does sound a lot like what I was trying to do, although I don’t have any knowledge tracking for NPCs other than the “current subject.”

I’ve started thinking that conversation is so particular to each individual game that a one-size-fits-all conversation extension might be unfeasible. What do you think?

That’s pretty much been my contention since the outset of Inform – some games are best suited with menus, some with TALK TO foo implementations, some with more or less complex ask/tell systems, and trying to hit all those marks with one package is really, really hard.

The thing I’ve been working on (well, mostly not working on, in recent months/years – real life has taken over with a vengeance) is intended to provide for one possible subset of projects, namely those where you really want the player to be able to articulate a variety of statements about different topics, and characters have highly contextual responses and a fair amount of flow. But I’m not under any illusion that this would work well for all games.

Right. The “context-dependent” part is why I wasn’t originally interested in using a system like yours. I want a more or less “stateless” conversation system - not that there is no state involved on a turn-by-turn basis, but that the order of statements in a conversation is not important. But it sounds like your approach to the individual turn structure is very close to what I had in mind.

I like. You might like this in addition:[code]The command to re-try is indexed text that varies. The command to re-try is usually “”.

Rule for reading a command when the command to re-try is not “”:
change the text of the player’s command to the command to re-try;
now the command to re-try is “”.

Check answering when the player’s command matches the text “,”:
now the current interlocutor is the noun;
now the command to re-try is the player’s command;
replace the regular expression “^<^,>+, *” in the command to re-try with “”;
rule succeeds.[/code]It makes BOB, FOO change the current interlocutor to the addressee, then retries the command FOO. It’s useful if the command is implemented as a Mistake, or with a noun token that lacks a verb (such as Understand “[things]” as asking it for. or whatever.)
And, have you considered replacing the current interlocutor property with a various-to-various talking-with relation? I’ve wondered if that would be a good idea or not.

Oh, also, I created the extension Command Prompt On Cue so if your player just wants to silently listen to the conversation coming out of those Every Turn rules, the extension allows for a nice looking transcript that doesn’t have WAIT WAIT WAIT everywhere. Just a thought.

Thanks for the encouragement!

Sounds like those would fit in well. I will probably plan for compatibility with them, but not implement them for simplicity’s sake.

Here’s a question. I’m using Eric Eve’s extensions as a starting point, but I’m not a huge fan of all of his naming conventions. Would it be confusing if I use some of his names, but they mean different things? Or should I make an effort to come up with all new names?

Here’s an example of the names I’ve been working with:

[code]A person has an object called the interlocutor.

To decide what object is the current interlocutor: Decide on the interlocutor of the person asked.

To decide which object is the item of interest: [use a before rule to set a global instead?]
if conversing, decide on the second noun;
if examining, decide on the noun;
if implicit-conversing, decide on the noun;
if giving something to something, decide on the noun;
if showing something to something, decide on the noun;
decide on nothing; [noun for all other actions?]

A person has an object called the concern.

Definition: a person is waiting to speak if the concern of it is a thing.

To decide what object is the current subject: decide on the concern of the person asked.

Carry out an actor informing someone about something (this is the communicate the item of interest rule):
Now the concern of the current interlocutor is the item of interest;

Voicing concerns is an action applying to nothing. Understand “t” and “talk” as voicing concerns. [Perhaps this should just be called “talking?”]

Every turn (this is the voice concerns rule):
Repeat with orator running through other people who are waiting to speak:
Try the orator voicing concerns;


In particular, I’ve been thinking about kinds of action. I find “conversing” and “implicit-conversing” to be confusing. I’ve been wondering if I could create “subject-first talking” and “subject-second talking” KoAs to be clear about which noun the “item of interest” can be found in. But I also was thinking about having almost all actions have an “item of interest,” so that NPCs can comment on whatever the player is doing. Perhaps an “involved” adjective would work better in that case.

A couple other names:

I like the syntax “Response of X when asked-or-told about Y” from Response Rules, but I don’t like the fact that they run during the report phase and then stop the action. I have an activity called “speaking out loud” which checks who the actor is but uses the subject matter as a basis. I keep thinking I’d rather it take the speaker as its basis, or even an action (e.g. Bob informing someone about shoes). But even with the confusion issue aside, I haven’t quite figured out the syntax I want.

I’m not really happy with treating hello, yes, no, and sorry as separate actions. It seems like there could easily be subjects called greetings, affirmative answer, negative answer, and apologies, and if necessary an “offering” or even just “saying” action for all of them parallel to the topic-based “answering” action.


I think you probably have to just use whichever names make most sense to you, rather than straining to avoid ones I’ve used. The clash of names meaning slightly different things would only be a major problem if someone tried to use both conversation systems together, which it doesn’t look like is something you intend to be possible.

In fact, although you’re talking about using my conversation extensions as a starting point (which you’re perfectly welcome to do, of course) I get the impression that you want yours to do something rather different, so you may not want to be too constrained by my design. What I was trying to do was something fairly specific, namely to come up with something that would mimic the TADS 3 conversation system as closely as possible in a manner that seemed reasonably natural in Inform 7 (that intent was in turn originally born of the need to port part of a TADS 3 game to Inform so I could provide a demo playable through a web browser). My design decisions (hopefully) make sense within the contect of that limited aim, but may make much less sense in the context of the various things you’re trying to do.

– Eric

Thanks for the background, Eric (and for your blessing! :slight_smile: ) I won’t worry too much about confusing users who switch between extensions, but when I get around to releasing, I’ll try to make sure the documentation is clear.

I hope I didn’t come off as disparaging about your collection. I’ve gotten a lot of great mileage out of it and it’s still serving as a template for what a conversation system needs to achieve. It’s easy to focus on the perceived faults of something and take its qualities for granted…

Now that is wise.


Here’s a sneak peek at the extension in its current state. I’m pretty happy with it, so I don’t think there will be any fundamental changes. Just testing, debugging, and adding handy phrases. Maybe one or two more minor features.

A lot of the code from Conversation Framework and Conversation Responses is still there, but it’s been reordered quite a bit so you might not recognize it.

Why so many implicit-… actions? Does the supplying a missing noun rules not work? Or do I misunderstand what they do?

Also, it includes epistemology twice. :slight_smile:

I’m interested in this because my WIP treads the same ground. I remember this part of the WIP being a part I didn’t enjoy coding up.

But also, since Eric says his extension tries to pattern itself after another (to reduce the learning curve for authors who use both systems, I’m sure), I’m interested in a system that plays to Inform’s strengths. For example, the bit about each person having an interlocutor I think might be more natural as a relation. I also wonder that many-to-many relations might be the way to go for representing group conversations (if not just making a “conversation” a type of sub-room). Using a global variable just seems archaic.

I don’t know what Eric’s reason was, but in my experience, I’ve had trouble with supplying a missing noun, and found multiple actions that redirect to a single action to be more reliable. Most recently I had trouble with persuasion - when omitting the noun in a command to an NPC, you get the error “you must supply a noun.” But perhaps I just needed a “for supplying a missing noun when an actor…?”

Still lots of copy-and-paste in there… :stuck_out_tongue:

I appreciate your perspective, especially if you’ve been working on something similar. My choice was to avoid many-to-many relations just to keep things light & simple, and to use a property rather than a relation for the interlocutor because the syntax is simpler. The “current interlocutor” phrase was mainly there for backwards compatibility and could be removed without much trouble. I would consider a one-to-many relation. Right now it’s assumed that if the interlocutor is nothing and there are multiple listeners then the speaker is addressing the room. But perhaps there should be a “general audience” placeholder, or the interlocutor should actually BE the room…

Still looking for improved variable/action/activity/phrase/rulebook/extension name suggestions. Has your parser experience given you any insight?

In particular, I’m stuck on “imploring it for/inquiring it for.” I thought “inquiring” would be an improvement, but it hasn’t sat well with me. There are THREE ways that “ask for” can be parsed:

  1. asking it for - builtin action applying to things in scope
  2. requesting it for - applying to any visible things
  3. imploring/inquiring it for - applying to topics

I’ve largely eschewed topics since it’s always possible to create a familiar thing (i.e. a subject) with a topic in an “understand” line. So I’ve thought about making #3 into an “Understand as a mistake” rather than an actual action. But I don’t think you can quote the topic understood if you do that. (i.e. “This game does not know the word ‘mercy,’ so you can’t ask for it.”) What do you think?

I just had a second look at this. I think the problem is that all of those implicit-actions include what would be the second noun in the full action. You can’t write a rule for supplying missing noun when your grammar line already has one noun in it, can you?

Or do you cheat by writing a rule like this?

Understand "ask about [any known thing]" as quizzing it about.

For supplying a missing second noun when an actor quizzing something about:
	Now the second noun is the noun;
	Now the noun is the interlocutor of the person asked.

Hey… I think that works!

How would that work with DPMR, though? Don’t they run before supplying a missing noun rules? It would be difficult to write things like this:

A person has an object called the favorite subject. Does the player mean quizzing someone about the favorite subject of the noun: It is very likely.