Ink integration - couple questions (actors etc.)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nehvaleem
Posts: 93
Joined: Tue Sep 10, 2019 4:52 am

Ink integration - couple questions (actors etc.)

Post by nehvaleem »

Hi, I've got couple of questions regarding Ink integration, mostly actors. I am having troubles understanding some core concepts about ink integration.

Background:
I am creating a rpg where there is not only one, but many "player" actors.

1) Is it possible to have as many actors as needed with ink integration? I've noticed some predefined actors in integration source code such as: PlayerSpeaker - and only this actor is displayed as player in basic standard dialogue ui

Code: Select all

	protected const int PlayerActorID = 1;
	protected const int StoryActorID = 2;
	protected const int PlayerSpeakerActorID = 3;
2) What is the best approach to handle situation when 3 or more chracters talking with each other and for example 2 of them are controlled by player and 1 is a npc?

Those questions arose when I tried to import my ink story with 5 actors to dialogue system.
Some of the lines for my actors where skipped completely or displayed as a choice with only 1 option (the line itself).

I didn't had those problems without using ink integrations. It seems a little bit off compared to other integrations. I know that ink integration uses ink engine under the hood, but something is weird around here (or I am doing something wrong).
Last edited by nehvaleem on Wed Apr 29, 2020 1:18 pm, edited 1 time in total.
nehvaleem
Posts: 93
Joined: Tue Sep 10, 2019 4:52 am

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

Post by nehvaleem »

I see that those actor IDs i've pasted earlier are just defaults. But still I cannot manage how to display my characters subtitles.
nehvaleem
Posts: 93
Joined: Tue Sep 10, 2019 4:52 am

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

Post by nehvaleem »

Replying to my own post once again :)

This is the example that I am currently working on:

Code: Select all

=== village_elder ===
{stopping:
    - ->first
    - ->second
}

= first
Village Leader: Our petitions finally worked, as I surely knew they would! # Actor=003/Village leader
Satoru: Quiet! Are you the village leader? # Actor=Satoru
Village Leader: Yes, I am. Your humble servant. # Actor=003/Village leader
Village Leader: We have sent petitions to our Lord Shougun, to send mighty, noble, brave samurai to help us… # Actor=003/Village leader
* [Satoru: Where’s the herbalist?]
    Satoru: I need to talk with the herbalist. Where is he?
    Village Leader: He was taken from us, sir. The bandits you were sent to kill, oh mighty samurai, imprisoned him in their camp up the mountains, and…
    Satoru: That’s enough. We will move soon. The boy stays here and if anything happens to him…
* [Satoru: Lord Shogun didn’t send us.]
    Satoru: Nobody sent us to help you, nobody cares. We came to see the herbalist.
    Village Leader: But you will have to help us, oh wise and brave one. The bandits took the herbalist from us and imprisoned him high in the mountains. 
    Village Leader: You will have to kill them anyway.
    Satoru: Time will tell. We will move soon. The boy stays here and if anything happens to him…
- Village Leader: I understand, sir. He’s safe with us.
->->
And now there are some things that I cannot fully understand:
1) When I don't specify actors in each line in .ink file - every line plays (with wrong actors of course, but is visible)
2) When I assign a second line to correct actor (in this example # Actor=Satoru) the line isn't displayed at all.
3) I've looked into source code of the integration and found following lines that are mysterious for me:

Code: Select all

// We handle showing PC subtitles differently with Ink, so fix up Dialogue Manager's Input Settings:
showPCSubtitles = DialogueManager.DisplaySettings.subtitleSettings.showPCSubtitlesDuringLine;
DialogueManager.DisplaySettings.subtitleSettings.showPCSubtitlesDuringLine = false;
When I comment this - my player lines are now displaying in UI. I don't think that editing source code directly is a best idea so please - if someone could shed some light onto this matter, I'll be really thankful
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Hi,

Thanks for providing details. I'm looking into this now. I'll reply back here soon.
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Hi,

I made some small adjustments to the Ink integration that might help. Here's the updated integration package:

DS_InkSupport_2020-04-29.unitypackage

And here's my test copy of your sample:

DS_Ink_Test_nehvaleem_2020-04-29.unitypackage

I made a few changes:
  • Added a line spoken by another actor ("003/Other villager").
  • Assigned an actor named SatoruSpeaker to a couple of lines.
  • Deleted the knot info. This wasn't necessary. I was just trimming away extra stuff so I could focus on the lines.
A few notes:
  • The player actor is used for response menus. In the test, it's named "Satoru".
  • There's a separate actor used for player subtitles. In the test, it's named "SatoruSpeaker" and the Display Name is "Satoru".
  • For lines that do not have "#Actor=" tags:
    • If it's a choice line, it will show a response menu.
    • Otherwise it will use the conversation conversant. In the "nehvaleem" button's Dialogue System Trigger, I assigned "Village leader" to the conversant field. In the "nehvaleem2" button, I assigned another actor named "Another leader".
