Unity Dialog System

One
Support for branching dialogue
Two
Example of dialogue system in actual game
Three
All authoring can be completed in-editor
Four
Simple persistance and branching can be created in-editor
Five
In-editor tools allow intuitive editing
One
Two
Three
Four
Five

Links

GitHub

Engine

Unity 5

Project Type

Jam Game

Duration

48 hours

Team Size

2 people

Curent status

Not in development

Overview

One of my colleagues from my final work term at the Games Institute is building a game for his PhD research and wanted to introduce dialogue into the game. As such, we agree to team up for the 2017 Global Game Jam and work on building a dialogue system which then would be plugged into his game. Since we were both ‘mentors’ for the game jam (experienced people who anyone is free to ask questions to at any point), we knew we wouldn’t have a whole lot of time so something of small scope seemed like a good plan.

I was responsible for designing the system but since I was not personally using the system (at least not currently), I wanted to make sure it was going to be as flexible as possible.

I ended up basing the system vaguely off Double Fine’s dialog system but working within the constrains of the Unity engine (we didn’t really have time to write a bunch of custom windows and since it wasn’t my project the asset store wasn’t an option).

At the end of the game jam, the system supported the following options:

  • Line set: a sequence of lines to play in sequential order. Multiple characters could be speaking the lines.
  • Choices: created on screen prompt allowing for 4 choice dialog trees (Code allowed unlimited number, GUI allowed 4)
  • Key set: There were a variety of basic key types (integers, strings, booleans) which could be set. These keys would be stored in a global dictionary which could then be written to disk allowing persistence
  • Simple branches: allowed for binary choice according to an arbitrary test. These tests were most commonly simple key tests which allowed the value of a key to be tested and the dialog branched according to the result. The two pieces combined to allow for branching persistent dialogue trees to be easily created in-editor.

The code was designed so that it was simple to create a custom component if more complex functionality was desired. Additionally, the code had hooks to pick a character, play an animation as well as play cut scenes, however due to the time constraints of the game jam (and the fact that Unity did not get a proper cut scene editor until 5.6), these features were not implemented.