Basics of AI | Live Training | Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Asher Einhorn has some really great tutorials as well that really helped me wrap my head around AI. Check out this playlist for all of his AI stuff

👍︎︎ 4 👤︎︎ u/Danaar75 📅︎︎ Dec 20 2016 🗫︎ replies

He also does videos for advanced Ai, multipart series on game ready Ai and moba kind of Ai system. All good videos worth watching.

👍︎︎ 2 👤︎︎ u/Binaryhelixx 📅︎︎ Dec 20 2016 🗫︎ replies

Nice find! Thank you!

👍︎︎ 1 👤︎︎ u/AscanioEntertainment 📅︎︎ Dec 20 2016 🗫︎ replies
Captions
hi guys Ian Chen here for the live training stream here on Twitch and I believe if anybody's been checking on the forums we're gonna be talking about some basics of AI and we're gonna really talk about some basics over the past couple days we've been kind of thinking about oh man we're kind of like jumping into like the really cool stuff of EQs behavior tree but we don't really cover any of the like the really low-level like how do I tell something where to go and where do I want that thing to be so I'm going to go ahead and jump in the other I have a third person template already set up here so that way we can follow the AI around make sure he's doing what we want them to do and also because it gives us a really really simple thing to start with so that we can copy out and make sure that we have a character running so for those following along at home I have absolutely nothing built except I have created two folders ai ai helpers and I'm going to go ahead and copy our character for our AI so just copy third person character just by dragging them in the folder copy here he'll create a copy we're going to rename him we're going to name him AI character and with that double-click him open we don't need any stuff for him he doesn't need any that in fact he's just going to be a hollow shell for us to work with no camera no camera boom compile save now we do need of course anybody who's been starting to work with this we need a AI controller unfortunately its default right now so we're going to go ahead and create us another one come out here right click content browser blueprint class all classes going to search for AI I'm just going to start with the AI controller detour AI controllers a lot of fun I've actually started playing with this it makes it so AI agents kind of move around each other really well better and so ai controller and it's at the bottom here select there we go we'll call this our I'm gonna call this a path follower ai con and in here save compile back in our character I'm going to go ahead and set this path follower I misspelled follower didn't die horribly let's go fix that really quick follower follow a littler path kind of fall fol OWA are there we go alright and so we have our character we have our AI controller our AI character has our controller so we are set to actually place one of these guys into the world and have him do absolutely nothing for us right because he doesn't have any behavior he doesn't have a desire to do anything he simply exists in the world and he's going to stand there for us right but he's not us so he's not following commands he hasn't been taken over by anything so rock on now we want to kind of create a you know pretty standard path following AI and I cannot select him for whatever reason that's not cool man so I'm going to there's no saving autosave all right well fine and I'm not going to worry about that for the moment so I want to create how do I say I'm going to create some hints for him if anybody has worked with UDK back in the day like to do pathing would create these little apples is what I remember they were little hints that you would have you guys follow around and they would Auto compile when you were building the map and they would all search out we're going to do something way way simpler we're going to create just an actor we're going to call it path we'll call it past node and in our path node really it's going to be super simple we are going to add a component we're going to add a scene and we're just going to call it route and then I'm going to add another component of a billboard so we get our awesome Raptor head alright so with our Raptor head in place we can go to our event graph and we're not going to actually need any of these for this guy in fact all we need is a new variable and we're going to call it next node our next node is going to be of a type actor ah no you know will do will do we might have to come back and change this but we'll call it a path node it makes it a little easier when we're casting to it that we don't have to or rather when we get this variable we don't have to recast to it which is kind of nice but it makes it a little more weird later on if we want to have different types of nodes so we'll just go ahead and do next node for this one and then if we need to change it will come back so in our AI controller a pardon go back to path node we want to expose that compile save back in our map we can place a couple of these so I'm going to place one like there and I'm going to place one right here so that we have two nodes out into the world that we'll be able to move between so for our for our nodes path node one we want to be able to reference our next node which will be Pat node two so let's go path node I'm just going to use the pulldown here we want to go from path node one to path node two and from path node to path node one like so okay those two are set up they don't do anything they're just saying hey I'm a data thing and I want to go there hey I'm a data thing I want to go over there so they have two locations that reference each other it's our follower that's going to do the heavy lifting so on begin play we can do one of two things we can get all nodes and choose a random one or we can choose the top one or we can have let's say we actually have a patrolling a I will have him start at a certain location either way we're going to have to get our pawn so we're going to get our controlled-not not rotation get our control pawn get controlled pawn there we go and we're going to need to cast it to our AI pawn so cast to our mmm there's AI character there we go and we'll go ahead and wire that up actually I can see exactly what's going on why I can't click on anything and if anybody can also see that a it's kind of interesting because I'm dragging off and you can see my mouse is over way a life way away from my line sort of a downside to using the widget reflector to change the scale the editor so I can see it at this range we'll go ahead and reach rank it back down and everything should line back up there we go wah wah that would've been really nice if that works but it doesn't so oh well that's okay anyway sorry a bit of an aside there we'll go ahead so we have our AI character but our AI character also doesn't know anything that it wants to do pardon our actual character the pawn the thing that's placed in the world that would be easy for us to click on and then we reference something into the world so let's go ahead and add a variable to that guy right and we'll say we'll call a desired node and for all those who might have questions about doing this in behavior trees like yeah we could have a black board to this guy and we could do the same thing and then have this assigned to a blackboard we want to start very basic and then we'll build up to that so hold on we're getting there right and we'll expose that and we'll change this to a type of path node there we go compile compile save again go out into our third person example map select there guy which I can now select because the scaling is right and we see that we have a desired node let's go ahead and take that and make it the first one so I'm just using the eyedropper here that allows me to click out into the world and we'll see that path node is selected okay so we have some data nothing's happening yet but we have the data to work with and third person also has one other thing that we're going to run into very quickly which of course is it does not have a nav volume so go ahead and fall drop in a gue hold on navmesh bounds volume and we'll go ahead and expand this out reap e there we go making little noises alright so we can see that our navmesh is actually built now sweet so now our nav guy our partner our AI is going to be able to follow these nodes move around as soon as we tell him that that's exactly what he needs to do so on begin play back in our controller bouncing around a little bit I apologize so we're back in our AI controller event begin play we're going to grab our pawn we're going to cast it to an AI character which is the specific AI character that's out in the field and then we're going to go ahead and store him so I'm going to promote to a variable I'm going to say stored pawn so there's a guy store it up ready to go and from here since we've cast them to an AI character we're storing him as an AI character we can pull off and just simply say hey desired get desired node and with that we can also say we can use the more complex move to act or finis out a little bit more where is it get moved get moved get moving nor move to door there we go move to actor sorry didn't like the pull off there so just right clicking into the world gave me our part in the the graph editor gave me that one so we'll go ahead and say move to our goal is going to be our desired and we'll give it a acceptable radius of 15 units stop on overlap use path fighting can strafe all fine none of these things are really set up all for this character so this gets us our first node and if we compile and we go back and we hit play you can see he's kind of facing that away he should just turn move a couple steps yep and now he's gotten to his first node but he doesn't know that he needs to go to a second one right so a simple way to do that we could just use a vent tick and we have access to his how he's moving or rather is he moving is he not moving so we can say I believe it's nav status get move status which is any num in this case it is of a type II path following status I'm going to just shortcut I'm going to promote this to a variable because actually this is kind of useful to hold on to and we're just going to name this desired status and delete that compile desired status is going to be set to moving okay and then I'm going to get this and we're going to compare these two so we're going to pair these so that we can pull off a vent tick here and do a branch so when he stops is when we want to update where we go so our desired status is moving so we want to say is our current status not equal to our desired status and then we'll link that in so now when we stop when this becomes true we'll go ahead and update where we want to go and we can do that we'll just go ahead and copy this out really quick and we have a stored pod we have a desired node so let's go ahead and grab our stored pawn again get him get our desired node like so just copying stuff around really quick and then from our desired node now remember this is already of the type pathing node so we can get next so we get our next node and we'll go ahead in two things we're going to plug it into our goal and because we can also do that in the future let's go ahead and get our stored part and do set desired so this is something that maybe we can use later on the pond instead of here from the AI controller we'll go ahead and do some some stuff with the with a blackboard so now we're just go ahead we're just storing that back on the pond just in case we ever basically if we want to go hunting the player so we're going to go ahead and he's going to bounce something back and forth between these and then we'll create a simple behavior tree he's gonna be like oh there's the player I want to go after the player but what happens if I can no longer see the player well we want to go back to where we were so maybe we can pull that either a from the blackboard as a desired or we could pull it from here as a desired right so we'll just be keep on storing it so we'll go to the last known place and if we compile this we save this I believe that sets up and we'll hit play and our dude is just going to be all nice and goofy run back and forth and this is just a very very simple quick way to set up a guy to move around right he's not making any complex decisions he's not he's not interfering with the player he's not doing anything in fact he looks really good if you're just running back and forth he's got nowhere really to go but to expand on that right like we can go anywhere navmesh will allow him to go and we don't have to have line-of-sight to anything nothing fancy has to happen so we can just expand this out and expand this out like so and we'll drop this up here hit up like that end and it looks like I lost or rather I move to this node so we'll drop that like that click that guy I'm hitting in to drop things to the floor if you guys didn't know about that it's really really handy so instead of our next node taking us back we'll go ahead and say let's go forward so let's go to that one and now they're all out of order but that's okay we'll go to this one and this one will go to this one and this one go to this one finally this one well not finally next to last will go to this one back here can barely see it pardon give me that that click that guy there we go and our last guy will go back around now what that means of course is going to run out and around but we can actually we can we can deal with that if I can click on them then I get them that time looks like I got him that time ok make sure that everybody has somebody different that nobody's looping back around to just base path node path node 6 and that guy's looked back around to path head so that's fine so now we hit play and there we go up and around and then he gets up there it's like out I'm gonna go back down he's going to take the shortcut around right because he's going to hug better because the navmesh allows him to cruise around the edge there so he'll come down tighten it up tighten it up tighten it up now if you run into a situation like this but like come on man that's like a step down well we have a way to do that we have the navilet approxi which allows us to place a little helper and it really helps that we can see the navmesh at this point and we'll go ahead and say there's a right and left a little note here we can take one and you'll see every time we move this it kind of it messes with the navmesh and that's fine move that one there I'll take this one I'm gonna drop it down to here just kind of get it aligned nicely who kind of disappeared there take it up another two ticks like that and we need to go from left to right and it needs to be one one way so over in our details panel uh the smart link like technically speaking like this could go the other way I guess if the the guy had some behavior that was like no this is an acceptable way to go but if I get the wall I want to climb up it and go for our guy he doesn't have that so we're just going to try to jump them down and so we're going to say only one way which we need to go from right to left so that's here under length direction under SmartLink and that should allow him to drop down which would create a quicker way to get back to our initial padding point so let's see if that worked hit play he's going to run around up over is it cheaper it's cheaper so he jumps off and keeps on going around so those are really handy we don't have a lot that I mean I think there's a one content example that shows that those things allow you to do that kind of stuff and I always like to mention those because having guys just jump off things is a really handy way to get them to loop back around there alright so now I have like a series of questions that you guys have asked on the forms over here on the side I'm not seeing any live questions pop up but also I'm also not seeing chat and forgot to log into the Twitter stream over here so I apologize and there's a can you expand you explained how to manipulate the navmesh and how path costs actually work actually I can with this little setup that we've actually done here we can create a nav models only know our guy is going to go from path 1 to path - really like right off the back here bat here right so let's increase the size wrong wrong ones like so and when you have a volume selected one of these nav modifiers there's an area class so our area class there's some stuff here that default you know default low height and null no we'll actually just remove it ok so can't move through they're not going to even bother so we hit play like he has a blocking volume so he's going to try to find another way around looks like he really wants to climb up that wall for some reason mmm yeah he's not the smartest individual perhaps let's just get rid of the link really quick I'm not sure what he's thinking he can go up there because this should be set up to only go one way from right to left yeah well you can't go that way guy sorry let's get them to go around so now you can see is going to go around but this isn't actually a blocking volume right we can freely move through here it's just saying no you can't go here but if we were to create a new area class so we can actually just create a new blueprint just like so we'll call it a high cost high cost area right click okay and within it we have a draw color and so this is going to be high cost we'll make it red right like this is this is we don't want to go here and within this nav area we have default cost and fixed area entering cost so default cost is like every step I'm taking it through I'm not sure if it's done on a per unit or maybe per meter have to talk to music Oh specifically about how that's working I haven't really looked into it but I do know that default cost is moving through entering cost is I need to enter this area how hard is for me to enter the way I like to think about it is like in Battletech back in the day on the board game you would have a high cost for entering a high a rocky area but once you were in the rocky area it might cost a little bit less to move around this is the same thing it's like it's hard to move in and then is it hard to actually move while you're moving through it we're not going to make it hard to move in but we are going to make it hard to actually move through so let's make it like a 25 compile that save it go back out make sure it's high cost I think we just have to wiggle it and then suddenly it's red if we hit play he'll go around right we all kind of figured same thing you know hey it's unfortunately he's like now I'm not going to do that that's way too much but if it says only option like let's expand this out so that it cuts through like that suddenly he's got no choice he wants to get to this point he has no choice but he has to cut through one of these so if we hit play he's going to try to figure his way around kind of cuts out found a slightly cheaper route by cutting over here but ultimately he's got to go that way so he does so now the difference between that and just no go if we do an area no like we did we hit play he's gonna get confused and you can be like oh well I'd like to get over there but really I can't so sorry I'm gonna kind of run around like a chicken with my head cut off so that would be your how to manipulate the cost of an area you can use it through these volumes if you were to make a blueprint like a crate or something that you drop down I red crate really doesn't make sense fire field you know like oh man like there's fire there or ice like that's harder for me to move through but I do need to go through it if I need to go through it that's when you would start using your area classes and then you could make like a fire field and inside it has a volume and on if you as a child of the volume if you had a nav modifier component then you would be able to set all this so I'm going to change that back to just high cost save it and we'll just keep that up there as we go down hopefully that helped whoever asked that question I don't have names over here it um let's see shooting another player we'll go over that in a sec decorators behavior trees do we have anything from higher ground to lower ground actually we just covered that one how do make an AI jump from higher ground to lower ground with the help of nav links or better use trigger volumes instead if it is I would say Naville incas it kind of just solves all the issues it creates a navigation link whereas the volume you would have to actually get to the volume to choose to jump down or as if you were to jump from if you were to use the nav length it's just sort of like oh I'm solving through the nav link rather than you got to go to that point and then you have to make the decision to jump down so I would argue them with the help of nav links I'm sure there's other instances where yeah actually if you wanted more of a custom animation feel to it instead of just navigation you'd want to go with a volume where it's like soldier walks up he's like okay I need to rope down so then he tosses the rope over flips around and climbs down definitely volume if it is sort of like free flow and just running off the edge then you get nav link would probably be best local time do all AI need to need a controller or come one controller be in charge of multiple pawns I believe it is one controller per pawn but you kind of just get those by default so even if I were to go to my guy over here and we scroll down on him to wherever his AI controllers being set it's probably near the bottom here here we got a path follower a icon if you set it just a default AI controller you get all the stuff that comes with it so you get the ability to follow pads you get the ability to use behavior trees on them you get all of that stuff to go with it if you make your own that just you know you can add functionality to it now if you add a behavior tree to your controller when we're going to do in a second that gives that guy that ability to do whatever now what you could do to control multiple ponds is have an invisible controller that has a behavior tree that defines things like I am in control of this group of guys I want them all to move to this location so instead of saying six guys you're moving ahead and you're each having to define okay I need to decide to move I need to decide to move I need to decide to move it's just one thing saying go there and then everybody else just says okay we're going to go there because we're being told to move instead of having to make the decisions on their own so if you start getting like large numbers of pawns and you kind of want them all to do it general like move to or something along those lines like it might be better to instead of having them each make their own decisions have a large controlling AI above them make that this and you can layer that think of it like an army you know you could have a general that command command your Colonels and the Colonel's command the grunts on the ground so the general is like this is our overarching goal Colonels these are the objectives we're going to complete and then the Colonel's tell the lower-level guys like okay we're going over here kill those guys we're going over there to killed those guys so the pawns can communicate like that and behavior trees can be used to communicate like that and if we have maybe some time maybe not this dream but we're doing another one of these in a couple of weeks I'll see if I can set something up to show how that would operate let's see what's the difference between doing this in blueprints and behavior tree blueprints would be I don't know I'd call it less flexible so if we go back in and we look at our path follower set up here we can see that we have quite a number of nodes that basically were spamming tech for one thing we're like hey we got to do this thing and we're at least we're blocking off moving by saying hey are we idle or not but ultimately this is kind of just simple inflexible we don't have a lot to work with here we're not passing in just whatever data we want we're not just passing in raw actors so if we were to go through and recreate this on behavior tree um which might as well do why not I mean we're here we'll go to our AI we need two things we're going to need our black board and we're going to call it path follower blog board and we're going to need our behavior tree and we'll call it our path follower bTW alright save all that and cracker path follower blackboard just make sure that we have that selected go to our blackboard we want a new key and we want it to be an object oh now don't I'm I just did that I did just do that I think I crashed yes I did alright let me bring that up real quick sorry it's a bug for behavior trees if I have to select the behavior tree I have to select the back board and blackboard and make sure that I'm actually in the behavior it's really weird let me just crack that open my project take a drink while we load now there's no monkey need this it's fine unless it doesn't load quickly now we're fine now we're fine there it is alright let's see in fact we'll do this I'm going to delete this we're going to go in here we're going to create an asset so that is forced to crack it there we go now let's see now if it crashes again we're definitely going to the monkey see if I okay we'll create a bull all right we got a bull give me an object there we go okay rename object key or not it's cool I don't know why you're not going to let me rename we want desired path node bull key probably not necessary and this will be a key type of object and if you guys don't notice you can expand out base class our object can become an act or that's what we really want then we wouldn't have to keep on recasting this stuff so we have our desired path node on our blackboard behavior tree so definitely I want a sequence and in that the very last bit will be moved to so we have a move to and I'll be to the desired path node then over here we need to select it if we were to follow the same functionality that we just did we would create a task node that would essentially copy this functionality like we want to get our desired path from we want to get like something first and then we'd want to move towards something so we can actually go ahead and instead of all of this let's set it up here first so uh vent begin play yes cast a character yes want to store pong yes we want to get the desired node and then we want to take this desired node and we want to set black board got to get our black board first this is our controller yep get black if I could spell blackboard get blackboard and then set key part set black set value as object and we'll wire together so our desired node become our object value remember since everything inherits from object and actor is an object so this is actually okay and key name all right we need to promote this because operating with these within the controller is a little bit more awkward but that's okay compile what do we name that in our blackboard desired path node okay let's compile real quick we're going to say none desired path node seems right you'll see enter and I'm going to name this variable the same thing there we go that way it's easy to reference right it's this is the thing this is the name that we are looking for for the default value that way if you needed to reuse this would be really easy to plug in all over the place so this gives us our default where we want to go and then from there we should be able to move almost entirely into the behavior tree without needing tick or anything ok so that passes up oh yeah actually and then we're going to want a run behavior tree I think I telepathically somebody probably said that in chat rises about to click away compile any errors no we're good all right shouldn't be doing anything but I bet if we hit play he'll actually probably do absolutely nothing and a tub he is running it though so that's good you guys maybe see it's kind of spamming back and forth so but desired path node actually hit play again and go back there mmm something's not right he's not being set why is that not being happening so zoom back in did I spell everything correctly step one desired path node okay desired path node I think that's right they match okay and we're setting get blackboard should be self unless I forgot probably something really really simple class defaults this is the icon and then don't disable place path follower a icon all right we're running the behavior tree unless this needs to be run first which be really awkward but we'll do that it's been a long time since actually set up this end of this pile save play blackboard behavior tree yeah okay there we go just barely wasn't okay because we weren't running the behavior tree yet so reasons fine I bet if we also would have answered that there yeah he's moved back towards it okay so since that works over in our sequence here I believe we're going to need well move to and then we need a task yeah I don't that'll work so we'll do a new task and that should been created right there we're going to get this and call find next point like that it's already open for save and event execute there we go so over in our behavior tree we're going to create a new blue we're creating a new blueprint task right I'm going to pull off here tasks and find X point so I'm just dropping that in so when our route fires into sequence and then first up we're going to say hey find our next point so our fine next point is going to call on our blueprint here which it fires this event which is a event to receive execute and it finishes with finish execute either success or failure you can we're just gonna be passing true back because we're using a sequence so that that okay and from here we have the owning actor which should be a controller so I believe we cast to a I can controller and if that succeeds we're just going to go ahead and do that this is a quick test for me this has been swapping around a little bit on me retaining them what we've been working on so we'll do that we'll go to our behavior tree so it everything is working okay we're successfully casting because we're moving to move to if we were not successfully casting this would never stop executing because we'd never get to the finish execute so yes we wanted the controller we got the controller cool from there we can say get pawn get control pond wait we don't even need to do that I'm being silly we don't need to do that get blackboard value as object key sorry guys promote and this one will be an editable and we'll just call it a well it'll be desired a path node which is going to be the only thing we have in there Weaver we set it once so we can get that we can get this object returns an actor cast to path node with casting to path we can now get our next dode get next node and from here we can also use desired path node and we're going to set that set blackboard value as object like this like this and that'll be our next value so he'll start off by trying to go to point two we can put in a little bit of handling for that or we could just make them start at the end of the path and then he'll immediately go to the beginning of the path that's fine so whenever this task is run we're saying hey what is our desired path node get that cool cast it to a path node get the next node from that node because remember we have them all in a line and they're all pointing to the next one and we're saying okay set our same value that we're exposing here we're saying set to our next to our next node which will be the next node the line and then we're saying finish execute now when that happens because these things happen in order compile save go to the behavior tree where we can see that since we exposed it our desired path node we've it's our only value as desired path node so it's set automatically if there was more we could set it specifically so our fine next point then we're moving to our next point and this will not stop executing until we're within acceptable radius so we'll say 15 and so what we'll see is that this will fire find next node will fire move to will stall while he's moving once it's done and we return to success then we start over again so save we hit play and there it goes so same thing now to answer the question it's like oh man you did this some behavior trees and you did this in you know blueprint I mean which one's better well the blueprint one is basically hard-coded to do this right it's all he can do but now with our behavior tree we have a task that is finding our next point so we have this is querying out to our Arnav our nodes and being like hey give me the next point in the list and we could use this anywhere I mean quite simply like here's our error handling for what we just talked about at the very beginning right we move to then we find our next point so now let's see if I can I'll rotate my guy here so he should jump back to this point which will move out so he ran back and now he's coming to a path to so that error-handling I was talking about and done right we just changed the our logic we just changed that order by swapping two notes back and forth um and this is let's even more is like so we've casted this to a path node we have all of this we could create so don't imagine this as a path node imagine this imagine this as a generic hint and from it you could pull a bunch of data like am i a desirable thing like do you do is this something I could path to is this something you know I want to stand around is this something it could be anything right like you can you could expand this data to be just this we're just moving to a thing so it could literally be anything right so not just a path note it could be oh this is a thing it doesn't have a next it just randomly chooses somewhere to go next okay that's fine then that behavior could be roll up into another caste node like we're asking hey what's our next one and then let's say in our behavior tree we had another task right here which was our partner would be after fine next point wherever it existed another task that says query node for what it is and it pulls out and it says okay it's this and because it's this instead of being a straight path we choose a random location to go to okay and then I sets that as a desirable path no bad node and it moves there so the flexibility offered by behavior trees huge absolutely huge comparatively to hard lining it in in blueprint but at the same time if all you need is a dude to walk a path or follow a path or something along those lines you don't need a full behavior tree for it right you just need him to go from point A to point B to Point C G back to point a I mean blueprints is a solid way to go it cuts down on having to use the AI system on top it's not too much overhead but it is additional overhead right so all right oh my god look at these questions see if I only applied certain characters I do not know question is is there a way to make a nav modifier that mesh modifier only apply to certain characters and so let's look at this so this is our nav mesh modifier I'm going to hit P bring up the the data so we can see it again our Harriett class is high is high cost and if we look at collision actor doesn't look like there's anything on the volume but on the class which I have no idea where it put this there it is um data only hmm I want to see this in the full blueprint editor please and nothing to override add event custom event only looks like this is really data only what about our main which we call it where is it our main nav bounds volume no collision covered accurate I want to say yes because there are a bunch up alright so if we go the reason I want to say yes let's go to private settings yeah nav system under the nav system we have multiple Spartans gives me we have multiple supported agents so by default you kind of just get you know the one if we were to add yet the green which is kind of what you're seeing out here from here we could add more and more and so navigation data class can be I mean we could have another recast navmesh right we could have a whole nother navmesh out here I believe actually if we start adding a few more of these we could actually show them so instead of being green make this one a really obnoxious purple really slowly and from there like we want to make sure that it recast level just do radius will make it a larger radius like 128 so we can't go everywhere agent heights fine all those things are fine and then our name will be big yeah and the default is what does leave default and from that I know there's a way that we can display that and it's not on the bounds I don't believe I believe it's the character or the controller that ends up using the nav doop unless no controller class defaults nope type of never a quick wait Oh path following now of course not there's nothing I can edit on that right because that would be up on the class defaults rather than that I'm going to have to say I don't know in this case it seems like something that should be totally doable it may not be something that is currently exposed easily in which case again I mean music oh part miss Coe should be on with us in a couple weeks and we can save that one for him because I'm sure he's like oh push button over here it happens and you know that's how he is so sorry so way to make knavish such as a ladder such as a ladder ah yes weirdly let's see if I can actually show how this might work okay so and then we'll make it wide enough this is more of a technically yes should based off of physics do two walkable but maybe not due to the navmesh actually the yes the hint should allow us to go back and forth we just have to make sure that he can walk up it in which case believe it's under is it collision where's this presets man wait here we go here we go here we go here we go walkable slope override override and this is where it gets weird welcome will slope I believe so makes it harder to walk up the surface by restricting transversal to lower than you okay so increase makes it easier to welcome okay let's make it easier to lock up welcome to a slope angle eighty nine maybe I maybe ninety works and then I believe all we need then is a hint to let us know that we can walk up it it's going to look really goofy you would need the volume to let it let it know to switch you know animations though I'm walking up this vertical surface and nav link proxy from there to there come over bring this up please autosave because thanks we'll take that down a little bit pick this over and down and then for this thing we will simply say don't go there go here save and this may not work this may need just a very slight angle a knavish shouldn't show but he should try to yeah he's trying to go up that way so good but it might require a very slight angle for him to be able to actually go up it even with the hint yep yeah I know it's goofy but we can change that probably to very low like watch 0.05 or something degrees I know probably still work it's very precise yep oh gee okay so maybe that probably needs some level of handling there but that's fun you just okay I created a launchpad without it desiring to cradle launchpad all right well answers roughly yes I might require a little bit more handling than just yes navmesh allows him to do this and then overriding walkable slope so that's a lot of fun umm dynamic and move convolving to be dynamic and move expanding fire field yes rebuild at runtime will totally affect that if one let's go ahead and enable that project settings oh man only at like 32 more minutes leave its navigation mesh rebuild at runtime I'm going to go ahead and force rebuild onload wait for it really does it just there we go okay so both those enabled and then we have we need something to move right all right easiest way to do that probably new actor blueprint actor too little click not going to name anything new component static mesh great set to I don't really care the cube keeps good save let's go ahead and place that into the world make sure okay this thing modifies the navmesh and then in our vent graph on tick I'm just going to slowly have this move so we'll just you add local awesome at actor local offset there we go we'll make this very minor along X so it's just going to kind of creep along but it's gonna be doing it every tick so it's actually can move like sixty units a you know well I think it it normalizes out to sixty so it's going to be sixty you know it's a second save come back over if we hit play okay nothing's moving right okay and then show flag or is it just can I just do shown of there we go so you can see it's like rebuilding because it's slowly moving through because it never stops like this guy's confused because you can't move through the through the red area but as soon as it moves out of the way and that area over there is allowed to reach hunk you should start moving again or not can I break something what broke dude well that was weird come on they were yes thank you no he really just doesn't to move does he well in short because this is just creeping along yeah the navigation is rebuilding all the time but you can see that the navigation is actively rebuilding as it goes so I guess in this case you would really I don't know we'd go into the settings shrink the cells or something so even this moving thing isn't like rebuilding such large areas roughly yes you can have objects volumes be dynamic and move and I believe actually if we were to jump on top of this and probably take us with it may not though because I don't know if we are actually considered who to not like that in it yeah it's going to cruise along and anything with a movement component would also do this so if this was stopped and our guy could get on top of it you would get on top of it move it to another location once it stops again navmesh rebuilds and reconnects you could then your guy could get off maybe a fun is that I'm going to be a fun example to do make your I get on a little elevator right at somewhere and then get off put that on a list of stuff I want to do so yeah and the volumes be dynamic in that case yes since uh so 0.1 yes movable point to change your volume to moveable and then you would have a blueprint change your volume settings in this case it would be a brush should be a box object or bought a box component which has an extent which you can then modify the extents at runtime to expand out or a collision cylinder or collision sphere right like that could move out and with it having a hero just do this delete new blueprint give me an add component a sphere and then we need a component nav modifier nav modifier your parent error do you parent the sphere to now okay hold on scene scene becomes the new route there we go okay it's it's outside perfect that's even better so the nav modifier volume we put in our area high cost compile save go back into here Oh wrong sphere wrong sphere wrong spear add new component not yeah no sphere that's fear why is it solid why don't my do it wrong spear collision there we go so we can see that it's not taking the exact same shape because it's minimum cell size or something or it's oh no part in it does it off the bounding box which you know doesn't affect in this case doesn't affect rotation or anything but in this specific case yes since everything on this would be movable you could shrink this grow this create more of them at the flaw on the fly expanding outwards constantly I think this is a bug I'll talk to uh music Oh about it sir okay I got 26 minutes blackboard keys why is this a comic Addison I'm backing from the pond so the blackboard is there so the question is what what is the reason behind the blackboard keys and why is it so complicated to set blackboard keys blackboard value from blueprints um I don't have an answer for the second one it shouldn't be that difficult um it should be really just as easy at it as it is to do from within a task or a service or whatnot the main reason behind them is so that you have this one easy to have asset that stores all the things you want to know about and then every AI agent has access to it right so it doesn't matter which AI it is he has his own memory it's like me having a memory that I like tacos and somebody else have a memory that he likes burritos and so on down the line of various Mexican dudes right like they're all the same and we're all storing that same data but the data held within them is different so you don't want to have to sit there with a bunch of variables kind of like manually chewing through through behavior tree are not pardoned through their blueprints whereas this one data asset is like yeah the stores all of your stuff it's your it's your memory the the process like I just showed you like going through and setting from from blueprint is yeah it's brutal and should hopefully be improved in the near future the outside of that it's like why can't I just store a bunch of variables and whatnot and I imagine there's probably memory concerns speed concerns especially if we're talking from blueprint whereas the blackboard is probably a little bit better integrated in C++ since it's just probably a large data struck that's just really efficient I don't know again that's a really good question that we'll see if we can get music out and or answer here in a couple weeks so blow me to the person who asked is there a simple way in behavior trees to select between a choice of different behaviors based on a based on a random value simple no um so if we had so if we had a decorator right on a series of sequence nodes and just go ahead and disconnect those so let's say we had a series of sequence nodes and they all had like it's a decorator by the name of compare all right but the problem is it compares two keys and if they're equal or not you could do like a storage of one two three and then a service runs on your sequence we'll just you know just to show it that would every five seconds randomly generate something and then because these are allowed to abort themselves so they would board every book thing below them you could then on change they would abort because their ideas change but this is kind of or these could be other these could be run behavior tree nodes but still you would need to weirdly store something so you can create your own decorator but something currently make missing out of bull blueprint decorators is the ability to abort so even though the value is changed or the result is changed like it'll still finish whatever it's doing and then it'll recycle through and be like ah this is now three so let's go do this one so easy no doable yes there's probably a better way to do it um given a little bit of time to think about it I'd probably come up with something way better so but not simple no I apologize the engine knows when an AI entity stuck and cannot move how can we know that I believe there is an enum that gets passed out and I'm not sure who actually gets it it's like move status so under move status and here it's easier to see under desired status because we already have one we see idle moving waiting a paused there's another one that is blocked so let's see if we can find that status let's see if it's just a status it was just a funny because I believe mean Alexander we're talking about this just the other day this is switch path following yeah no status path following path following path following path following path following god what was that one called now let's see blocking shows anything now it's casting nav wait wait wasn't that it you can get one of these returns what is this a navigation query result promote new ver compile now ok well that's if your path returns bad so if you need to know that you can't move there or if there's a fail you can get like your path cost and return whether or not it's failed or success but life of me I can't remember what that other one was navigation move to navigation project point to recast I think these I'll return whether or not they're valid or not not if you're blocked it may be an AI specific thing that it's like hey I'm blocked switch on EU navigation nope not at all what I'm looking for that's UI navigation long short the answer is yes it exists I've seen it somewhere I cannot for the life of me remember I'll see if I can post it up on the forms I it's one of those things if I had C++ open right now I could just be like oh go search for the e num and look for blocked because I know it's it's blocked that's the return that it returns on and then I could get the enum and then go in here and be like oh well references that he'll get good so I'll see if I can post that one on to the forum's right after we're done here rebuild at run time doesn't rebuild nav might and have modifiers it doesn't so if where's our okay this is our weird sphere thing are we talking I would have to ask are we talking to have modifiers that are just simply brushes or are we talking them because of the brushes the answer's no right those things you don't move them um but if we're talking something like this local that let me just do that thing again okay we're just gonna move along X this time one pile play coupe yeah ooh it doesn't appear to show let's see if it's moving yeah appears to be gone so seems like a bug wonder if I can yep that's moving over there salt briefly has launched myself up there yeah so that seems like a bug um I'll get that filed because yeah that this should be gone right we were seeing the the recast working with a static mesh but this should not be here so I bet if we were to let's see shift f1 deject grab this thing I bet if so we're still running right now it's not movable is it can I change the movable and not crash no see it now you're right it left the that that seems like a bug I'll get that passed along and why is it no idea you talked about cost earlier moving through tough navmesh --is shouldn't there be a way to limit the maximum cost in a I can move through um hmm if you wanted to limit the maximum cost in a I could move through it seems like you would just simply want to block them out but then yeah but then you're kind of like just during that section of navmesh well I mean the easiest way to do that is right here we just loaded up get path cost this returns a value if path cost is too high you should just simply pass in your start in your end and path cost if it's too much nope don't do it and recalculate something else that would prevent things from well I like that I don't want to say turn-based strategy game like on a grid but if you were working work like Warhammer where it's like rulers and things like that's like I can move 12 inches right you need to know that cost over that that distance and nope you can't do that because the cost then would be too much based off that distance then this would be a good way to say no you can't do that recalculate back in that would be my suggestion in that case as for a maximum like that actually sounds like something that'd be really cool to add to the I I control err and it seems like a or at least maybe the path following component that seems like something that would be really really cool unless maybe I'm crazy maybe already it exists let's go to AI character ah this is AI care who is the controller there we go path falling component just do a search for cost now I see it only gets path cost you have to define what you what it does so it seems like yeah that seems like a place where it's like I cannot move through I cannot move through a 15 you know initial cost or you know initial cost limitation that sounds like something to be really cool to add I'll add that in as a as a request and let's see scroll back up some of these would be much better once we actually go from in our next episode where we talk about okay now we have something moving around now we want them to engage which is a much larger behavior tree and a much longer much longer set-up time so I don't I see all your guys's questions here examples like how do I tell your AI to shoot another player how would you change AI behavior based on game time say time of day I've seen all of these and I want you to know that we're going to get to them it's just not going to be this time around do path nodes rebuild the path if objects are dynamically dropped in front of it simpler to a star yes I believe we just covered that one with the moving block it appears that there is a block a bug with the recast volumes um ladders yes yes yes yes outside of the stuff that we need to really take about an hour to expand on our behavior tree with that looks like it covers all of you other questions unless Jeff comes charging in here telling me about others more so with that I'm going to go ahead and say take it easy guys and we'll see you I believe in four weeks when music oh we'll be in town and we can get him on here and he can berate me for all the terrible things I've done in these behavior trees and why would you do it this way so anyway take it easy guys have a great evening
Info
Channel: Unreal Engine
Views: 116,220
Rating: undefined out of 5
Keywords: Unreal Engine, Epic Games, UE4, UDK, Unreal
Id: evYE7tfWXUY
Channel Id: undefined
Length: 75min 41sec (4541 seconds)
Published: Mon Apr 20 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.