I don't expect this post to resolve all of your questions. Please take a look and let me know what isn't yet working the way you want in your own project. It may require adjusting some things in your Ink files, or it may require me to add some extra functionality to the Dialogue System's Ink integration.

If need be, I'll add a checkbox option to skip those lines that you commented out. I'd just like to get a better understanding of your scenario first so I can make the best decision on that.

BTW, here's the Ink file I used:

Code: Select all

Village Leader: Our petitions finally worked, as I surely knew they would!
Satoru: Quiet! Are you the village leader? # Actor=Satoru
Village Leader: Yes, I am. Your humble servant.
Other Villager: Yes, he is the village leader. # Actor=003/Other villager
Village Leader: We have sent petitions to our Lord Shougun, to send mighty, noble, brave samurai to help us…
* [Satoru: Where’s the herbalist?]
    Satoru: I need to talk with the herbalist. Where is he?
    Village Leader: He was taken from us, sir. The bandits you were sent to kill, oh mighty samurai, imprisoned him in their camp up the mountains, and…
    Satoru: That’s enough. We will move soon. The boy stays here and if anything happens to him… # Actor=SatoruSpeaker
* [Satoru: Lord Shogun didn’t send us.]
    Satoru: Nobody sent us to help you, nobody cares. We came to see the herbalist.
    Village Leader: But you will have to help us, oh wise and brave one. The bandits took the herbalist from us and imprisoned him high in the mountains. 
    Village Leader: You will have to kill them anyway.
    Satoru: Time will tell. We will move soon. The boy stays here and if anything happens to him… # Actor=SatoruSpeaker
- Village Leader: I understand, sir. He’s safe with us.
nehvaleem
Posts: 93
Joined: Tue Sep 10, 2019 4:52 am

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

Post by nehvaleem »

Thanks Tony!

I haven't tried modified package & sample you've provided but I have some extra questions regarding ink integration after reading your reply.

1) What is the idea behind duplicainting actors? It seems really counterintuitive for me, especially when my game will have around 50 actors and over 10 of them will be controlled by a player. So do I need to create additional *Speaker actor for every each of them?

2) Why do you decided to disabling displaying subtitles for pc players in the first place? In my test everything works (at least looks) as expected when I commented out those lines. (I am not trying to question anything, be ungrateful or something. It really bothers me now because it really does looks fine for me right now)

3) I've noticed something weird with external functions. The documentation (https://www.pixelcrushers.com/dialogue_ ... l/ink.html) states that those EXTERNAL functions should be added at runtime. Based on an examples I've done it don't. If i understand it correctly the ink files should have only fallback functions added (for example at bottom of file) to be able to compile. When I added those fallback functions (without having external defined at the top) my Sequence call did not produce any results, but the file itself was playable with the ink player that comes from the ink plugin itself. When I manually add the EXTERNAL Sequence(x) at the top and fallbacks at the bottom - it starts to work but the story isn't playable by the ink player because of the unbound external function message. It seems that there is no way currently to have a minimum proper ink file that can be edited outside of unity and just imported to the dialogue system without any further modifications. Again - I may be doing something wrong.

My structure of files is like this:
- main.ink - this is the main file which includes 3 more files
-- 01_village.ink
-- another_not_relevant.ink
-- another_not_relevant.ink

I am adding this EXTERNALs & fallbacks to the main.ink file of course.
It is worth noting that entry picker in ink trigger doesn't support includes as in my setup :(

I'll check out the samples that you've provided as soon as I can.
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Hi,
nehvaleem wrote: Thu Apr 30, 2020 5:06 am1) What is the idea behind duplicating actors? It seems really counterintuitive for me, especially when my game will have around 50 actors and over 10 of them will be controlled by a player. So do I need to create additional *Speaker actor for every each of them?

2) Why do you decided to disabling displaying subtitles for pc players in the first place? In my test everything works (at least looks) as expected when I commented out those lines. (I am not trying to question anything, be ungrateful or something. It really bothers me now because it really does looks fine for me right now)
Yes, duplicating actors is very counterintuitive. But fortunately it's not necessary for all games. Here's an updated integration with an option to NOT change the PC subtitle settings:

DS_InkSupport_2020-04-30.unitypackage

After you import the updated package, the integration script on the Dialogue Manager will have a dropdown that you can change from Override to Use Dialogue Manager Values.

I also updated the example:

DS_Ink_Test_nehvaleem_2020-04-30.unitypackage

I changed the dropdown to Use Dialogue Manager Values and untick the Dialogue Manager's Input Settings > Always Force Response Menu. I also changed the Ink file to not reference any *Speaker actors. I forgot to remove the *Speaker actors from the example dialogue database, but they're not used anyway.

