Ideas for how to resolve a "Reigns" type Dialogue Tree

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
UnPixTheCat
Posts: 10
Joined: Sun Jan 02, 2022 3:22 pm

Ideas for how to resolve a "Reigns" type Dialogue Tree

Post by UnPixTheCat »

Hello.

I am new at the Dialogue Unity so I might be missing something vital but I am trying to figure out how the best way of doing a "Reigns / Yes, Your Grace" sort of Dialogue tree. Where the player spends time on a throne and gets a choice/dialogue, saying yes or no. Then you break away from the throne. Come back and get more choices, and some may be relevant to the previous one. I am not looking for a code fix (Even if it would be nice) but rather ideas on how to best method to go around thinking about how to start working on this, as I notice you may only have 1 Start conversation Action in Dialogue System Trigger.

Example:

The Merchant might have an Apple Orchard Storyline and a Fraud Storyline.
It got randomly selected to tell the Apple Orchard Story, the player says Yes to give them land for the orchard. This unlocks the Merchant Orchard Storyline and if the player says No it puts a dead end to it. Next time the Merchant comes to the king they will demand workers for the Orchard or begin the Fraud Storyline. While also other NPCs come to talk to the Player. Meaning they are short conversations that remember the previous choices.

My first thought so far is to have a bunch of different NPCs that has 1 conversation Dialogue with Variables dependant on the previous Choice / Other subjects they might bring up. The initial idea is to have a branching tree with deadends or unlock other branches depending on your choice from there.
The first issue I think about is if an NPC got multiple possible stories to mention and thus tries to enter all of them at the same time, but this might be resolved if I make a variable that determines the story it is supposed to represent at the current moment and to ignore the rest. (Could be it gets a list of the potential "open" stories, and then randomizes to use one of them)
The second issue I worry about this system is that it could become messy to organize. Especially since I am not yet aware if it is possible to "Start" a conversation directly at a certain point in a branch and ignore everything said before then. Meaning I would have a lot and a lot of links coming from the start that goes under and over conversations that are relevant to how they got there. Might just be easier to have several conversations for each NPC and have "different" variants of them appear instead, to not have a giant conversation variable tree that will be hard to follow.

Might be a tool for the Quest system, it unlocks special conversations, and then when I am done it will give a done speech and should not come up again.

So, anyone with bright ideas on how to use the Dialogue System to best achieve the effect I am looking for? Links to things to look at in the document would be helpful as I am very willing to learn how to do this. Again this is just looking for ideas on where to begin developing this system.


---

Additional thoughts:

If I create 100 unique storylines it would be rough if I had to make 100 prefabs that just have 1 Dialogue Trigger change in each of them. Even more so if I got 10 characters and they all got 10 different stories. The ideal would be to have 1 prefab that is able to trigger through a script the conversation Action I want them to display. Could still be resolved through a variable but could end up quite messy to look at. But yes the ideal is to have a unique Talker Prefab which I can then create variants off with tags/names that are used on for the Dialogue Trigger.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ideas for how to resolve a "Reigns" type Dialogue Tree

Post by Tony Li »

Hi,

You can have more than one Dialogue System Trigger on a GameObject. Each Dialogue System Trigger can have different Conditions so that only one actually gets used at any given time. (Related: Conditions / Run Conversation Only Once)

However, this splits the logic between the Dialogue System Triggers and your dialogue database. I prefer to keep all of my conditional logic in one place, the dialogue database.

Conversations can link to other conversations. To link a node to another conversation, inspect the node. In the Inspector view's Links To: section, select (Another Conversation).

Your Dialogue System Trigger can start a hub conversation that immediately branches to other conversations, one for each storyline. Example:

reignsStyle.png
reignsStyle.png (54.93 KiB) Viewed 326 times

In the image above, I assume that each storyline has a corresponding Boolean (true/false) variable in the dialogue database. The variables start false. When you do a storyline, set the variable true to mark that the storyline has been done.

Note: It takes a little time to evaluate the Conditions on each node. If your <START> node links to 100 other nodes, this could add up and cause a little stutter when the hub conversation starts. To reduce the evaluation workload, check if you can group your storylines -- for example, maybe into chapters. When the conversation starts, you can do a quick check on each chapter and then only evaluate the nodes for that chapter. See How To: Use Group Nodes To Reduce Condition Checking Time for details.
UnPixTheCat
Posts: 10
Joined: Sun Jan 02, 2022 3:22 pm

Re: Ideas for how to resolve a "Reigns" type Dialogue Tree

Post by UnPixTheCat »

Thank you Tony!

This will certainly help me figure out how to go around this.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ideas for how to resolve a "Reigns" type Dialogue Tree

Post by Tony Li »

Glad to help!
Post Reply