NPC Manager - New Random Spline Paths!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody and welcome to another devlog video for the npc manager system today i'd like to show you guys some of the new updates that i've made to the spline paths for the 1.2 update on the last video i showed you guys how you can now link several different spline paths and npcs will actually follow the path and that is what you see there if you remember the npcs were going around the next step was to give the npcs the ability to choose a random path and that's what i've been working on for the past few weeks so as you can see here we have all of these different paths and they're basically connected one another similar to what you would think are roads in a city so if i go ahead and select our npc here and i go down to the mpc controller you'll see now that under paths we have now different path modes and specific is exactly what you think it is that's what i showed in the last video that's where you actually have an actual path route as you can see here and you specify the exact route that you want the npc to take so you could do specific and say hey i want this mpc to transverse the map following all these routes or you can select the the random mode and then the mpc would trace for all of the different paths um in in his vicinity that have the correct tag choose a random one and start following the path and then when the npc gets to a crossroads here then he'll just choose another random path so how does that work each path remember i showed earlier that they have neighbors and that is what is the neighbor here on this end and what is the narrow here on this end i changed it to have an actual map because each path can have more than one neighbor obviously this guy here has two neighbors him and him and here he has three neighbors this guy this guy and this guy and that's what you're seeing here so the npc needs to be able to get to this location and then say hey uh choose a random neighbor from the list and this is what you see here and then he'll pick one and he'll follow it and that way the npc can be perpetually going around the map choosing random paths so if i go ahead and click play here we're just going to go ahead and observe what happens see that he chooses a random path and goes to a crossroads here then he chose this path and he's just following it along and then when he gets to this area here he's again going to choose another random path and he chooses that and here there's really not much of a choice he's just going to keep going here so obviously the interesting parts are when there's a lot of different paths that he can follow and there is no limit on the amount of paths that you can put per endpoint you can see there that he just went back i don't know if i want to change that right now uh it's it's the same path itself can be selected so the npc can kind of turn back i could remove that so the npc always chooses a different path but i don't know which one seems more natural i mean some people may decide hey actually i took the wrong turn i want to go back like in this case i want to go back so i don't know i'm still thinking about it what do you guys think and yeah that is basically it it took a lot longer than expected to get this behavior going but as you can see it is working so with one mpc it's a little bit hard to see but if i grab this guy and i start duplicating him just to make it a little bit easier to see what happens and then i click on simulate now you can see you can start to see kind of what this would look like where you would have a city with a bunch of npcs moving around and i say city because that's kind of the main idea but you don't have to do it like that this could be any kind of path through mountains or whatever anywhere on your level and you would have the npc's following random paths so you can get really specific on exactly how you want the mpcs to move around your world you could lay out about these paths all around your world and you can have certain npcs just randomly follow the path that gives you way more control uh than simply going from point a to point b because then you're you're basically allowing the nav mesh to set the actual um path right there's one more thing i wanted to show you guys and this is coming from the discord server somebody suggested having a way to stop the npc at a crossroads and again this is thinking about pcg if you're about to cross a road but then the you know the light is green and cars are going you probably want the mpc to stop wait till the light gets uh red for the cars and for them to pass um so that was actually pretty neat suggestion and this is what i did here i have a new blueprint and i called npc set speed and this is actually very very simple all we're going to do is every time an npc overlaps we have several modes here we have disabled so means it's not working for speed which is going to force the mpc to go to the new speed and then set the default speed of the mpc back right now it's four speed and the new speed is zero which means that the npc will stop um and then you can change the speed to whatever you want so if i go ahead and click play i should have probably put a couple more of these around let's do that that way we're not sitting here waiting i'm gonna move this i'm gonna move and copy some of these guys that way it's gonna be easier for us to see when the npcs overlap so now we have four of these we want to see what happens when the mpc overlaps one of these all right this guy's going to get here you can see that as soon as he gets here he stops because his speed is now set to zero and now you can see that these guys are stopped so what you can do is i think this is number three yeah this is number three here what you can do is you can say hey i want to go ahead and change this to the default speed and then you can see that they immediately go back to their default speed or you could come back here i think this is number two yep and you can say actually i want to force the speed to something different and i'm going to make this ridiculous like 2000 and i'm gonna update the speed and you can see that these guys are now going really really fast so um you can use this not just to stop the npcs but maybe you want certain areas of the sidewalk or the path for the mpcs to go a different speed maybe if they're going uphill on a on a you know on a mountain they should probably reduce the speed right when you're going up is harder or maybe when you're going downhill it's quicker so you can play around with all these things and by the way all of this should still work with the waypoints so if you put a waypoint here and you want the mpc to stop in the middle of the path they should do that as well so yeah so that is what i have so far guys random paths are working and now you have an ability to modify the speed of the npcs passing through this path including the ability to stop them obviously you would have to include logic if you're doing this for the city to set the speed here to zero when you know like the light goes red for example and then set it to normal speed for example when the light goes green but that's actually fairly simple so i'm not too worried about that the functionality the main functionality is here um so yeah um what is next honestly um i'm not sure i think i may just leave it like this for the update the other idea i had and you can see it here is with a third path mode called managed and that would be a little bit more complicated that is basically having a manager you can see that i have it right here i started working on it spline nav manager and the idea would be that the mpc queries the manager for the actual path so instead of you manually giving it the path the mpc is here says hey i need to go to this point give me the best path to go from a to b following the splines so that is a little bit harder to implement and i was thinking of using a star for that that's like a pathfinding algorithm that's like a very standard one that gets a little more complicated but ideally i would love to have that because then you could have specific locations for the npcs without worrying about a path and then this little manager here would just return the optimal path to the npc this is harder i don't know if i'm going to include that in 1.2 i may leave that for a later update because it's taking too long but i didn't want to give you guys an idea of kind of where i'm thinking this is going so um so yeah what do you guys think do you like where this is going do you have any suggestions at all about different spline modes or any other features that could come in the one that to update let me know in the comments below and if you haven't joined discord uh feel free to join i'll leave a link in the description of the video i'm way more active on discord i don't have a lot of time quiet time to record this video so if you want to interact with me ask me questions see what other people are working on with my assets feel free to join discord and interact that way alright guys thank you so much and i'll talk to you in the next video
Info
Channel: Coqui Games
Views: 348
Rating: undefined out of 5
Keywords: Unreal Engine, UE4, NPC Manager, NPC, NPC Path, AI
Id: 215kwkveTaQ
Channel Id: undefined
Length: 10min 33sec (633 seconds)
Published: Fri May 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.