The reason for separate actors (when the dropdown is Override) is because Ink doesn't really have a concept of actors, and it certainly doesn't have a concept of some actors being players (i.e., the "Is Player" checkbox ticked in the Dialogue Editor) and some being NPCs. The Dialogue System uses the "Is Player" checkbox to know whether to show a player's line in a response menu or as a subtitle. So the *Speaker actors are a workaround that allows Ink writers to specify that a line should be shown in a response menu (Player) or only as a subtitle (PlayerSpeaker). But in your setup you don't need all that. Just set the dropdown to Use Dialogue Manager Values and it should work the same way as when you commented out those lines.
nehvaleem wrote: Thu Apr 30, 2020 5:06 am3) I've noticed something weird with external functions. The documentation (https://www.pixelcrushers.com/dialogue_ ... l/ink.html) states that those EXTERNAL functions should be added at runtime. Based on an examples I've done it don't. If i understand it correctly the ink files should have only fallback functions added (for example at bottom of file) to be able to compile. When I added those fallback functions (without having external defined at the top) my Sequence call did not produce any results, but the file itself was playable with the ink player that comes from the ink plugin itself. When I manually add the EXTERNAL Sequence(x) at the top and fallbacks at the bottom - it starts to work but the story isn't playable by the ink player because of the unbound external function message. It seems that there is no way currently to have a minimum proper ink file that can be edited outside of unity and just imported to the dialogue system without any further modifications. Again - I may be doing something wrong.

My structure of files is like this:
- main.ink - this is the main file which includes 3 more files
-- 01_village.ink
-- another_not_relevant.ink
-- another_not_relevant.ink

I am adding this EXTERNALs & fallbacks to the main.ink file of course.
Hmm, that should happen when the integration script initializes its information about the ink stories. See the integration's example scene. If you play "story", it uses the external function SetQuestState(). At the end of the conversation, you should see "The Wager" in the quest tracker HUD in the upper right corner of the screen.
nehvaleem wrote: Thu Apr 30, 2020 5:06 amIt is worth noting that entry picker in ink trigger doesn't support includes as in my setup :(
I'll add this in the next update. It'll have to scan not only the selected ink file but any files that it includes.
nehvaleem
Posts: 93
Joined: Tue Sep 10, 2019 4:52 am

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

Post by nehvaleem »

Hi Tony,
thanks for this exhaustive response. I've just tried that modified package with option to disable overriding of pc subitiles and I can confirm that it is working as intended. Do you plan to include this update in the next official update along with this extended picker that you've mentioned?

As for ink and actors - Thanks for clarification! I think I understand it now. But correct me if im wrong: if ink files contain all the #actor= tags there should be no issues with actor subitle/response panels, right? This will be probably my case so I should be all set with those altered ink integration script you attached.

I think that this shortcut/workaround with "player" & "playerSpeaker" is ok for some other (than mine) cases, but wouldn't it be better if you could "wildcard it somehow"? I mean for those situations where someone would like to have "Actor1Speaker", "Actor2Speaker" and so on? To be able to use this convention with shorthand and yet be able to distinguish actors somehow?
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Hi,
nehvaleem wrote: Tue May 05, 2020 12:32 pmthanks for this exhaustive response. I've just tried that modified package with option to disable overriding of pc subitiles and I can confirm that it is working as intended. Do you plan to include this update in the next official update along with this extended picker that you've mentioned?
Yes. Both will be in the next update.
nehvaleem wrote: Tue May 05, 2020 12:32 pmAs for ink and actors - Thanks for clarification! I think I understand it now. But correct me if im wrong: if ink files contain all the #actor= tags there should be no issues with actor subitle/response panels, right?
Yes, sounds correct.
nehvaleem wrote: Tue May 05, 2020 12:32 pmI think that this shortcut/workaround with "player" & "playerSpeaker" is ok for some other (than mine) cases, but wouldn't it be better if you could "wildcard it somehow"? I mean for those situations where someone would like to have "Actor1Speaker", "Actor2Speaker" and so on? To be able to use this convention with shorthand and yet be able to distinguish actors somehow?
I'll add that to the to-do list. It won't be in the next update, but it should make it into a future update.
nehvaleem
Posts: 93
Joined: Tue Sep 10, 2019 4:52 am

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

Post by nehvaleem »

Another thing I've discovered. It seems that when using choices the dialogue system doesn't take into account text separation when rendering subtitles. I mean situation when given text such as:

Code: Select all

* [Where’s the herbalist?] I need to talk with the herbalist. Where is he? # Actor=Satoru
* [Lord Shogun didn’t send us.] Nobody sent us to help you, nobody cares. We came to see the herbalist. # Actor=Satoru
I am getting a menu with two buttons with text: "Where's the herbalist" and "Lord Shogun didn't send us" - which is correct. When I select one of the choice the actor' subtitle is displayed, but again with the part before closing bracket instead of the rest.

I am following info about writing in ink it that is available here: https://github.com/inkle/ink/blob/maste ... hoice-text
Post Reply