-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable dialogue timing options by keeping all flow control in DialogueRunner #95
Comments
Based on some discussions we are thinking the best way forward is to provide two dialogue runners. One runner is the one we all already know and would function basically exactly as is, the second would be purely event driven one. To borrow an analogy from git, a porcelain and plumbing runner. The current one is the porcelain runner and tries to handle everything for you. The second runner would be a plumbing runner and be far less “out of the box”. In particular the plumbing runner wouldn’t have callbacks or track views or even line states. It would simply fire off line after line, to anything that subscribes to its dialogue firehose. It would still craft line types for you, handle localisations, parse markup, interface with variable storage etc because I think these functions are intrinsically important to the dialogue runner. In the long run the current porcelain runner could even wrap the plumbing runner so that we only maintain a “single” runner. Thoughts? |
+1 to including a simpler minimal runner -- I've been using Yarn Spinner for years and the callback spaghetti still confuses me sometimes |
It's been a few months since I worked with YS so it isn't fresh in my head, but if I'm not missing anything this seems like a good solution. You've got my vote. |
The original problem that inspired this issue - |
Is your feature request related to a problem? Please describe.
(note this is in reference to 2.0 beta 4)
Related to #91 and another issue that I haven't been able to consistently replicate, using
automaticallyContinueLines
frequently causes errors due to race conditions and/or confusing control flow. It seems like a lot of them stem from the design of YS being mainly focused on user-controlled pacing like text based games and games with many dialogue options. The inclusion of audio clips expands the use cases for YS, but it isn't currently designed to support them as easily. For context, I'm trying to use YS 2.0 for a "walking sim" style game where a narrator is saying lines based on the user's actions and position in the world, but has no control over the pacing and no dialogue options.Currently, there is no simple way (as far as I can tell) to tell the
DialogueRunner
to only continue dialogue based on a specific view. For example, the situation in #91 where an audio clip is null but there's still text to be displayed, or a situation where you have multiple active views and a line doesn't need them all. Consider an audio line by an alien character, where the audio line is long, but the text just says "[alien language]".Likewise, there is no built-in way to have lines stay on screen for a set amount of time. So when set to automatically continue, lines disappear the moment they're finished displaying, making them impossible to read. Exposing a parameter for this would also make it easy to create a player-facing option to slow down text speed as an accessibility option.
Finally, the current configuration makes it extremely difficult to trace errors like the ones mentioned above. In addition to simplifying the control flow, this proposal could possibly enable minor optimizations like no longer needing to constantly build and clear a list of active dialogue views. (An extremely minor optimization most likely, but one that would make me very happy).
Describe the solution you'd like
This is a list of several ideal changes that would address the problem and enable some new features, but the issue could potentially be addressed by only a few of them, or some other solution. The simplest description of what I'd like is just "anything that makes
automaticallyContinueLines
not break stuff".DialogueRunner
and callbacks should only send notifications of a view changing state rather than directly calling functions inDialogueRunner
. Callbacks could even be removed entirely and/or just left as events exposed inDialogueViewBase
called at the relevant times.DialogueRunner
, or it can be updated by an event when it changes, or both, or whatever. The point here is that dialogue views would be much more flexible and decoupled. For example, it would make it easier to create a view that only showed the previous line instead of the current one. This would be good for the common situation of letting messages stay on screen and fade away at their own pace, or to display the previous line as options are displayed, as requested in Run options automatically after RunLine is finished #88.DialogueRunner
could either check each view's status to see when it's safe to proceed, or view statuses could be kept in a dictionary/list/etc inDialogueRunner
and updated by a callback from the view or some other method. This would allow the runner to maintain its own settings for which views should determine timing, block continuation, be ignored, etc.DialogueRunner
could/should only continue lines inLateUpdate
, a coroutine usingyield return new WaitForEndOfFrame()
(cached of course), or any other method which allows all views to get updated before potentially being told to continue/dismiss/etc. Part of DialogueRunner sets CurrentLine to null if audioclip is missing #91 seems to be that some callback leads toCurrentLine
being set tonull
in the middle of a loop, so something like this would hopefully avoid that type of bug on both ends of the exchange. Essentially, a line should never be able to change status twice in one frame.Describe alternatives you've considered
StartDialogue
manually, but that essentially defeats the point of using YarnSpinnerAdditional context
Some of this would be fairly easy to implement piecemeal, specifically timing the end of lines before auto-continuing could be split off into its own temporary fix.
The text was updated successfully, but these errors were encountered: