Lessons Learned
---
Writing immersive dialogue for a video game is a daunting task and it kept me from making much progress
on my dream game for a while. But there's a funny way that ideas come out of
no where. I was working on the MQTT message parsing for Deere which
involved a lot of string parsing and that gave me both the inspiration and know how to finally attempt to
create a dialogue writing system of my own. I iterated on it a few times, but landed on a very simple format
for writing dialogue and even added in functionality to support commands and conditionals.
Not only was the development of this language enjoyable (it felt a little like a I was making my own coding language), but
it became fun to write dialogue and has saved me a lot of time doing so. For a while I was adding in more
functionality than I actually needed which I had a blast doing, but wasted quite a bit of time on things I wasn't going to or couldn't use
and after creating a few of them I realized what I was doing and cut myself off on development for the time being.
Yet again scope creep had snuck in and claimed precious time.
Through this development I grew a lot more comfortable with string
parsing in C# (most of my previous experience had been in Python) and further reinforced my love for writing documentation.
Below I've included a download for the text file I put together as documentation and an example dialogue to showcase the simple yet
expansive capabilities of the language.
Reading the Dialogue
Download Full Dialogue GuideThere are a few formatting rules that you should be aware of before reading the dialogue below:
- '{}' Curly brackets hold file variables such as the name of the speaker.
- '-' Indicates the start of a new dialogue block
- '_' Indicates a choice given after the previous dialogue block is shown.
- '[]' Square brackets above a dialogue block or choice hold parameters.
Example Dialogue File
{
name="John"
}
# this is just a comment so it won't be shown
-Would you like to buy this item for 5 gold?
[next=sold]
_Yes please!
[next=notake]
_No thanks!
# if the vender sold an item we should give it to the player
[id=sold, req=gold take 5 > poorboy, end=true, checkpoint=allout, cmd=item g 0]
-Wonderful! It's all yours!
# if the player didn't want to take the item
[id=notake, end=true]
-Unfortunate...
It's wonderful sword :(
# if the player didn't have enough gold for the item
[id=poorboy, end=true]
-Aww come back when you have enough gold.
# once the item is sold
[id=allout, end=true]
-Thanks again for buying that!