Practice English Speaking&Listening with: Play Character Dialogue with Attenuation in Lumberyard Games | Lumberyard Tutorial 2020.15

Normal
(0)
Difficulty: 0

Once you have audio playing, dialogue is typically not far behind. In this Lumberyard engine

tutorial we will import dialogue lines created with Amazon Polly and play them from another

character when you walk up to her.

If you like what you see, please support us by hitting that subscribe button. Smash that

bell so you get notified when there's a new video.

Welcome Lumberyard Developers to another Lumberyard tutorial. I'm your technical designer

for the Lumberyard team. John R. Diaz.

For this next piece, we have our footsteps that are only playing in one direction. You're

gonna have to go and repeat those steps for all the different footsteps animation that

he has. We have ambient sound. We have your gunshot. Uh, now I think the last place I

want to take you guys through is dialogue. What say yo if we bring in somebody that speak

to our cowboy, Let's bring good old Rin up in here. So I'm gonna right-click in here

make an entity. Call this Rin. Going to give her an actor. Look for Rin. I just imported

Rin from the samples project. Let's move her up. I'm going to rotate her, so she's facing

the right way. Um, let's give her some simple motion. And what does she have? I'm sure she

has, like an idle. And if we preview that looks like that. We'll want to loop it. I

saw another one in here that looked interesting. It was like a ready attack idle. She can look

pretty menacing. I'll give her idle. And let's give, let's add a trigger. So make a child.

Call this a speech trigger area trigger area. Let's give it a shape. A sphere will do. I'll

display it. We want it kind of three meters. Is that cool? Let's nudge her over here so

it doesn't stick out too much. Oh, yeah, let's add in our different triggers for audio. And

I'll call this one play greeting. Then I'll duplicate that call that play farewell. So

if you walk in, she'll say hello. If you walk out, she'll say goodbye. How about we go and

get some sounds for this?

A good place to get some audio is to record your own voice, using your phone or something

and import that in as a wav. Another option you have is using Amazon Polly to get some

text to speech options. And using Polly. So we have three different greetings. Three different

farewells. Let's bring those in to Wwise. In Wwise let's go ahead and set up some random

containers for our dialogue lines going to make a new one. Call it DX Greetings female

with the default working is selected I'll make a second random container and call that

DX farewells female. Especially when it comes to dialogue, you're gonna have so many characters

potentially in your game, so why not be as descriptive as possible in the beginning?

These are both set to random. Now let's import our lines. It won't accept MP3s. In fact,

Wwise only takes in WAVs and this format I've never heard of before. Amba Sonics Audio format.

I have these already exported in to WAV. I'll grab my farewells, drag those in and go back,

and I'll grab my greetings and drag these in. Expand those. Let's go ahead and generate

our events. Right-click new event. Play right-click New event. Play click on our events tab. We'll

see that these are both here. I'll take both of these events and put them into their own

folder under dialogue. Let's test these out. See how they sound. Hope to see you again.

Safe travels, cowboy. Okay, we got our randomization for the farewells. Hey there. Welcome to the

store. Hey there, cowboy. Come on in and take a look around and we have our randomization

for the greetings. Perfect. So let's save our project. Generate the sound banks. Now

let's go into the editor. Let's open up our ace tool. Click on these headphones. Let's

make a new folder for dialogue and then control click on both of our dialogue triggers. Drag

those over into dialogue and let's see hear those guys right-click execute or I can press

space bar. I don't hear anything. We know how to resolve that. Make sure to save your

changes here. Come up to game down to audio and hit refresh audio. You'll get the confirmation

message and green down below. And now if I hit space bar Whoops. Hope to see you again.

Hey there, cowboy, come on in and take a look around. Let's hook those up to our audio triggers

over here. So for the play farewell. Come on over here, click on the ellipses and we

should see folders, and for this one will click on that. Go to greetings over to the

audio trigger component and select the greetings. In my speech trigger, we need a script. We

need a script! Of course we need a script. Okay. Script Canvas. I think I had a placeholder

called Shopkeeper. Handy place to start any script. There's on entity activate. I am going

to look for an area trigger, on area entered. That's what I want while we're here I'll add

in an On Area Exited and let's display those connection controls. So connect this when

you enter and as always, we've got our trusty play audio or just play. And I'll copy and

paste this guy. And let's make some variables while we're here to point to those different

entities. So DX greeting and DX farewell. Expose on component, expose on component.

Let's drag these in. Farewell, greeting. So when you enter the trigger, she'll say hello.

And when you leave the trigger, she'll say good bye. And let's point the greeting to

the right entity. So greeting to this guy and farewell to this guy. And let's run that

and see how it goes. "Hey there, cowboy. Come on in and take a look around." Oh, yeah. All

right. Thank you very much. Rin, I'm done here. "Hope to see you again." All right,

That works pretty... that works okay. "Hey there. Welcome to the store. Don't be a stranger

now, you hear?" "Hey there cowboy. Safe travels cowboy!" Come on in and take a look around.

As I suspected, some magical Rin will be able to throw her voice and say two different lines

at the same time. There's stop triggers. There's different logic checks you can set. You know,

you can have two different triggers for when she plays one over the other. So that you're

not being lazy and checking off one trigger. But one quick and dirty way is to just flat

out say, stop. You can splice in this guy and give the source in here, and you could

do you know, you can check a bool to say if you're playing a certain line or you can add

events to to hook in to Wwise. But this should at least fix that issue. We'll just say when

you're playing exited, Um, stop without over complicating it for now. Let's see if this

handles it. So I'm going to go in. "Hey, there!" Well, don't be a stranger now, you hear? Yeah,

that's that sounds a bit more realistic. At least that she's not firing off two lines

at once. Um, and then a one last thing. "Hey there. Hope to see you again." is the fact

that you can hear her voice as if it's Hey there. Welcome in. Don't be a stranger now,

right in your head. And you know, the beauty of a 3D engine is position and directional

sound. With the container selected over here in positioning, I'm going to set, You know,

they have a default attenuation that says, you know, you have a drop off over some distance.

I'm going to set up my own super aggressive one that works within, like, three meters

just so you can hear the difference. I'm going to come in here and set new, aggressive dropoff.

I'm gonna edit that and I'm gonna set the distance super short, something like I don't

know 10? Let's try 10. Let's see what that sounds like. Hey, there hope to see you hear

that? You heard that sweetness. Hey there. You heard how that faded away more so because

the sound now is coming from a position in space and the farther you get away, you know,

the attenuation kicks in. So you may have seen that, you know, we will drag those into

Wwise and it's worth emphasizing where they live after that happens. So in your project

directory in those sounds folder in the Wwise project

under originals. This is where all those sounds get copied and nicely packaged within your

project. Can you feel a difference in our world from what it was when it was completely

silent? That's it. We have one more episode in our audio starter series, and it will cover

states and switching between audio states to affect what our triggers play and change

our ambient sound as well as the types of footsteps you hear depending on if you're

walking on wood, water, or grass.

Thank you guys for watching. Please leave a like a comment. Hit that subscribe button

if you're not already a subscriber to these official Lumberyard tutorial videos.

I'm always reading the comments. Let me know if you found the video helpful. Please join

us on our forums and continue building the discussion there. I'll as always look at the

video description for handy links to additional documentation, other relevant videos and where

you can go to on our forums to participate in this discussion.

Download Lumberyard today if you haven't done so already. It's always getting better. We're

constantly releasing new versions and new updates to it. Thank you for watching. I'll

see you guys in the next Lumberyard tutorial video.

The Description of Play Character Dialogue with Attenuation in Lumberyard Games | Lumberyard Tutorial 2020.15