This is basically a follow-up to my post long ago about my Dialogue and Cutscene Management Systems. A lot has changed in them since that initial post and they have been refined into a single package that will hopefully serve CIE needs in future projects. We’ve begun focusing on developing packages that can be imported to new projects easily to facilitate certain functions and this new “Sequence Manager” package is meant to be a simple way to get both sequenced cutscenes and dialogue trees in.
Starting with the Cutscene Manager, here’s how it looks in the demo with a simple sequence built in.
Multiple cutscenes can be added, with each cutscene being an array of “Actions” with a name attached. Actions include variables for naming, timing and Unity Events. Before I had a “move” option tied to this script but I’ve since realized that should be it’s own script that is just called with the events. I may reintroduce the “New Actors” list, which allowed for referencing objects that spawned into the program during the scene, if we find we end up needing it.
The Cutscene Manager is a simple script that takes these actions sequences and just runs through them, pausing if told to “Wait For Input”, waiting for “Set Duration” or just moving on sequentially when set to “Go Next Immediately” when needed (i.e. if a frame update is required before proceeding to the next action). It also has some Unity Events it can call when the cutscene starts or ends. In the above example, the cutscene is started by a button press in the scene rather than starting on Awake. It then waits for a set time (which we’ll go over in the Dialogue Manager) before presenting the options for continuing the dialogue. It then waits for an input to continue that comes from the option button presses.
The Dialogue Manager is a similar, but more complex script.
Like Cutscene Manager, the main point of the Dialogue Manager is a collection of “Dialogue Sets” which are themselves a collection of “Dialogue Nodes”. Each node has a variety of data that could be important to a dialogue scripts that can be input. The Dialogue Manager only handles data, it doesn’t display anything. So a different script has to take the dialogue nodes and apply them to objects as needed (in this example, the “DemoDialogueReader” in the “Dialogue Changed” event. The script handles moving between nodes through either direct continuation or jumping between nodes as needed, with many points being options for ending the dialogue. This lets us set up quick and easy dialogue trees to use for exchanges between the user and the system.
Each Dialogue Node contains information for the dialogue such as a target object that is speaking, text and audio being stated, and any events that need to trigger in that moment. There is also a set of variables for handling character animation as needed. The Animation Set contains data points like options to call Animator.Set____ functions and timing options separated from the usual timing options of the dialogue node. This lets us be able to keep separated the timing of the animation ending and the intended timing of the node ending. Finally, the nodes contain output options. When left empty, the node will assume the dialogue should end in that point. If only 1 output is set, the dialogue will continue straight on to the next node (unless told to wait). When multiple output options are present, the node will automatically assume it must wait and will only proceed when given a “LoadNode(int/string)” command so it knows which output node to go on to.
These managers can be a bit daunting to understand at first, but having used them for multiple projects now, I can say they work very well together with custom scene managers to make easy scene flows with various options. I hope we’ll get a lot of use out of them and can improve them further in the future.