Ink integration - couple questions (actors etc.)

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - couple questions (actors etc.)

Post by Tony Li »

Take a look at the Test Nehvaleem scene. Here's a copy in case you don't have the latest:

Test_Ink_Nehvaleem_2020-05-21.unitypackage

The conversation has 3 characters: Satoru, Village Leader, and Other Villager. Each character has a GameObject with a Dialogue Actor component. The Dialogue Actor components have different subtitle colors set to make it easy to know that the conversation has associated the correct GameObject with each character.

Each subtitle has an Actor (aka Speaker) and a Conversant (aka Listener). When the Village Leader speaks, the sequence's Speaker will be the Village Leader's GameObject. When the Other Villager speaks (who is considered an "extra" character, neither the primary conversation actor nor the primary conversation conversant), the Speaker will be the Other Villager GameObject.

BTW, in C#, you can also check DialogueManager.currentConversationState.subtitle to get info about the current subtitle:

Code: Select all

Debug.Log("Speaker GO is: " + DialogueManager.currentConversationState.subtitle.speakerInfo.transform);
It may help to temporarily set the Dialogue Manager's Debug Level to Info. This will log a lot of info to the Console, including lines such as:

Dialogue System: Village Leader says ' Our petitions finally worked, as I surely knew they would!'

In the line above, "Village Leader" is the name of the actor that the conversation thinks is speaking the line.
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Re: Ink integration - couple questions (actors etc.)

Post by nehvaleem »

Yeah, I get what you said, but please take a look at my example attached. I've added one sequencer command to the provided ink file and called it twice from the ink file itself.

The example is here: https://shorturl.at/nEFMU

(I cannot attach it here anyway)

You will see that there is a Sequencer Command that does nothing but Debug.log

Code: Select all

public class SequencerCommandInkDebugger : SequencerCommand
{
    public void Awake()
    {
        Debug.Log($"Sequencer data {Sequencer.Speaker} talking to {Sequencer.Listener}");
        
        Stop();
    }
}
And despite that there are actors in the scene with correct components (names, subtitles colors are working) that sequencer doesn't have info about Sequence.Speaker and Sequence.Listener.

Please let me know if I am doing something wrong.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - couple questions (actors etc.)

Post by Tony Li »

Hi,

I can reproduce it. I'm tracing through now to identify the issue.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - couple questions (actors etc.)

Post by Tony Li »

Just posting an update. I need to adjust the integration's order a bit. Turns out Ink doesn't run functions until after you continue past the function's dialogue line. They're called during the process of continuing to the next dialogue line. So while the sequencer now has the correct speaker and listener GameObjects, functions in the integration run at the beginning of the next node instead of during the current node. I'll post an update later today.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - couple questions (actors etc.)

Post by Tony Li »

The Dialogue System Extras page has an updated Ink integration. (direct download)

It should fix the Sequence() issue.

I also added a new function:

Code: Select all

DialogueSystemInkIntegration.instance.GetActorsInStory(string storyName, string knot)
This function returns a string[] array of actor names that appear in #Actor=XXX and #Conversant=XXX tags
as well as actor names preceding lines (e.g., "Bob: Hi, I'm Bob.") if Actor Names Precede Lines is ticked.

If knot is blank, it processes the entire story.

Notes:

- The returned array will not include the default player and NPC, since they are not explicitly named.
- This method must process the entire Ink story. It may take some time on large stories.

Example:

Code: Select all

Debug.Log("Actors in story 'Nehvaleem', knot 'Village':");
var actorNames = DialogueSystemInkIntegration.instance.GetActorsInStory("Nehvaleem", "Village")
foreach (var actorName in actorNames)
{
    Debug.Log(actorName);
}
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Re: Ink integration - couple questions (actors etc.)

Post by nehvaleem »

Hi Tony,
I've checked the updated integration package and it seems that there is still something going on. I mean it is a lot better, but sequencer commands are still giving me a headache :) Look at my console output below:

Image

Three things can be noticed here:
1. I've got only one call to the sequencer in this conversation and yet the integration Debug.Log is called twice
2. PlaySequenceFromInk in both cases contains the part "Satoru: Quiet! Are you the village leader?"
3. Last Debug.Log indicates that Speaker is Satoru and the Listener is Village Leader and there is the other way around

If it is needed I can provide a sample as before, just let me know :)
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - couple questions (actors etc.)

Post by Tony Li »

Is that the Sequence() that's on a line by itself? If so, can you try putting it on the same line as one character or the other? I think Ink (or at least the way the DS integration is interpreting Ink) is having trouble understanding which line it's supposed to belong to.
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Re: Ink integration - couple questions (actors etc.)

Post by nehvaleem »

The Sequence() call was indeed in a separate line (it is a lot easier to write ink that way) and moving it to the actual dialogue line resolved the issue of Sequence() being called two times.

Despite that there's still something off, look at the screenshot:

Image

You see that Actors (Village Leader & Satoru) are recognized properly when they're speaking but the last line (that one with Debug.Log from Sequencer command) didn't show the Listener.

Maybe it has something to do with the actor name? Because I am using nesting here with level number prefixed, for example: 003/Village Leader.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - couple questions (actors etc.)

Post by Tony Li »

Thanks for your patience on this. We'll get it sorted.

Can you please reply with the relevant bit of your .ink file, or PM it to me?

Does your Village Leader GameObject have a Dialogue Actor component whose Actor dropdown is set to "003/Village Leader"? Here's how it looks in my example scene:

inkSequenceDebug2.png
inkSequenceDebug2.png (27.04 KiB) Viewed 1661 times

And this is what the log shows:

inkSequenceDebug.png
inkSequenceDebug.png (49.79 KiB) Viewed 1661 times

(The Listener is using the correct GameObject.)
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Re: Ink integration - couple questions (actors etc.)

Post by nehvaleem »

Sorry for the radio silence here Tony. I think it was something on my side. Currently, I am able to do everything that I want so that is great.

How it is going with the Attributes for conversation and entry points? I would really make use of those :)
Post Reply