RTS Unit Setup & Selection Decal Material in Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so in the last video we set up our camera pawn and we set up functionality for edge scrolling and now in this video i'm gonna set up uh some basic functionality for units um so i'm gonna just start out by making a parent class and if you're implementing this into a game that you've already got you might already have a class existing and you would just add some of this stuff that i'm doing to your existing class i'm going to make a new one character call it parent unit class and i'll open that up and i'll make a couple changes right off the bat i'm going to use fairly small units we've got a full size character capsule here i'm just going to change that radius here to 10 and the half height here to 30. okay and i'm going to add also at this stage at decal [Music] and call this the selection decal every unit will have a selection decal and what i need to do here is rotate this on the y by 90 degrees and i'm going to make the size quite a bit smaller i'm going to go to decal size here and set these values to 20 and 20. uh well okay i guess that's uh locked in here for automatic scaling um okay and i'm gonna lower this down towards the feet of the unit and we want that to project onto the ground around the unit we don't want it to project onto the units so i'm going to grab the mesh here find receives receives decals and set that to false all right so i'll compile save i'm going to close that for now and i'm going to go ahead and make a right click and make a child class and i'll call this unit underscore style 1. we'll open this one up here and what i'm going to do is select the mesh here and i'm just going to set the mesh to be the mannequin the ue mannequin but i don't want it to be that big i'm going to change the scale here to 0.3 on all the axes and then i've got to just drop this down a little bit into the capsule e to rotate we'll turn it 90 degrees here so it's facing the forward arrow here uh all right and what i'll do is set the material here maybe to something uh more interesting so instead of male body maybe i'll use a material sphere [Music] all right so that looks okay we've got yellow pants guy here and i'll close that up and i'm just going to while i have this unit selected i'm going to press ctrl d oop make sure i have it highlighted here ctrl d and now i've got unit style too and i'll open that up uh full blueprint editor oops that's weird okay uh and for this one i'll just grab the mesh here and change the skeletal mesh to let's go with the female mannequin and the material i'll pick something different here maybe we'll go with how about uh hex tile here the pulsing hex tile all right so i'll compile save and close that and i'm just going to drag some of these units uh onto the map here uh so i'll just grab the unit style one here and uh unit style two and i'll just hold alt and click there hold alt and make another one same thing here i'll select this hold alt and drag over okay so i've made a handful of units here and we can see this uh decal that we have is uh just showing this square on the ground because we haven't actually created a decal material for that selection decal so i'm going to do that next i'll right click make a new material we'll call this selected underscore decal m-a-t [Music] and all right for this one here we're going to start off by setting the material domain to deferred decal and blend mode should be translucent and i'm going to hold three on my keyboard click here plug this to emissive color and i'm going to set this to a green color a bright green here all right and what i'm going to do here actually is i'm going to pull this out and what we'll do is apply this drag a bit of this drag this decal onto the ground here and i'm just going to scale it quite a bit smaller all right and then now we can see this as we're working with it in the other window so i can show you step by step sort of how i'm building this uh decal material all right um so right away we can see we have the entire square here is covered with our green color and i don't want to do that i want to have a circle i want to make sort of a ring here and so i'm going to use a radial gradient exponential and what i'll do is first i'll just take this input here and instead i'm going to multiply it we'll put the result to the emissive color and multiply it by the radial gradient and i'll just show you that result right away we'll apply that so now we have a circle and so that's a start um what we want to do is actually take i i don't want a solid circle i want a ring so i want to take away a circle from inside this circle and i can do just that by saying uh subtract here i'll take that pin away it will say subtract node and i'll duplicate this make another radial gradient exponential and subtract one from the other but what i'm going to do is subtract a bit less radius than the first one so if i hover here i can see the default value for radius is 0.5 so i'm going to hold one on my keyboard make a parameter and i'm going to plug that into radius here and i'll set this to let's say 0.4 and so let's try that i'm going to subtract a 0.4 circle from a 0.5 circle okay and we're we've got a ring going on here but it's really fuzzy and that's because i haven't fed anything into the density pins here so for example see i could make a fixed amount of density here let's say you know 25 or something like that if i plug that into both density nodes and apply now we've got a solid ring but i'm going to do something extra here and just go one step further and make a an interesting effect using the density and so what i'm going to do is get first a linear sine node and this is going to return a value between 0 and 1 and then back to 0 and back to 1 over and over again and i'm going to do that by plugging the time into value and i'll make a scalar parameter here and plug this into period and this will be the amount of time i want to pass between the 0 and 1 interval so i'll put this to something like 3 seconds [Music] and now i'm going to plug in my linear sine output into my densities but i don't want to go i don't just want a density of between 0 and 1. i want to multiply this so it gets to a larger value so we'll multiply that and i'll just put in let's say 25 [Music] and let's plug that into the densities and right away in the preview here we can see we have an interesting effect going on and i'll apply this and now we can see it here live in the uh the decal i've pulled out into the world all right that's pretty much the effect i was going for for this decal so i'm going to close this and i'm going to get rid of this decal here by just deleting it and go ahead and change the material in my parent unit class for the selection decal and i'll grab that selection selected decal material all right so i'll compile that and we'll take a look here and now our units have the selection decal and that's great but we don't want this to be just permanently on in fact this is for when the unit is selected so by default this should be not visible and we'll just set that here in the parent class visible uncheck it and compile okay and one more thing here as well i'm just going to plug in the animation blueprints for these i can see they're just sitting here in the a poses so i'm just going to open up the unit style 1 to start with here and i'll select the mesh and i'll go to anim class here and grab third person and mvp compile and close and then i'm going to grab unit style 2 and same thing let's go to mesh here atom class third person animvp and uh close that one okay and now they're looking normal there and uh see if we press play here okay we've got our units there and of course we've built in the selection decal but we don't have any way to select them yet and in the next video we're going to build a marquee selection so we can draw a rectangle by clicking with our mouse and select which units we want all right thanks for watching and i'll see you in the next video
Info
Channel: BuildGamesWithJon
Views: 19,853
Rating: undefined out of 5
Keywords:
Id: u0B5voGatbc
Channel Id: undefined
Length: 11min 22sec (682 seconds)
Published: Thu Mar 17 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.