Best practices for quest management, hot reload, fancy text effects

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
FrontBadgerStudios
Posts: 2
Joined: Fri Jul 29, 2022 2:43 am

Best practices for quest management, hot reload, fancy text effects

Post by FrontBadgerStudios »

Hi Pixel Crushers,

I've been checking out the evaluation version and so far I'm very impressed with the package and your tutorials, while I have not used lua scripting setting up a bridge to call my own functions in C# is super powerful and makes integrating with my existing content quite easy! I had two questions.

1. In the documentation for setting up quests you have an Increment On Destroy component that triggers a Dialogue System Trigger component for the quest "Enemies". In a world where you had 100 quests, would you have 100 instances of that trigger component (spread across objects or not) or is there a more code (vs objects+components) driven way to handle those triggers? In an ideal world I would be able to interact with the quest system more through code than assigning components to every new mob that was created, especially if the quest interactions are complex. In this ideal world I'd be able to pass the data that a Giant Rat was killed and I could write the code that would know that a Giant Rat being killed was related to quest Kill Giant Rats, and that that should run its trigger to change a QuestState. I can see a way forward that involves using the lua bridge to basically replace the data side of quests, but then I would lose the nice drop down and validation from using the actual Quest system.

2. Is there a way to enable hot reloads so I can make a change in a dialogue and see the change without having to restart/play again?

3. Is there a built-in way to dynamically modify the non-text parts of dialogue text at run-time via a sequencer? Color, animations, etc. I'm guessing the alternative would be to use a customsequencer command, but I'm not sure how you would get a reference to the text you're trying to animate without some ugly looking through the GameObject hierarchy.

4. If I'm going to be use the lua->c# bridge frequently, are there performance concerns I should be aware of or is it lightweight?

Thanks!
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best practices for quest management, hot reload, fancy text effects

Post by Tony Li »

Hi,

Thanks for checking out the Dialogue System!
FrontBadgerStudios wrote: Fri Jul 29, 2022 3:50 am1. In the documentation for setting up quests you have an Increment On Destroy component that triggers a Dialogue System Trigger component for the quest "Enemies". In a world where you had 100 quests, would you have 100 instances of that trigger component (spread across objects or not) or is there a more code (vs objects+components) driven way to handle those triggers? In an ideal world I would be able to interact with the quest system more through code than assigning components to every new mob that was created, especially if the quest interactions are complex. In this ideal world I'd be able to pass the data that a Giant Rat was killed and I could write the code that would know that a Giant Rat being killed was related to quest Kill Giant Rats, and that that should run its trigger to change a QuestState. I can see a way forward that involves using the lua bridge to basically replace the data side of quests, but then I would lose the nice drop down and validation from using the actual Quest system.
You can do it all in code, C# or Lua. The QuestLog class gives you C# access to all quest operations. If you want to do a mix -- for example, adding Increment On Destroy component(s) to your mob prefabs but not using that "Enemies" Dialogue System Trigger -- you can subclass IncrementOnDestroy or hook your C# code into the OnIncrement UnityEvent.

Not to push yet another asset, but I just want to mention that if you want more automated control of quests, we also have a separate asset called Quest Machine. (Feature Comparison Chart) It also integrates nicely with the Dialogue System.
FrontBadgerStudios wrote: Fri Jul 29, 2022 3:50 am2. Is there a way to enable hot reloads so I can make a change in a dialogue and see the change without having to restart/play again?
Yes. It requires a few C# calls, particularly to DialogueManager.RemoveDatabase() to remove the old version from memory and DialogueManager.AddDatabase() to load the new one into memory.

On a related note, you can also set up your project to hot reload in builds. For example, when Studio ZAUM was developing Disco Elysium, they distributed executable builds to their writers that could import content at runtime. Their writers, who were writing in articy:draft, didn't touch Unity. They exported their articy content to XML, and then the build imported the XML at runtime.
FrontBadgerStudios wrote: Fri Jul 29, 2022 3:50 am3. Is there a built-in way to dynamically modify the non-text parts of dialogue text at run-time via a sequencer? Color, animations, etc. I'm guessing the alternative would be to use a customsequencer command, but I'm not sure how you would get a reference to the text you're trying to animate without some ugly looking through the GameObject hierarchy.
You could, but I unreservedly recommend Text Animator for Unity. It integrates well with the Dialogue System (integration page), and it does a great job with fancy text effects. A lot of the Unity games that you see with fancy text effects use it.
FrontBadgerStudios wrote: Fri Jul 29, 2022 3:50 am4. If I'm going to be use the lua->c# bridge frequently, are there performance concerns I should be aware of or is it lightweight?
The bridge is relatively lightweight since it's all C#, so it doesn't need to cross any boundaries like a C# invocation of a C++ DLL would. (The Lua interpreter is implemented in C#.) But since it's a sandboxed interpreter it parses Lua expressions at runtime, so you wouldn't want to run really long Lua code every single frame (not that you'd ever realistically do that in the Dialogue System). The advantage of being an interpreter is that you can do really cool stuff with string substitution in Lua. It makes it really powerful and flexible.
FrontBadgerStudios
Posts: 2
Joined: Fri Jul 29, 2022 2:43 am

Re: Best practices for quest management, hot reload, fancy text effects

Post by FrontBadgerStudios »

I have to say, I had been led to believe that Pixel Crushers had amazing support, and my expectations have been exceeded!

Thank you for the prompt and comprehensive answers.

Signed,
-Newest Customer
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best practices for quest management, hot reload, fancy text effects

Post by Tony Li »

Happy to help! If any other questions come up, don't hesitate to ask.
Post Reply