viniciusgerevini / godot-clyde-dialogue

Clyde Dialogue Language Importer and interpreter for Godot.
MIT License
89 stars 11 forks source link

Playing audio along the dialogue #4

Closed lentsius-bark closed 3 years ago

lentsius-bark commented 3 years ago

First of all, I've already implemented Clyde and overall love the language as well as how lightweight it feels to use in game.

To the issue at hand, how would you implement playing voiceovers for the dialogues? Would it be using signals? Thanks!

viniciusgerevini commented 3 years ago

Thanks @lentsius-bark . I'm glad to hear that. There are few ways I can think of. Using signals (as you said), tags or ids.

Signals should be straight forward, however triggering them for every required line may be too verbose.

I prefer tags for that. You could add tags like "#audio_001" or whatever prefix/name you feel is appropriate . Then, in the place where you call get_content, you can check for tags with the right name (or that .begins_with("audio_")) and play the referenced sound file.

The same can be done with ids, however they are used for localisation as well, so you need to keep that in mind as changing them would also change the translation (in case you use this feature).

Adding examples just for a visual comparison between the three approaches:

-- events
Hi! { trigger audio_001 }
Nice to meet you! { trigger audio_002 }

-- tags
Hi! #audio_001
Nice to meet you! #audio_002

-- ids
Hi! $greeting_001
Nice to meet you! $greeting_002
lentsius-bark commented 3 years ago

Tags sound like the way to go! It also makes "clyde" sense, in that it best uses the provided features. Thanks!

lentsius-bark commented 3 years ago

Tried it and it works already! It was super easy to implement using tags. Thanks again.