Video summary of the Dialog System
The dialog system allows designers to create branching dialogs with the possibility of voiceover, where players choices affect the dialog flow.
System Summary: With the dialog system, designers can create dialog interactions between NPCs and the main character. Designers can add up to 6 answer slots from which players can choose. Players choices can affect the dialog flow and trigger different responses from NPCs. All text in a dialog offers the possibility of adding an audio file for voiceover.
Dialog states basics
Dialogs are controlled by dialog states. Each dialog state contains some dialog lines from the main character, and the dialog lines representing the NPC's response.
Simplified diagram of the contents of a dialog state
Each dialog is formed by several dialog states. To select which dialog states need to show up on the screen, the dialog controller uses a number known as the status number. The status number is a integer that changes throughout the dialog. Each dialog state has a status number requirement, that is, a dialog state only shows up on the screen if the status number is within a certain range, as seen in the dollowing diagram:
Example showing how the status number works
Players' choices change the value of the status number, hence changing the dialog options available to the player. The following diagram shows an example of a dialog flow where the status number changes based on players' choices:
Dialog flow using the status number
The system in editor
The dialog UI contains six possible answer slots that players can choose from.
The dialog UI
The UI in-game
Selecting which dialog states to show
The dialog controller takes care of filling up the answer slots, by checking which dialog states are ready to be shown on screen. In order to check that, the dialog controller looks at the status number. Every dialog state has a status number range, and when the status number is within that range, the dialog state is ready to be on screen. For instance, a dialog state may require 1<=status number<=3. If the status number is between 1 and 3, the dialog state will be shown on an answer slot.
Each dialog state has a status number requirement. The state only shows on screen when the status number is withing a certain range.
Hence at every step in a conversation, the dialog controller goes through all the available dialog states. If a dialog state fullfills the status number requirements, the dialog controller sends it to the UI. If the state doesn't fullfill the status number requirements, the dialog controller discards it.
The dialog controller iterates through the dialog states and sees which ones can be shown in the UI.
Some dialog states have other requirements in addition to a status number range. For instance, some dialog options only show up if the players have a certain item in their inventory.
Some dialog states only show on screen if the player has a certain item.