Snaaake is a dialogue system in the style of the radio calls in classic action games. Two characters face each other on a retro screen, with a signal meter flickering between them. As each character’s voice-over plays, their portrait animates in time with it, and a subtitle shows what they’re saying.
Snaaake is included with Yarn Spinner+ for Godot (GDScript).
Trying the sample
Open addons/yarn_spinner_snaaake/sample/snaaake.tscn, and run it with Run Current Scene. Dwight calls Max Force with a mission, and the conversation plays out by itself.
Adding it to your game
- Instance
addons/yarn_spinner_snaaake/snaaake_dialogue_system.tscnin your scene. - Select its DialogueRunner node, and set its Yarn Project.
- Turn on Auto Start, and choose a Start Node.
- Tell the Voice-Over Presenter where your voice-over clips are. See Voice-over.
The screen is laid out for Godot’s default window size of 1152×648. If your project uses a different size, set to canvas_items, so it scales with the window.
How it fits together
Snaaake is made of three Presenters, and the Dialogue Runner gives each line to all three:
- The Talking Head Presenter (
SnaaakeTalkingHeadPresenter) works out which character is speaking, and which view they’re in. While the line’s voice-over plays, it watches the volume of the voice, and animates the speaker’s portrait whenever it’s loud enough. - The Voice-Over Presenter is Yarn Spinner’s own
YarnVoiceOverPresenter. It plays the line’s voice-over clip, and moves on to the next line when the clip ends. See Voice-Over. - The Subtitle Presenter (
SnaaakeSubtitlePresenter) shows the line’s text, without the character’s name, in the subtitle at the bottom of the screen.
Each portrait is a talking head view (SnaaakeTalkingHeadView, from snaaake_character_view.tscn). Each view has a Slot Name, which is how your Yarn Scripts refer to it. The scene comes with two: left and right.
Adding characters
Each character is a SpriteFrames resource. The first frame of its default animation is the character at rest, and the other frames are played while they talk.
- In the FileSystem dock, right-click and choose , then SpriteFrames.
- Open it in the SpriteFrames editor, and add your character’s frames to its
defaultanimation. The frames can be any size, but they must be square, or the pixelated effect won’t look right. - Select TalkingHeadPresenter, and add an entry to its Characters dictionary. The key is the character’s name in your Yarn Scripts, and the value is the
SpriteFramesresource.
The sample’s characters are in addons/yarn_spinner_snaaake/sample/characters/.
Putting characters in slots
Before a character speaks, put them in a slot with the <<set_slot>> Command:
title: Start
---
<<set_slot Dwight left>>
<<set_slot Player right>>
<<wait 0.5>>
=> Dwight: Max Force! #line:Start_0100_Dwight
=> Dwight: Hurry, Max Force! #line:Start_0200_Dwight
=> Dwight: You gotta move fast, Max Force! #line:Start_0300_Dwight
Dwight: You need to disable the detonators in order, or the submarine will explode, releasing the poison nano-bots! #line:Start_0400_Dwight
===<<wait>> Command.You can move characters between slots at any time. If a character speaks without being in a slot, the line still plays, but no portrait animates, and Snaaake logs a warning.
To add more slots, add another snaaake_character_view.tscn instance, give it a Slot Name, and add it to the Talking Head Presenter’s Views list.
Voice-over
Every line needs a voice-over clip. When a line’s clip ends, the next line starts, and a line with no clip is skiped.
Set the Voice-Over Presenter’s Audio Base Path to the folder your clips are in, and Audio Extension to their file type. Name each clip after its line’s ID, without the line: part. The sample’s clips are in addons/yarn_spinner_snaaake/sample/dialogue/audio/, named like Start_0100_Dwight.wav.
To watch the voice’s volume, the Talking Head Presenter sends the Voice-Over Presenter’s audio to its own audio bus, called Snaaake Voice. If your project’s bus layout doesn’t have that bus, it’s added when the scene starts. The Talking Head Presenter’s Threshold sets how loud the voice must be before the portrait animates.
Changing the look
The retro effect is a shader material, shaders/snaaake_retro.tres. To change it, duplicate it, adjust settings such as the tint, pixelation, dithering and posterisation, and set the copy as the Material of the Character node in snaaake_character_view.tscn.
The glow in the sample comes from the sample scene, not from Snaaake. To get it in your game, add a WorldEnvironment to your scene, set its background mode to Canvas, and turn on Glow.