Organizing character specific dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bbjones
Posts: 21
Joined: Mon Aug 17, 2020 11:56 am

Organizing character specific dialogue

Post by bbjones »

Looking for suggestions on the most efficient way to manage dialogue that needs to have different responses depending on the actor.

I'm assuming I can do this utilizing Conditions on conversation nodes, but...

An example conversation is a doctor talking to patients.

The doctor could one of several NPCs, the patient could one of several random NPCs, or a unique NPC that has unique dialog, or the player that then has responses.

Using a simple call and answer conversation:

Random Doctor: How are you?
Random Response: Fine.

But, for each unique NPC, the response may be different:
Bob would say: Great, how are you?
Ann would say: Terrible, life sucks.

And if it was the player, there would be several responses to choose from:
Player: 1) I'm fine - 2)Could be worse - 3) morphine, Doc... morphine.

So would all that be done in a complex conversation tree with conditional branches depending on who the actor is?
For a simple conversation like the example that's fine, but what about when there are 20 or more unique NPC response sets, or when different unique responses trigger new unique branches?
And will any of that make sense when exported for language localization?

For example, this isn't functional, but shows how I'm visualizing the conversation nodes being structured.
visualNodeExample.png
visualNodeExample.png (60.92 KiB) Viewed 260 times
I'm not sure how else it could be organized except by making entire unique conversations for each unique NPC in each unique situation, and another set for the player, then calling the conversation that matches the unique actor right from the start. That would mean loads of duplicated text because the Random Doctor NPC is always the same (in this example, the Doctor would likely also be a unique NPC further complicating the possible conversation combinations).

Any suggestions or pointers to relevant examples are appreciated.
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Organizing character specific dialogue

Post by Tony Li »

There are two approaches you can take:

1. Using prewritten dialogue trees with conditions and some text substitution, or
2. Generating dialogue at runtime.

While it's possible to do #2, the Dialogue System is primarily designed for #1.

There are several features you can use to make #1 more manageable. In no particular order:

Conditions based on Actor[Variable["ConversantIndex"] to read the current patient's actor fields.

Cross-conversation links. Write sub-conversations, and link to them. This way you don't have to put all the nodes in a single monolithic conversation. To link from a node to another conversation, inspect the node. In the Inspector's "Links To:" menu, select "(Another Conversation)".

More group nodes. From the "Doctor: How are you?" node, you can link to two group nodes: one if the conversant is the player, another if the conversant is an NPC. This is just an organizational tool to avoid a gazillion nodes straight off of "Doctor: How are you?"

Conversation position stack. You can "push" the current conversation position onto a stack, then dive into a branch or sub-conversation. When you're done, "pop" the position from the stack to return.
Post Reply