Adding Enemies and Simple AI to my 2d RPG in Unity - Devlog

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone and welcome back to another devlog for spellbin if this is your first time here be sure to click on the card in the top right and it'll take you to a playlist where you can start the series from the beginning it's been a few days since i uploaded the last video and i've gotten a few things done since then so let's check out what we've got done so in the time since i uploaded the video ben has given me some new sprites for the crafting table that we built last time and you can see it just is a little bit more detailed looks more like a book uh we're really happy with that and he also gave me uh some sprites for the enchanting table as well as the cauldron here with a few tweaks to the code i was actually able to use the same code that controls the crafting table interface to also control this enchanting table and the cauldron here which i was really happy about other than that we have a working draft of an inventory interface that makes use of unity's drag and drop features which i'm really happy with you can see that it makes the changes down here in the inventory bar as well so this inventory bar represents this top bar so what i want to get into today actually is adding more craftable items to the game specifically we're going to be adding a new spell so if we take a look at the enchanting table this is where we're going to craft spells in the game and the spell that we want to craft is this first spell in the ruin magic tree we're going to get into magic trees a little bit later for now we just have a bunch of placeholder spells but like i said the spell that we're gonna be able to craft is this one it's the most basic projectile spell in this magic tree and as you can see here the ingredients that we need in order to craft it are the goo which we get from trees and the bones so the way that we're kind of approaching development of the game right now to get more content in is we're deciding what we want to build into the game and then fulfilling those requirements through what we work on so in this case we need to figure out a way to get the bones into the game so going back to the method that we talked about before first we need to identify what we want to put in the game so we're wanting to put in this spell in order to build this spell we need two things goo and bones and then the next step is we need to determine what activities you get those materials from in goo's case right now you get it from chopping trees and you'll be getting it from killing our slime monster in the case of the bones you're mostly going to be getting it from killing monsters so after today it'll come from the slime and then it will also come from any other monsters and maybe some other activities that we haven't yet defined so basically what that means for us is that in order to get this spell into the game we need bones in order to get bones we need to program the slime monster so let's go over to unity and take a look at what we already have and what we need to do to get that done so luckily for us ben has already provided us with all the sprites and animations that we need in order to build out this monster so we can take a look at the prefabs that i've built out here already and we can check out some of its animations basically we have an idle animation which is really simple just two frames and then we have a jump attack animation and then we have a move animation so all that remains left for us to do is to create some ai for the monster so let's dive in and get that done so [Music] so [Music] all right so we have the ai for the slime monster programmed so let's go on over to the code and check out what we've got so far basically what we have is a really simple finite state machine that manages the state of the monster and tells it what to do and when to do it so to not get into the details too much i've made this little animation to just kind of show how it works basically what happens when the player approaches the monster depending on the distance between the player and the monster the player or the monster will be in different states so once the player reaches this point the monster will transfer into the chase state and it'll chase the player until it gets close enough to be into the attack state and if the player runs away it will move into the states corresponding to the distances from the monster so essentially the monster will move back into the chase and then the idle state depending on how far away the player moves so to see it in action let's go back over to unity to check it out so what we need to do first is to just instantiate some of these prefabs into unity and then what we'll notice is that as we get closer to the slime they'll we'll see it enter the chase state there and then the attack state there and we have our monster and like i was saying before what this allows us to have is to get us that crafting material that we need to craft the spell we can come over here and we can go into our enchanting table and we're now able to craft the spell for as many of the resources that we have so you may have noticed that there's sort of a circular dependency built in that in order to craft the spell we need the goo and the bones and in order to get the bones we have to kill this slime and in order to kill the slime we have to have the spell and so that's presents sort of a problem for now and so basically what that means for me is that over the next week or two i'm going to be working on the combat system i'll be adding more spells more monsters and more sources for these spell ingredients so that we can have a more robust combat system built out so if you're interested in that be sure to check out the next devlog which will be coming out a week from today see you then [Music] you
Info
Channel: low key sirius
Views: 165
Rating: undefined out of 5
Keywords: Devlog, Game ai, Rpg, devlog unity, game dev, game developer, game development, game development unity, game devlog, indie devlog, indie game dev, indie game development, indie game devlog, made with unity, new devlog, unity, unity 3d, unity devlog, unity game dev, unity game devlog, unity game engine, unity games, unity3d, video game ai
Id: yQKykZd7-WE
Channel Id: undefined
Length: 8min 2sec (482 seconds)
Published: Mon Oct 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.