Open source feature-rich dialogue system in Godot, with an in game example. This is the code setup documentation.
UI.start_dialog("dialogue_id")
Use the id of the dialogue, such as "test", located in data\Dialogue.json
.
Please refer to the project README.md for information on how to use the system itself, features, and more.
To use the system in your project, follow these steps:
- Copy everything in the
copy_this
folder into your project. Make sure the file paths are preserved (ie.,assets
,audio
,data
,UI
,gameSrc
directories are in the root project directory, eg. res://Assets).- If you get an error about "Fix missing dependencies", then you did not correctly copy everything over -- make sure to preserve relative file paths!
- Otherwise, you will need to manually fix missing dependencies by telling Godot where each file is located.
- Autoload these as singletons (under Project Settings > Autoload):
res://UI/UI.tscn
asUI
res://gameSrc/Globals.gd
asGlobals
res://gameSrc/GameState.gd
asGameState
- Make sure to instance
res://UI/UI.tscn
in whatever scene is running.
Now, you can call UI.start_dialog(dialog_id)
from anywhere in the code to start dialog.
Add your own custom voices and dialogues in:
res://data/Dialogue.json
,res://data/Voices.json
Seeres://gameSrc/Globals.gd
fordb_dialog
anddb_voices
, where the voice and dialogue data is loaded.
Navigate to these files:
- Use custom themes and panel styles to change dialog visual style under
res://UI/UI.tscn
andres://UI/dialog/dialog.tscn
res://gameSrc/Globals.gd
, modifyexecute(act)
to define custom actionsres://gameSrc/Globals.gd
, modifyis_condition_met(condition):
to define custom conditionsres://UI/dialog/dialog_node.gd
, modifyconvert_printable(text)
and useprintable.replace
to define custom variables to show in dialog textres://gameSrc/GameState.gd
, you can custom define when the game is in a paused state, and how to react to pausing (such as during when dialog plays) UseGameState.is_paused()
to detect whether the game is currently in a paused state (such as if dialog is currently playing) and custom define how your game should react to a paused state. Connect to GameState's pause and unpause signals to react to game state changes.
Add "Left mouse button click" to ui_accept under input map to proceed dialogue with mouse click.
If you liked this project, or felt this was useful, please leave me a comment and feedback! It would really make my day.
And, if you ever make a game with this, I'd love a know! Please send me a link of your game so I can support it! <3
Sharing about my dialogue system over social media and getting the word out there would help me immensely! Thank you!