Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1382335 Posts in 66038 Topics- by 58450 Members - Latest Member: drag

September 23, 2020, 04:26:52 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsSignals : Yarn Commands For Special Dialogue Options / Animated Talk Bubbles
Pages: [1]
Print
Author Topic: Signals : Yarn Commands For Special Dialogue Options / Animated Talk Bubbles  (Read 294 times)
SpaceOwlPro
Level 0
*


View Profile
« on: January 12, 2020, 01:18:56 PM »



Our game, Signals, is a dialogue focused job simulator about working at a radio station during a time nearing climate apocalypse.  

As a first time game dev, I wanted to use a dialogue system that I didn’t have to build from the ground up, but had built in capabilities to trigger functions in Unity.  I saw that Yarn met that need  with its Yarn Commands feature, so I started digging in.  Since it took more online digging than I had expected to get this working the way I wanted it to, I thought I’d do a devlog about it so that it could potentially help others conceptualize some of these Yarn tools.  For me, it’s easier to understand concepts when they’re being used in real world scenarios, so this type of devlog would have helped me during this development.

In Signals, the main character Carem has decided to strike up a job at a remote radio station in order to distract themselves from the impending climate apocalypse.  In game, this interest is manifested as a “Distraction Meter.”  



It is eventually revealed to the player that this Distraction Meter also affects the player’s ability to reach certain dialogue options when talking with npc’s in the game.  Each special dialogue option has a Distraction Meter limit, and if the meter is over that limit, the option won’t be selectable.  You might ask why we didn’t just use the Variable Storage feature of Yarn so that if the Distraction Meter is above the special dialogue choice’s limit, it wouldn’t be displayed at all.  This was our first instinct, but we quickly realized that presenting the dialogue choice and not allowing the user to interact with it was a better way to reveal to the player that there is more to the game if they choose to focus on building relationships rather than focusing on the radio station.  This builds on the game’s main theme (or rather, main question), how do you choose to spend your time in the face of inevitable death?  By presenting the choice, we hope to make the player think about the choice and what it means in the scheme of things.


To achieve this effect we used Yarn Commands, which are typed directly into the dialogue scripts and parsed out by the Yarn Dialogue Runner to then trigger a function somewhere in our game code.  Basically, just before a special option in dialogue, the writer must simply type a Yarn Command.

