With Inworld, you can create advanced
AI NPCs that can respond to any question and dynamically interact
with the world around them. But can you integrate them
into an existing game? The team at Slothtopia
will take you through how they did so. In their case, they chose to have the animal characters
speak an animal language and translated their words
in a dialog box. Here's how they did it. Hey guys, I'm Liam. I'm the lead developer behind Slothtopia
and I actually incorporated Inworld recently to enhance AI interactions
to really bring the game to life. So in integrating Inworld, I pulled up
the studio and I went to the integrations tab where it has the list of different
integrations. Unity. Unreal. Node. My case, it was Unity. I clicked it and that actually opened up this really handy tutorial section that kind of walks you
through everything that you need to know. I just followed through. I watched the video for a quick overview
and a little bit on the integration itself. I skipped through the lip syncing and eye
movements because those are all optional, but I went through all of that
and that kind of helped me have an understanding
of how to integrate it. And then I went over to the studio where
I created my character, which is Wolfram. I didn't use the characters
that are over here with Ready Player Me. I actually used one of our own characters, so I actually just ignored that aspect
right there. And then under scenes
I created my own for Sloth Island, which represents the island in game. So here's Slothtopia,
our brand new island scene. Still a work in progress,
but this right here is Wolfram, who is actually representative of that character
that we showcased earlier in the studio. Speak to him over here. If you do converse, this is where it
triggers Inworld to start speaking. But I also I'll go ahead and send “Hey!”. So what brings you
to these beautiful Islands? I'm always looking for someone
to join me on my adventures. A little dialog input prompt will come up. I can say, “I'm always looking for new friends, you down?” He’s so kind. This is all powered by Inworld. Converse with him
until your heart's content with it. How we're going to have it set up in the future is we're going to be pulling
in the emotions that Inworld allows and actually injecting emotes
through an animation or other things into the character. So it really feels
very alive and very dynamic. And all
of this is possible because of Inworld. So this is my interactable NPC over here and over here you'll see that
the Inworld character itself, where it has all the references required
to have it run properly. I- Once I had that set up, I went over to the studio panel and I logged in with my credentials can go over here. There's a quick little link to find that. I actually have everything
set up on my Safari browser, so let me go ahead and pull that up here and you will see that you go to integrations,
you can request a studio access token. So just copy that
it should give you 15 minutes to plug that in
and connect to your Inworld set up. So I went over to Inworld, I went to a studio panel and then I just paste that in over here, log in. I've set up the workspace Slothtopia, my key and my Inworld scene,
and it takes a few minutes to pull that, a few seconds
rather to pull that from the server. There we go. And now it's connected. It should be
it should download the data that you need. So Wolfram actually got pulled
from the server and you'll see it. I will second one over here. I wonder what that's about. I'll set up to my old name. Here is the new one. And once the Inworld character
itself is set up, you can add the audio interaction
and the interaction as well. Or it'll automatically
be added at runtime, but I like to have it there already. So that's my interactions over here. And then this is
just set up to my animation, although since I use my own configuration,
I don't think it really matters here. You have that and then my interactable
NPC component is the component that holds
all the references for my character. Essentially the brain of the character. So I'll go ahead and open that up. And if you look over here, I actually have in my awake method, I'm checking to see
if an Inworld character is attached. And if it is, then I'll go ahead
and add a listener to the “On Characters Speaks” and subscribe with my own function
right over here. So whenever the character speaks, it should go ahead and send over this data
to my character. It'll invoke this method. Or else it'll debug the character's
name, the text. It will cue
that text up into a concurrent queue. As you can see over here, have it got in the text, getting in queued over here, and then if a conversation
hasn't been started yet, we'll go ahead and call or initialize
essentially the conversation. And this is where I go ahead and link it up to my dialog system, to the typewriter,
to everything that's required. I hide the dialog queued,
the dialog input at the very beginning and I will set up the player, I'll set up the Inworld character and then if text was recently submitted, it will go ahead and play Inworld
text automatically. This is so
that when you have you press enter, you automatically start the conversation and with the NPC he'll respond right away. And here is my method for doing so. So I'll go ahead
and try to decode the text. If it pulls up, it will output it and it will play the text
through my dialog system. Now this is using the Unity dialog system,
which is right over here, “Dialog System for Unity.”
It's an incredible asset that actually by Pixel Crushers
that has been used in many games, Double A and I believe
even Triple A titles as well. I went and adapted the system partially to work with Inworld and that's what happens over here. And it's text is submitted
it sets to the trail by the text was submitted and that is pretty much it. The rest coincides with the assets
I’ve used on the typewriter and the dialog system,
but the simplest part of the setup is we have the on character speaks
that we subscribe to. And I have my method over here
that says, okay, you know what, let's cue the text up. And then whenever the player presses
enter, whenever you want to continue with the conversation, we'll go ahead and
play that next Inworld text and it will send
that over to the dialog system to to run the typewriter, to output the text with the special effects
and so all of the users pay. So it's not getting pumped out
all at once, but rather it's getting pushed out step by step,
which you'll be able to see over here. Okay, so this is the beach
and here is Wolfram over here. So we go ahead and speak to Wolfram and, you know, “Hey, what's up?”
We go ahead and press “Converse”. Let me maximize this. “Sure. What would you like to talk about?” So now I have this actually
opening up the prompt right away before I would go ahead and automatically send
a message to start the conversation. Just sending out, “Hey” but now we have
the input prompt immediately, so sure. What would you like to talk about? Uh... “How are you doing today?” Hey there. I'm- I'm doing great. And you? What brings you to this part of the world. I'm a big fan of Tropical Vibes. I spelled that wrong, tropical vibes
and a good time. What about you? Oh, oh, oh, oh, that's awesome. And see how there's a little arrow
pointing down that's essentially press enter, and
then it will continue the conversation. So, you know, that's essentially
our configuration for Inworld and how we integrated it with the dialog
system for Unity and typewriter effects. Inworld characters can be integrated
into your gaming experiences and character models in Unity,
Unreal Engine and Node.js. You can create your own dialect
like Slothtopia did, or use our character voices. To learn more, visit
the Docs page on our website or try your hand in our studio
by creating a character. Also subscribe to our channel
to stay updated and see more use
cases, tutorials and demos.