Hi! I just wanted to say: thank you so much! I was always stuck on how to make a dialogue system in Godot, and happened to stumble upon your project last year. I used your project as reference for building my own dialogue system (https://github.com/QueenChristina/gd_dialog), and finally finished it. It was such a great educational experience, and your project broke down how it all worked in such an easy to follow way. Seriously, I cannot thank you enough! I don't think I could've managed this without you sharing your project.
Branching Dialogue Graph Godot (with json)
A downloadable asset pack
Godot Dialogue Graph with Json!
This is a simple Dialogue System for your Godot 3.x games.
It is built around a preset JSON format ( Example found under Dialogues folder) .
I made this system for one of my pet projects and figured I would post it for anyone in need of a simple system or a reference for building their own.
Disclaimer: I am familiar with good programming practices, that said I have some way to go and this was made in my first week of getting into Godot. If you have performance issues or have suggestions on how to improve performance feel free to comment. If you need help with setting it up in your own project or have unanswered questions about how it works feel free to comment as well.
For a more full fledged solution please check out this Open Source project posted by another Godoter :D :
And now to the point!
What you CAN do:
- Linear Dialogue
- Branching Dialogue (Multi-answer supported!)
- Looping and branching Dialogue
- Basically any kind of graph based dialogue
What you CAN NOT do:
- Dialogue Conditionals are at this point not supported and since I do not need them for my current projects it is unlikely i will be implementing it soon
There are instructions of how to Load a dialogue and start it inside the sole Script of the project, if that is not sufficient feel free to contact me.
There is a Dialogue json Example that you ABSOLUTELY SHOULD look at. That is how your dialogue files should look like.
THINGS TO NOTE :
- Dialogue Nodes should start at id 0
- If you want to exit the dialogue set the next_id to -1
-Every Dialogue Node must have a different id number
-The generic next_id will be ignored if you fill the choices  table .
- Currently supports up to 4 choices, you can easily expand it to more
Q: JSON Files are not showing in my Godot editor :
A: This is by Godot's design and is unlikely to change, you are still able to load and read the files just fine, they are just not shown inside the editor
Hope you find this useful , looking forward to some feedback.
- 1.0.0 Original version as uploaded on 11/03/2018
- 1.0.1 Bug Fix As pointed out by user @Hobofairy
Tested And working with the lates 3.2 beta build.
Log in with itch.io to leave a comment.
I am glad it was of help, your project from a quick glance seems awesome :D Thanks for sharing and making it Open Source :) I will add it to the description for people that are looking for a full fledged solution :)
I'm a beginner in Godot and spent like a week searching for a good way to import json files into a dialogue system, this was exactly what I was looking for! Thanks a lot for this :D
hey could you make a video tutorial for this?
Hey there, I am sorry I am not really into video making at all. If you have specific questions just fire away. In general the .json files included in the project should be self explanatory, also there is some documentation in the script, if that doesn't cover it just come back here with your questions.
The general concept is:
- Make a new script that triggers the dialogue in any way you need it (overlap with character, button press, anything else)
- Get a reference to the main UI script provided (with get_node() or with an autoload
- Then you call LoadFile("Name Of File Here")
- And finaly you call StartDialogue()
Everything else should be setup inside each .json file for each dialogue you have created, including names,text,options and where they lead etc. The one included should give a good representation of what you can do with it.
If you don't know how .json files work (or are supposed to work anyway, they are plain text files after all, they just have defined structure is all) you should check out a generic json tutorial , it should clear most things up.
Glad you liked it, there should be 0 problems moving from a Node2D to a control, or any other parent for that matter, as long as the children are there :)
Hey sorry for the late response, I had a lot of work and didn't check out itch all this time. Well yeah, you will have to make a timer of sorts that will add the letter to the TextLabel, you don't really need a TimerNode to do that, you can have an array with the final text, and another one with the current, then on the Update function you can do something of the sort:
var FullText = "Here is a green ballon!"
var CurrentText = ""
var i := 0
var timer := 0.0
timer += delta
if timer >= 0.2:
timer -= 0.2
CurrentText += FullText[i]
i += 1
And then you just update the Text Label with the current text, and check if the i reaches the last letter on the FullText so you can go on to the next DIalogue option.
So i just wanna say i have very minimal coding experience and the most i have is what i learned in my first game jam like 3 weeks ago lol. I've been looking for some pre built dialog systems but none of them stood out as something accesible and such. However your dialog graph is really good and nice and i managed to even get it to where letters appear one at a time and sound plays on each letter shown, etc. So like super kudos to you for making it accessible and such and just the comments throughout the code is so helpful! <3
I am really glad it was helpful to you, the whole point was for it to be easy to follow/educational . Getting these stuff to work for you i just 3 weeks is amazing btw, looking forward to seeing your games one day :D
I love this project and its worked really well so far, except one bit, For some reason I keep coming up with the error
E 0:00:25:0486 Signal 'pressed' is already connected to given method '_on_Button_Pressed' in that object.
<C Source> core/object.cpp:1476 @ connect()
<Stack Trace> DIalogueManager.gd:127 @ UpdateUI()
DIalogueManager.gd:98 @ HandleNode()
DIalogueManager.gd:89 @ NextNode()
DIalogueManager.gd:142 @ _on_Button_Pressed()
Any help would be really appreciated, thnx
BTW I fixed it, here's the fixed version for reference:
if curent_node_id >= 0:
if current_node_affect > 0:
for x in dialogueButtons:
Thankyou, I love your code :)
This is really cool. Thanks for sharing. I'll let you know if I use it in a project.