Code:
<<Carem>>
[[They’re alright.|Alright]]
[[I’m kinda scared of them.|Scared]]
[[Hey, I'm kinda busy...|Busy]]
<<SpecialOption DialogueController 3>>
[[...How've you been, Dar?|Special]]

In order for that Yarn Command to mean anything, though, I have to do some work in the game code in Unity.  This Yarn Command is made up of 2 sections, the name of the Yarn Command, the Unity GameObject that that holds the script that the Yarn Command is defined in.  A third element is optional if you wish to pass a string parameter to the Yarn Command’s function.

Now that the writer has defined a dialogue option as a special one with the above Yarn Command, the game has to do something with it.  That’s where the function attached to the Yarn Command comes in.

Code:
[YarnCommand("SpecialOption")]
   public void SpecialOption(string limit)
   {
       specialOption = true;
       int setLimit = int.Parse(limit);
       specialOptionLimit = setLimit;
   }

These Yarn Commands can be used to do basically anything in game.  

Another place that we used Yarn Commands in Signals was to affect how the dialogue bubbles animate.  We wanted to add a small amount of flair to the dialogue bubbles that match the energy level of the NPC character at the given moment that they’re talking.  


At the start of each branch from the NPC, the writer simply types a command like this:

Code:
<<Dar EnergyController High>>
Oh, not you Carem.  I thought you were smart!  There’s absolutely no reason to be afraid of roller coasters!!!

This Yarn Command starts with the name of the function (conveniently the character’s name), the GameObject that houses the script where the Yarn Command is defined, and a parameter string that defines the energy of the NPC.

Code:
  [YarnCommand("Dar")]
   public void DarEnergy(string choice)
   {
       darDialogue = GameObject.Find("Dar").GetComponentInChildren<NPCDialogueUI>();
       switch(choice)
       {
           case "Normal":
           {
               darDialogue.npcEnergy = NPCDialogueUI.NPCEnergy.Normal;
               break;
           }
           case "High":
           {
               darDialogue.npcEnergy = NPCDialogueUI.NPCEnergy.High;
               break;
           }
       }
   }



A minor issue with this setup is that when this dialogue runs, the energy level is set while Yarn is telling Unity to start typing the dialogue.  This is a problem, as the function itself is telling the dialogue bubble Animator information that it needs before it pops up, but where it sits now, it gets the information after it is already activated.  My current workaround for this is a bit messy…  and it is probably a tell for how much of a beginner I am.

Basically, my workaround is to make the Dialogue UI Handler wait for one of these NPC Energy Yarn Commands before animating ANY dialogue bubbles…  The reason this is problematic is that the writer must remember to type one of these commands before each new branch of dialogue or else the Dialogue UI handler never types the next line.  I know I could probably get the Dialogue UI Handler to pre-parse the dialogue before it gets typed in order to avoid this, but my abilities in such things are limited, and I want to keep moving.  This works, and it hopefully isn’t too painful once we get into writing dialogue.


I hope this helps you out in some way!  We hope to put out more devlogs like this as we get into the more exciting parts of development.  I’ll be doing a video version on Twitch soon, so follow us and keep an eye out for more devlogs and streams if you care!

<3 Kurt (& En!)
« Last Edit: January 12, 2020, 01:34:28 PM by SpaceOwlPro » Logged
ChrisLSound
Level 1
*



View Profile WWW
« Reply #1 on: January 13, 2020, 08:46:10 AM »

how do you choose to spend your time in the face of inevitable death? 

Huh, this is a cool premise. The color palette in these screenshots is not what I'd expect for it either. I'm intrigued!

When do you typically stream?

Also, that logo is super gorgeous. I love it.
Logged

Game Music Composer
Portfolio
Twitter
SpaceOwlPro
Level 0
*


View Profile
« Reply #2 on: January 14, 2020, 06:01:31 AM »

Thank you!  Our game design is all about balancing between cute and fun (job simulator, do chores stuff) and the impending climate apocalypse and how that effects the characters in game.  So, we hope to do it in a way that brings an honest comedy to it all in order to explore concepts that might feel too dark otherwise.

Since we're new to Twitch, we're trying to get into the swing of a schedule but we're not there yet.  Follow me on Twitter as well and I'll post when we're up next and what a regular schedule might look like!  Smiley  @spaceowlpro

Thanks for saying something about the game.  It means a lot!!! <3
Logged
Kris with a K
Level 1
*


It's a good day to die.


View Profile
« Reply #3 on: January 14, 2020, 05:18:31 PM »

I'm pretty interested about this. I like radio. Feels like it could be a solarpunk game. It could also be a cyberpunk game. Can we grow plants?

My only concern is it seems very one-track. You can be more or less distracted, but there's no lateral implications. How do you distract yourself -- creatively, destructively, passionately, grudgingly? There are so many other dimensions to consider.

Thanks for sharing the under-the-hood details, by the way, that really is helpful for a lot of us.
Logged

SpaceOwlPro
Level 0
*


View Profile
« Reply #4 on: January 15, 2020, 09:55:50 AM »

Quote
Can we grow plants?
You can grow plans!! One of the characters (who only speaks in images) is on a sort of off-screen adventure related to the state of the climate and they drop plants off to you to take care of.  These plants are an important element to that character's missions, so the daily care of these plants impacts the way that plot line goes down.  (We just loved the idea of having an adventure game playing out off screen, and you only get to see glimpses of it through vague abstract dialogue with the character.)

Quote
My only concern is it seems very one-track. You can be more or less distracted, but there's no lateral implications. How do you distract yourself -- creatively, destructively, passionately, grudgingly? There are so many other dimensions to consider.

I hear you on this!  I'm a big fan of the writing philosophy of the screenwriter Charlie Kaufman.  In a Bafta talk, he said something along the lines of
--
As a writer you should learn new things while exploring a theme or concept, and you should let those new things feed back into the writing.  That way the writing becomes more true to how you as a unique individual relate to it.
--

We started with a theme or idea that we wanted to express, and as we explore it we see how this theme is flawed or one-track as you mention and we change and let the work change with it. 

We're trying to operate like that, especially since we've never made a game before!  It's just two of us, the artist also co-writes and I'm coding/implementing/scoring etc...  (Eventually we might bring on a writer to help hash things out.  Still open to that if we reach a point where we feel like our writing isn't enough.)

We have other game mechanics that bring out some of these different aspects of distraction that you mentioned, but I'll definitely think on this more.  Seriously, thank you so much for the honest words.  It helps us challenge the work and helps it grow! <3

Quote
Thanks for sharing the under-the-hood details, by the way, that really is helpful for a lot of us.
Ahh thanks!!  That really is helpful for me to hear.  I figured our game isn't super well known, so might as well post things about how we're making it so maybe that on its own will interest people.  Tongue

Wow... so sorry for this long reply.
Take this random Gomez as an apology? Gomez
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic