Make MASSIVE procedural crowds in UE5 || UE5 Procedural Content Generator Tutorial (PCG)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys unfortunately it's me again and have you ever ran into the problem in Unreal Engine that you have a lot of meshes that you want to scatter around the plane and it's just so tedious to drag and drop each and every one of them today I'm going to show you a way how you can achieve the same results so much more efficiently so much quicker and so much more painless this is a crowd example however you can apply the same system to I don't know biomes grass buildings so you can make procedural cities and just for fun I'm going to throw in the system on how to make cutouts using blinds and it all won't take longer than a couple of minutes it's easy I promise just to show you that it's really working there you go make crow in 5 minutes for anyone who knows what he's doing and just wants to see how I did it this is basically all those blinds is just one blueprint if you go into the blueprint you can see there's 's not much going on it's literally just a blueprint with two splines that I edited in the edit I'm going to show you how guys and the second one is you have to make a procedure or generate the blueprint as well PCG graph that's what it's called and so this is going to be the graph so this is the cutout that's literally all you need for the cutout BL sampler transform points differences transform points and then spawn actor and the spawn actor does what it spawns the blueprints cheerio guy which is only this cheering guy and the other cheering guy for anyone else if that was too quick we are going to jump into it into a deep explanation right now there should be some time codes on the screen additionally I'm going to PLU a like And subscribe please and all business informations are in the comment sections below here is a link to my patreon and we are good to go to start off there is one plugin that you will need to enable and this is just it comes with Unreal Engine so it's not really a mystery procedural content generation framework PCG it will prompt you to restart your engine and you should all right let's make a neat folder for all of our tutorial purposes so what we need is a blueprint actor for it to have animation you can do this with static meshes as well which would make this whole thing a bit easier but in my case I really want a reactive crowd to work with it so in the first place we are going to create a blueprint class and this is going to be an actor it doesn't really matter what kind of actor it is it is called a Tut spline okay we're going to click in it and we're going to add a spline into here that's all we got to do actually let's click on touchline class defaults is activated and go look for a tag and we give it the tag T tag this is important please remember this tag uh also uppercase lower case it's important compile save we're good to go we're going to drag we're going to drag and drop touch spline into the scene now we can select the spline select the end point and with alt and the left Mouse button selected you can drag and drop new points into the scene isn't that nice additionally there is an option called closed loops and we closed the loops if you want to change it you can change it whenever you want after the fact as well let's drag it out if you want to make tighter the loops just scale it up and down but I think we are good to go second thing we want to create is right click you should have a new PCG system in here PCG graph let's open that one and call it Tut PCG perfect open it up you're going to see two notes and we are going to ignore actually all of them let's put them aside right click into spline get spline data there you go in this get planine data Note we're going to go to all World actors and now by tag we have to find our tline by tag Tut tag perfect save now drag and drop again spline sampler which will let us draw a couple of debug blinds onto the floor if you click on a if you highlight a note and press D you're in the debug mode right now we're not seeing anything but that might change if we once we click from on spline to on interior and obviously do not forget to drag and drop it into the scene going to uncheck treat plan is poy and now there are two Val values how often the interior surface of this spline is going to be sampled the lower the number the higher the grid and the second number is if each of those points has like let's say a bounding box a collision box this is what the second value is let's call it a collision box again with d you can deactivate the debugging or not let's leave it on because we want to see what we're going to do we we going to drag another one out [Music] transform points let's give it some random rotation in a desired Direction minus 15 on the minus and 15 on the plus O Let's deactivate the debugging here and activate it here so we see that there is some uncertainty in there and some Randomness and I think that's going to be quite nice and we are actually done if we drag out and spawn spawn an actor so let's create the thing that we actually want to spawn it is going to be a blueprint class it's going to be an actor it's cheer Santa it's going to be a cheer Santa click on it add and it's going to be a skeletal mesh you can add whatever you want but if you want to make a crowd you should make room for some people so skeletal mesh skeletal mesh AET is my cheering eight and he actually has an animation animation asset cheering a animation compile save it's called cheer Santa so spawn actor template is going to be cheer Santa no merging and you can see that there is already a lot going on let's deactivate our debugging and actually that's all there is to it there is a lot of cheer cheering Santas a lot of cheering Santas let's bring some variety into this first of all though I'm going to reduce the amount of Sanders that are in there I played around with the values a little bit here in offset Min and Max so they are not all clammed together obviously this is going to break the bound so if you don't want that don't mess with those values up here too much and if you want to spawn another a we just shift we just contrl D all of this select that and it's going to be my other cheer guy and I just called it Cheerio 2 I believe that is correct but now you can see that both of these people are in the same location it's not what we want to do as you can see now we have the problem that those two meshes are intersecting with each other that's obviously not what we want to do there are a couple of methods that you can choose now the easiest would be just duplicate this transform node in here out here alt click this one to delete it and then give it other default default resets and we are good to go you have to actually do this with every actor variation that you want to have within your circle if you spawn a static mesh then you can have an ARA element in here with all of your actors that's not possible for spawn actors though unfortunately the there's a second way you can reduce the density and this is what I did over here I'm just going to show you there's a note called attribute noise just drag and drop it in here then collect it to density filter and we have the upper threshold is the lower threshold of the second one and then we have no intersections then they are getting interchanged with each other so there's no overlap and we don't have as many people however This Is How We Do the crowd and as I promised this is highly versatile we can just drag around all of those spline end points if we want to we're going to go over there to our crowd and this is what we're dealing with now you can play with all of those variables to make it look more organic less organic whatever you want to do and on a quick side note how to do a cutout sometimes you want to have a cutout the cutout is a separate blueprint called cut I call it cut off but as you can see it's a blueprint with just spline in it same as the other one same as the other one and if we go to the PCG graph over here you can see that that just gets blind data cut off with the tag cut off spline sampler because we need that as well to tell them that we want to cut off the interior nothing else then there is a difference note you put in your your base bline in source and the one you want to subtract with in the differences and then your gold that's all you have to do okay guys this is as basic of a PCG graph as it gets so I hope there is something you could take away from all of this let me know if there's anything cool you do with this system show me in a comments send me a link find me on my socials here's my website my patreon and all of those Shenanigans again and thank you very much for your attention and I see you guys in the next video
Info
Channel: Nils Gallist
Views: 2,055
Rating: undefined out of 5
Keywords:
Id: CVBJN4fTzUo
Channel Id: undefined
Length: 10min 35sec (635 seconds)
Published: Mon Jan 15 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.