Search Unity

Official Dialogue System + Timeline track

Discussion in 'Open Projects' started by MachairaJP, Oct 1, 2020.

  1. Soundguy

    Soundguy

    Joined:
    Oct 30, 2009
    Posts:
    49
  2. Soundguy

    Soundguy

    Joined:
    Oct 30, 2009
    Posts:
    49
    I'm new to reviewing pull requests in Unity, If i want to go and look at either @Caiuse or @dkaloger 's pull requests and check them out in Unity - how do i do that? I tried checking out the repository fork but that brought me to the latest commit rather then the PR 's latest commit which caused script complation errors.
     
  3. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    I just found out this open project when trying to find some reference to build DialogueSystem for my game,
    then got inspired to build DS with Timeline.

    So here it is... I comeback to return the favor :D

    About my DS:
    Main new feature:

    - It can wait for user input. (wait or not depend on the DialogueController. Timeline is just some extension from this controller).
    - Can move object (like camera) when waiting for user input.
    - Will jump timeline to proper clip if player input is faster than the timeline.
    - Can play the timeline in preview mode (with updated text).
    Improvement (maybe) from our current implementation:
    - No need to initialize DialogueClip with dialogue id one by one (Our current implementation).
    My implementation just need the last id from DialogueData (SO that holds message, actor, etc) that you want to cut/hold from (the main difference with the Caiuse implementation).

    (for better understanding from what I meant, you can see the video linked below)


    Do my dialogue system suit this project? and... do anybody has been working for this?

    If it's suitable and no one has been working for this yet... how to contribute?
    this is my very first time. I usually a lonely coder :( ehe

    I mean, should i fork the @Caiuse repo or from UnityTechonologies repo? (since the PR isn't merged yet)
     
    Last edited: Oct 22, 2020
  4. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    Hi @Soundguy ,
    yes, the video @cirocontinisio didn't work in my laptop too.
    But i believe, the video he meant is this:

    ---------------
    I'm still new about this kind of stuff too (working with git)
    But, I'll try to help...

    about your issue with git,
    if you fork from UnityTechnologies repo, you can't see the PR latest commit because that isn't merged yet.

    try to fork directly to repo that you want to test. About compilation error, try to use the same Unity Verison.
    I have try the master branch from UnityTechnologies repo and Caiuse repo with no problem (today)
     
  5. shuttle127

    shuttle127

    Joined:
    Oct 1, 2020
    Posts:
    183
    If you only have a few tweaks to the code @Caiuse has in that PR, fork from that and submit a PR to that branch for review. If it’s completely different from that implementation, fork from the main Unity repo and submit a PR that way.

    Either way, that art style kinda fits the concept art for this, nice job.
     
  6. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    That's good to hear.

    Aight, gonna work on it this week.
     
  7. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
  8. shuttle127

    shuttle127

    Joined:
    Oct 1, 2020
    Posts:
    183
    You have to check the distribution license of other people's code because this is a free and open source project. If they have any kind of restrictions we cannot use it. Looks like that one has an MIT license, which may be okay, but let's ask @cirocontinisio just in case.
     
  9. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
  10. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    @Sarai I left a comment at the bottom of the PR.
    @Caiuse thanks for making a PR which is essential, I wanted to merge it. However, I left a code review that I'd like to see addressed before we do.
     
  11. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Finally managed to merge the mega PR, but I had to make a lot of changes to it to model it on basically what was the task, and also decouple the cutscenes from the dialogues, from the UI.

    Now it should be all pretty clean, and we can move on with the Dialogue System (which depends a bit on the UI).

    Happy days.
     
    Amel-Unity likes this.
  12. kirbygc00

    kirbygc00

    Joined:
    Apr 4, 2016
    Posts:
    50
    I had an issue when pulling this update in, but i realized it was some local issue with my git setup. PR is all good.

    However, when i was digging around I saw some stuff:
    1. We are subscribing and unsubscribing to input events using anonymous lambdas which is not good (https://stackoverflow.com/questions/1362204/how-to-remove-a-lambda-event-handler)
    2. We are also subscribing to `activePlayableDirector.stopped`, but never unsubscribing?
    3. We have an existing input reader. I think it would be a good idea to extend the input reader to handle these requirements, rather than bypass it. This is actually why the method signature on the handlers in the dialogue manager do not line up with the event signature.

    I put in a small PR to asdress these issues.
     
    Last edited: Nov 10, 2020
    cirocontinisio likes this.
  13. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    @cirocontinisio
    Want to report, timeline dialogue is not pausing at the end of the last clip. Is that considered a bug?
    You leave comment in the code. Is that a note or you also don't know why it's not working? ehe

    Also, I have suggestion, a small feature:
    Current implementation cannot advance dialogue fast enough, you need to wait till end of clip to be able to advance.
    How about we make timeline jump to end of the clip while we are still at the beginning or middle of the clip.
    How's that?
     
  14. kirbygc00

    kirbygc00

    Joined:
    Apr 4, 2016
    Posts:
    50
    Seems like we should probably stop the track once the dialogue is over. I can roll this into my event subscription fix.

    I don't think it would be difficult to implement... Kinda reminds me of how the witcher does cutscenes/dialogue. I like it! =)
     
  15. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Is that really needed? If you skip in a dialogue you move to the next line of text (and you can read it), with a Timeline you don't know what you're skipping.
     
  16. kirbygc00

    kirbygc00

    Joined:
    Apr 4, 2016
    Posts:
    50
    I am not very familiar with authoring cutscenes. I am assuming that the feature would work like follows.

    Scenario 1:
    1. camera pans over town for 3 sec
    2. user wants to jump to next camera shot
    3. user hits space
    4. 2 seconds of pan is skipped, camera is now at the next shot in the timeline
    Scenario 2:
    1. user has already seen the cutscene, wants to skip entirely
    2. "holds" skip button
    3. entire cutscene is skipped
    does that sound reasonable? Or are we not 'splitting' up camera shots in a way that would enable this? I think this is a pretty standard feature for most RPGs

    Also re dialogue: do we currently have skipping coded into the dialogue flow? I think this is a bit higher priority than skipping in a cutscene.
     
    Last edited: Nov 12, 2020
  17. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    For dialogues:
    We don't have animation of dialogues (yet), so we don't need skipping in the sense that whenever you see a block of text, if you press the "Advance" button you instantly see the next, so if you mash the Advance button you can go through dialogues in a few instants.

    So I guess the question is IF somebody wants to add animation to text, then we will need a skip button (?)
    But we can talk about this later.

    Or do you mean a dedicated button to skip an entire conversation? I'm not sure how that plays out when you have choices. Then what do you do, you only skip to the next choice? And what if now you need to make a choice but you don't have the information (because you didn't read), but also you don't have the option to go back?

    Personally I'd just keep it simple for now: Advance takes you to the next line of dialogue, and confirms choices.
     
  18. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    For cutscenes:
    Until now, we were only talking about skipping dialogues, not camera shots. But I don't think it's very useful, then it might make the action confusing. If we go with the direction of allowing the user to skip to the next shot... fine, I don't see it as very useful since our cutscenes won't be that long, but sure.

    I do think it would be nice to have a skip button though (and yes, make it so you need to hold it), but only for the scenario where somebody is replaying the game for the second time and they want to skip (for instance) the opening cutscene.
     
  19. kirbygc00

    kirbygc00

    Joined:
    Apr 4, 2016
    Posts:
    50
    I see, that makes perfect sense. I agree, we should wait until animations are in before we start thinking about skipping dialogue lines. And I agree, it quickly gets messy if player choice is involved at all. Definitely do not think we should be skipping the entire dialogue in that case.

    So my take is- skipping dialogue lines is only something we should think about once text animations are in. No skipping of entire dialogues (ever).
     
  20. kirbygc00

    kirbygc00

    Joined:
    Apr 4, 2016
    Posts:
    50
    Sorry, maybe i misrepresented this. I think it is a 'nice to have', a 'no-rush' feature. I do not think this is a priority. It is something i've seen as the standard for many other games, so that was why I brought it up. I think it is good to document this and store it as work for later.
     
  21. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    By advancing fast, doesn't mean you instantly see the next DialgoueClip.
    That's only mean jumping the Timeline to the end of currently played DialogueClip.

    If there is a hole between DialogueClip (like we make the camera showing something to the player),
    that still can't be advanced (since in my proposition, advance dialogue only available if playhead is on a DialogueClip).

    Yeah, it's not really needed right now, but I just want to make the cutscene more responsive.
    Maybe after we've done branching, how's that?

    btw, here is scenario that make cutscene system is 'unresponsive':
    1. Designer want to show "Hello" text (in DialogueLine).
    2. The designer make a DialogueClip without changing the default length (default length is about 5 second long)
    3. The designer bind the DialogueClip with the DialogueLine ("Hello" text).
    4. Let say player read "Hello" text only about 1 second.
    5. The next 4 second is an awkard moment of silence XD.

    If we able to advance dialogue anytime (even when playhead doesn't reach the the end of the a specific clip),
    that will make the game more responsive.

    And yeah, about skipping dialogue, it's kinda 'complex' to implement.
    But... if we still have time, and want feature similar to that, we maybe just need to set Timeline speed to 1.5 or 2 while auto advancing any DialogueClip that occur (except if there's a choices).
    So, even if there is a choices, player won't miss and we don't need to make 'complex' algorithm to solve that. (Not a skip button, but fast forward).
    How's that?
     
    Last edited: Nov 13, 2020
  22. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    btw, I'll try to work on branching feature next week,
    Let see what I can come up with
     
  23. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Just to clarify, I don't think cutscenes should have branching.

    Only regular dialogues.
    That's a mistake on the designer's side. I don't think we need't implement a skip system to allow the player to fix the shortcomings of badly-designed cutscenes!

    These all sound like a bit too much thinking to me, I haven't seen many games that allow to skip shots WITHIN a cutscene.
     
    Sarai likes this.
  24. Emikey1

    Emikey1

    Joined:
    Feb 22, 2020
    Posts:
    11
    Hi Guys, I'm new to this open project. I would like to get involved in the dialogue system work stream - is there anything I need to read to get up to speed apart from what is in the roadmap? What system is being used to display dialogues? how are tasks organised?
     
  25. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    @Emikey1
    Dialogue and cutscene system is explained in the 3rd livestream:


    In that video, they also explain how to contribute, what to do next, and more.
     
  26. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    Ohh, and also
    some task that are outside of road map but will need to do (if I remember correctly) is:
    - Add special formatting to the font (make the text bold, change the text color)
    - Displaying dialogue in preview mode of Timeline
    (explained in the video as well)
     
    Last edited: Nov 17, 2020
    cirocontinisio likes this.
  27. Emikey1

    Emikey1

    Joined:
    Feb 22, 2020
    Posts:
    11
    Many thanks Sarai - will check out the video as a first step
     
    cirocontinisio likes this.
  28. Emikey1

    Emikey1

    Joined:
    Feb 22, 2020
    Posts:
    11
    @Sarai - Hi, I watch the video about the dialogue and cutscene managers. It looks like the dialogue manager can be used independently so is that the best place to start? If I want to play with it, is it easy to get up & running in a separate project?
     
  29. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    @Emikey1
    Yep, they are independent from each other thanks to Ciro.
    So yeah, it's easy to get up and running in separate project.
    Why don't you try it out?
     
  30. Emikey1

    Emikey1

    Joined:
    Feb 22, 2020
    Posts:
    11
    @Sarai will do this week.

    @cirocontinisio - how will individual systems in this game be documented? I presume only a few people will be able to understand the E2E project? Therefore people may come to this project in the future trying to get inspiration for a particular issue they are trying to solve - e.g. I'm interested in adding dialogue to a prototype I'm developing as part of the Junior Programming Course with unity ..... if this is something of interest, I could try to document the dialogue manager .... is there an exemplar for how systems should be documented to make them easier to re-use in other projects?
     
  31. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    I saw a card on codecks stating "Branching Dialogue". What is this?
     
  32. shuttle127

    shuttle127

    Joined:
    Oct 1, 2020
    Posts:
    183
    Giving the player more than one option to choose how they respond to other characters, and allowing the dialogue responses to change based on what the characters say. This makes it so the dialogue isn't linear (i.e. player says one thing, other character says one thing back, player only has one thing to say back again, etc).
     
    Sarai likes this.
  33. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    I have made PR about branching, I also made quick video about it.
    Check it out here:
    https://github.com/UnityTechnologies/open-project-1/pull/195

    Feel free to improve or made it from scratch if you have better solution.
     
  34. shuttle127

    shuttle127

    Joined:
    Oct 1, 2020
    Posts:
    183
    I was going to mention that PR and had a feeling this username was aligned with that, just didn't want to be wrong. :p
     
  35. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    Hahaha, you have good feelings XD
     
    Last edited: Dec 9, 2020
    shuttle127 likes this.
  36. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    No, you didn't understand. I wanted to know what is Dialogue Branching
     
  37. shuttle127

    shuttle127

    Joined:
    Oct 1, 2020
    Posts:
    183
    I answered what the term is referring to in the card, and @Sarai gave the link to the PR describing an implementation in this project.

    "Branching dialogue" and "dialogue branching" are the same thing, is there something else we missed?
     
    Sarai likes this.
  38. ChemaDmk

    ChemaDmk

    Unity Technologies

    Joined:
    Jan 14, 2020
    Posts:
    65
    Hey @Sarai , thank you for the PR, I'm planning on merging it to the Quest system I'm preparing, and for that I made some changes to the Choice class,
    From
    Code (CSharp):
    1. [Serializable]
    2. public class Choice
    3. {
    4.     [SerializeField] private string _optionName;
    5.     [SerializeField] private DialogueDataSO _response;
    6.  
    7.     public string OptionName { get => _optionName; }
    8.     public DialogueDataSO Response { get => _response; }
    9. }
    Code (CSharp):
    1. public class Choice
    2. {
    3.     [SerializeField] private DialogueLineSO _response;
    4.     [SerializeField] private DialogueDataSO _nextDialogue;
    5.  
    6.     public DialogueLineSO Response { get => _response; }
    7.     public DialogueDataSO NextDialogue { get => _nextDialogue; }
    8. }
    That way, the Response is the line of dialogue that will be displayed in the choice prefab, and the NextDialogue is the dialogue we will continue with, when that choice is picked.

    I'm also thinking that the Actor of a dialogue is not related to the line, but more to the dialogue in itself. That way we should add it to the DialogueDataSO.

    Code (CSharp):
    1. public class DialogueDataSO : ScriptableObject
    2. {
    3.  
    4.     [SerializeField] private ActorSO _actor = default;
    5.     [SerializeField] private List<DialogueLineSO> _dialogueLines;
    6.     [SerializeField] private List<Choice> _choices;
    7.  
    8.     public ActorSO Actor => _actor;
    9.     public List<DialogueLineSO> DialogueLines => _dialogueLines;
    10.     public List<Choice> Choices => _choices;
    11. }
     
    Eyap and Sarai like this.
  39. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    I'm looking forward for it!
     
  40. Eyap

    Eyap

    Joined:
    Nov 17, 2017
    Posts:
    40
    Nice ! Can we already take a look at it somewhere ? EDIT: Just saw the QuestSystem branch ! :)

    Also, does this Quest system need its own thread ?
     
    Last edited: Jan 12, 2021
    ChemaDmk likes this.
  41. ChemaDmk

    ChemaDmk

    Unity Technologies

    Joined:
    Jan 14, 2020
    Posts:
    65
    You're right ! I just created the post here ;)
     
    Eyap likes this.
  42. liquify

    liquify

    Joined:
    Dec 9, 2014
    Posts:
    187
    The links of the Dialogue and Cutscenes Systems can't be clicked on the Wiki page
     
  43. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Hey, thanks, yes we haven't written documentation for that yet so they are not linked.
     
    liquify likes this.
  44. theRealWinxAlex

    theRealWinxAlex

    Joined:
    May 2, 2020
    Posts:
    73
    I'm very satisfied with the achievement of using the timeline as a dialog system. First Timeline let you make custom markers and custom tracks. Coming from the Macromedia Flash MovieCLip system with GoTO, GoTo, and Stop, GoTo and Play give me an idea of control of the timeline not just in a sequential way. Custom notification, events give you the option to communicate with StateMachine (Mecanim) etc...


    May the Forge be with you!
     
    kongchanR likes this.
  45. LithiumR

    LithiumR

    Joined:
    Oct 30, 2022
    Posts:
    1
    It seems like the dialogue branching can't use with Timeline in this openProj? What if the dialogue has audio and faceAnimation, they should stay in timeline. And normally audio can be skiped, then move to next dialogue.
     
  46. liquify

    liquify

    Joined:
    Dec 9, 2014
    Posts:
    187
    Better develop your own dialogue and quest system, because the one in UOP1 is too linear.