Building NPC's and Dialogue for my 2D RPG

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone thanks for joining me for another devlog for dauphin i'm kicking this one off on a beautiful sunday afternoon the first half of which i've spent relaxing and reading out on the porch those are two things i've actually been doing a lot more of in the past few weeks which is why this is my first devlog in about a month after my big push to the amazing milestone of a hundred thousand subscribers i realized i needed a little bit of a break just to decompress a bit and that's been great so i really appreciate your patience and as always the amazing support throughout that break i did barely any development and didn't really do any filming but that's not to say i halted progress on the game instead of writing code and designing new gameplay systems i tried to get in touch with my creative side and make progress on both music and art for dauphin we'll talk about the music in a bit but for now i'm excited to show you the new artwork for this video's milestone which is dialogue with npcs looking at my trello board here you can hopefully get an idea for what i'm going for for this milestone basically what i want to do is create a new shop scene which is basically going to be a building that i can add somewhere to the beach or the island when the player enters that shop there will be an npc with whom the player can enter into dialogue which will probably take the form of some kind of text box system haven't worked out the details yet but we're going to cross that bridge when we get there now i want to show you this artwork that i've been working on during my little break from development and this is really just meant to be a first draft of the artwork required to complete the vision i have for this milestone the first thing you'll see here obviously is the outside of the seaside hut or fisherman's hut as i'm kind of calling it this is what will be visible from the beach or someplace on the island right after that we have the interior which is what the player will see when they actually enter this hut you'll see that this is looking very inspired by willy's hut in stardew valley that's very much the case i used that as a reference to kind of learn about how to create this kind of back wall perspective and top-down angled perspective into an interior like this i'll definitely be changing this to make it look more my own in the future but i'm really happy with this first draft in addition to the outside and interior of this building i've also created a bunch of little props here for the interior some kind of little toy sailboat a few plants and a countertop behind which the npc can stand also got some kind of goofy little fish cooler thing here now the npc himself is still in progress but i'm pretty happy with how he's looking so far don't have a name for him yet but he's just a fisherman that can wave at you when you walk into the shop now the final picture with all of this stuff included minus the fishermen if we head back to the interior here you can see how i've laid out some of these decorations to kind of make it look nice and very cozy inside which i'm pretty happy with so this is going to be our starting point for working on this milestone to bring dialogue with npcs to life all right with that out of the way time to export all this art from a sprite import it into godot and start working on creating these new scenes it's already about 3 p.m on sunday afternoon and i've got about an hour before i face time with family and make dinner so we're going to see what we can accomplish in the next 60 minutes [Music] all right so we're back in godot here and you can see down here in the file system that i've exported each of these pieces of art individually here into the engine now the reason i did all of this individually rather than just exporting the image of the finished product that i showed you is that i want to be able to move each of these items around in the engine and ultimately maybe even at run time letting the player do something like decorate their own dwelling with some of these items so definitely a no-brainer to make this a little bit more modular and composable so that's what we're going to do go ahead and create scenes for all these objects [Music] good morning everyone it is 6 30 a.m on tuesday now still have quite a bit of work to do to lay out the fisherman's hut in the engine but i wanted to pause and just give you a quick update as you can see here i have managed to complete the layout for the interior of the fisherman's hut this is actually working really well of course you can see i've just got the basics of the interior laid out with a little bit of a collision around the edge which is working as intended and of course you can see all the decorations and as i mentioned before and as you can see in the hierarchy here each one of these decorations is their own scenes this means i can move it around however i want within the interior here and easily create more of them and really just compose this scene however i want to so that worked out great i've also made some good progress integrating this fisherman's hut into the game itself so here we are on the beach as you can see and if we just head to the north here you will see the exterior of the fisherman's hut and what i ultimately want to do is have some kind of prompt show to interact with the door once you're close to it but in the meantime if you just walk up to the door you'll go ahead and transition into the fisherman's hut interior which is just as we saw before the player can kind of explore everything collisions aren't perfect yet but they do work i just need to work on the player's shadow here and of course you can do things like walk behind the counter this is where the npc will be standing and overall i just think it looks really good it's a great foundation for setting up a place to interact with an npc all right now that the fisherman's hut is constructed and in the game it's time to create the fisherman i need to export his art set up his animations just get him in the hut and ready for a conversation i'll catch up once i've made some progress [Music] hey everyone back on thursday morning just after 7 a.m right now with a quick update on the fisherman you can see i'm just chilling out here on the beach and if i head up into the hut we now see the fisherman standing behind the counter and he'll wave at us and say howdy when we walk in now this was about all i wanted to do with the fishermen in this milestone just have him hanging out in the hut ready to chat but i realized before i implement the actual dialogue i need some way to trigger an interaction with this npc and i think i've come up with a clever solution for that right now if you're standing directly across the counter from him or if you just walk right up next to him and press e which is my kind of interaction button right now i get a little print out in the output letting me know that i'm about to start a chat i haven't implemented that yet but i want to go ahead and show you this interaction system so you can see where my head is at and how i designed it the driving force behind this interaction system is a new scene that i created called the interaction manager and this is actually really simple this is just an area 2d with a collision shape and the only thing worth noting here is that i created a new collision layer called interaction i have that set for both the layer and the mask so what that really means is that this scene is only designed to collide and interact with other interaction managers the script that i have attached to this scene is pretty simple as well first let's look at the bottom here where we are hooked up to a few signals all we're really doing here is responding to when we enter a collision with another interaction manager or when we leave a collision now all we're doing here is storing a reference to whatever interaction manager we collide with basically to say hey i'm within range of something that i can interact with i want to store a reference to it so that i can interact with it now up here i have two functions that are kind of meant to be abstract initiate interaction is pretty straightforward this is where we actually initiate the interaction with whatever interaction manager we have stored if we have one now receive interaction is where things can get a little more customized any scene that has an interaction manager as a child can create a new script to override this and basically define its own behavior for how to respond to a request for interaction i'll show you how that works in just a second using this new component to hook up an interaction between the fishermen and the player was very straightforward you can see here on the fisherman scene that i've created a new interaction manager as a child and tweak the collision shape so that we can talk with the fishermen across the counter here if we swap over to the player you can see i've added another interaction manager and it just kind of covers up the player here and if i jump into the script you can see how i'm actually using this so what we're looking at here is my unhandled input function which is where i respond to the inputs for things like attack and cast but now i have a new option for interact and if we press the interact key we will use the interaction manager to try and initiate an interaction now keep in mind that if the interaction manager has a reference to another interaction manager it will call receive interaction on that other manager which is going to happen on the fishermen when he's in range so if we jump back to the fisherman scene here and look down to the custom script that i have for his interaction manager we can see that i'm printing out chat which is what we saw in the output previously this is where i'll be overriding this function to show the text box pop up and allow dialogue between the player and the fishermen i think this is a really nice system that will basically allow any two scenes to interact with each other if they both have these managers as children so i'm really pleased with it all right with all the groundwork finally laid out it is time to get to work on the dialogue system after a quick youtube search i think i've stumbled upon a really great tutorial series by gdquest on this topic so i'm gonna go ahead and dive in now and get back to you when i've made some progress [Music] hey everyone back on saturday morning with the final update of the devlog i hope you're just enjoying the sights and sounds of the fisherman's hut and the completed dialogue system there i say the sounds especially because the music you're hearing in the background is my first ever attempt at composing music and i have to say for my first attempt i'm really pleased with the result and i had so much fun making this i want to start off by showing you what i was able to achieve with the dialogue system this week it's important to note that this is not going to be a fully fledged dialogue system we really only support the notion of the fishermen talking to the player and decision trees and real conversations will come in the future i just wanted to build a strong foundation here so if we're in the fisherman's hut across from the fishermen we can press our interact key to begin the conversation and you can see a little text box pop up here and the text is written in one character at a time at a speed that i can configure once we get to the end of the message we see a prompt to continue the interaction if we just go ahead and press e again it will start to load up his next message to us now one feature that i think is really important for text like this is to be able to kind of skip to the end of the text being read out because sometimes you just want to blaze through it all so if you press e again while the text is being read it will jump you to the end state of whatever message that is in our case we're kind of at the end of the interaction here so we see an x in the corner indicating that if we interact one more time it will close the dialog box i think this is a nice strong foundation definitely needs tweaking in terms of the visuals and everything but i'm really pleased with it next i want to walk you through kind of the flow of how this system works without hopefully going into too much detail as i mentioned before this is all going to get kicked off in the fisherman's interaction manager when it's responding to a request for interaction from the player so i've overwritten receive interaction here and instead of just putting out a debug message we're now using a global singleton dialog manager class to begin dialogue using dialog text that we are loading from json now i think the json stuff is working fine i'm able to load that up no problem but i'm not actually able to edit the json file within the godot engine i have to open up an external editor so i'm not really a huge fan of that so i might be changing the location of where this text lives in the future but for now this works let's go ahead and jump into the dialog manager to see what's happening there the dialog manager is an auto load singleton that every object has access to and it really has one purpose to load the json file that we've specified for the text and then to show the ui element that we just saw in the demo this is happening down here we go ahead and instance our interface scene and we call show dialog on that interface with the text that we parsed out of the json file to actually start reading that text character by character out onto the screen the final piece of the puzzle here is the actual dialog interface itself where we're showing the text now this is a scene that at its root is a canvas layer so that it will sit on top of everything else we're already showing in the game as we would expect of a user interface and if we jump into the script it's going to look like a lot but really this is all just the logic to read out individual characters to the label that we're using as the text box and then to advance between different messages in the dialog this is pretty straightforward right now and i think it should be extensible to the point where i want to start having conversations with npcs and make dialogue choices in that text box so hopefully this extends well to that into the future but for now i'm really satisfied with it alright guys i want to wrap up the video by chatting briefly about this music you've been listening to in the background this is my take on some kind of shop theme for the fisherman's shop and as i mentioned before it's also my first attempt ever at composing music i made this track using the akai lpk25 midi controller which is pretty affordable on amazon and the unfortunately not quite as affordable logic pro x on my macbook pro i used these tools in conjunction with a really fantastic video by a fellow named andrew wong and that video was called something like music theory in 30 minutes i was basically able to watch that video jump straight into logic and create something that sounded really cool so i was really stoked about that i will definitely talk more about video game music composition in the future when i've had more practice and know what the heck i'm talking about in the meantime i'd love to hear what you think about this particular track i'm sure even if it does make it into the final version of dauphin it will be very different and much improved but i'd just love to hear your thoughts on my first take on a shop theme with that i think i'm ready to wrap up this devlog as always i really hope you guys enjoyed the progress and i am super appreciative of the support for this series now that we have a fisherman and a fisherman's hut it seems we should be able to buy a fishing pole and go fishing so maybe we'll have to see about that in the next episode until then stay safe guys i'll see you in the next one
Info
Channel: DevDuck
Views: 69,031
Rating: undefined out of 5
Keywords: indie game dev, game dev, godot game dev, godot 2d rpg, devduck, dauphin, godot dialogue system, godot npc, godot 2d, godot engine, devlog, godot devlog, indie game devlog
Id: mPg0tMiDZ88
Channel Id: undefined
Length: 15min 21sec (921 seconds)
Published: Sun Sep 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.