Dialogue System

This was by far the hardest thing for me to produce for this project. It challenged me so much, and had to be redone multiple times to get it to work. Initially, we were just going to use the add-on YarnSpinner, a prebuilt dialogue system. However, I found that it limited us and didn’t fit the kind of dialogue system we needed, so I had to make it from scratch. This took multiple weeks to develop.


Coding

I had to create three different scripts that would all work together. All the parameters were put into the dialogue base class, and all of the other scripts were placed in a namespace, so they would all share logic with each other and work together.

The dialogue base class holds the logic to write the text and what needs to activate to do so. It also plays sound when the typing function occurs to immerse the player.

The dialogue holder is what is applied to the visual text box for the dialogue. When its activated it starts the dialogue sequence coroutine. This coroutine plays out a string of sentences and deactivates them once they finish. Once the sequence has no more sentences, it completely removes the visual from the screen.

The dialogue line script controls how the lines actually play out and get inputted. This is linked to the text box within the dialogue holders. It gets a string of sentences and activates audio when the text is typing out. It then continues to the next line in the string once the delay in between has been completed.

This system allows for customisation of typing speed, audio, font, delay between lines, and how long you want it to appear for.

E-Jay made an activator for me to use in the cutscenes. I would link this code to a Signal, and I assigned that signal to a controller, which would play this code.

I did have to make a new code for the signal to activate E-Jays code. His one controls activation in normal dialogue WITHIN gameplay. My script activates it for cutscenes using signals in the timeline.


Design

I went for an old-timey feel for the dialogue box with hints of fantasy. This fits within the vibe of the game. I also used the title header from the skill tree to place underneath the speakers’ name, to help separate the areas from each other.

By nine-slicing the dialogue box, I can now repurpose it for other things, like the popups. 9 Slicing an image allows for areas not to be stretched, whilst others can.


Personal Review

This was the hardest thing I’ve ever had to produce, it was gruelling and time-consuming. The brain power I needed to achieve it burnt me out for the next week and halted my progress. Now, would I ever do it again? hesitantly yes. I learnt a lot from it and it is a multipurpose system that I could reuse in future projects, but I don’t think I’ll ever redo the system,m haha.