What we are going for
Dialog is a crucial part of lot's of games, especially RPGs. It seems simple at first, but if you want to make a solid structure that can support multiple dialog types, different interactions, or a dialog editor, you need to have a good method. I'll explain here how I did tackle this problem and we will build a Dialog System that can be integrated in any game.
This tutorial will provide along the road all that you need to build your own, or modify mine. Here are the specifications that we will keep at all time :
- dialog database will be stored in CSV, and so will be updatable using Excel for example.
- one dialog has a maximum of 3 screens of text. If there is more to display, we will need a second dialog.
- we want to be able to start a dialog with only the call of 1 function.
We will in a first part build the basic structure and display simple dialog with no answer ("Speach").
In a second part, we will focus on new types of dialog : multiple choices with a callback per choice, and random dialog.
In the last part, we are going to see how to integrate this system with your game and expend it with more functionalities : quest triggers, default dialog for a PNJ, expand on the output of the text (effects, sounds, ....), unskipable dialog, skipable dialog, ... I'll try to keep this part up over time depending on how the comments go, so if there is something you are curious about, just ask, and I'll try to make it happen.
Based on this structure, this tutorial will come out one part at a time.
What you need first
CSV plugin from rexrainbow. This tutorial won't focus on CSV's use, so I highly suggest you take a minute to read the tutorial (same link).