How to make a Tower Defense Game (E01) - Unity Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
thanks for tuning in at brakus hello everyone and welcome to the first video on creating a tower defense game in unity I'm really really excited about this video both because tower defense games are awesome to make it's really fun and I have a lot of stuff that I want to show you but also because this is the very first video I'm doing since going full time with break YZ I'm taking my chances and investing all of my time into the channel that means that you will see more new content such as this and more content on this series we already have growing such as the multiplayer FPS and the 2d platformer course so that's really really exciting and to make all of this possible I've started a patreon page because let's face it I do have to pay rent where you can donate monthly ah to support me on my mission and that's really exciting the page itself looks like this you can click the screen now to be taking over here I offer some humble rewards in return and the first 25 or the first 5 people to donate $25 or more will get whatever project they're working on featured on Twitter Facebook and on the forum so if you're excited about this just as I am you should go here and at least check it out if it's something for you I I really appreciate it you are no way forced to do this but it's awesome and thanks to the people who have already donated so without further ado let's get right into today's video so I've opened up unity and I'm using version 5.3 point 5 but you can pretty much use any version that you want to it's not going to matter too much for what we are going to be doing so to create a new project we are going to hit new then we are going to type in the name of our project that's in my case going to be tower defense tutorial you can select the location and choose 3d and the reason why is I recently sent out a poll on Facebook and Twitter asking whether or not the search should be in 3d or 2d along with the question of what programming language we should be using and the result of the poll is on the screen now and that was of course 3d and c-sharp so that's what we're going to be doing and then hit create project which I've already done and opened it up in unity and then it should look like this so the first thing that I want to do here is populate our scene with some of the stuff that we are going to need in there and these some of these graphics might be temporary but it's great to get something in there that we can use and the basics of any tower defense game is some kind of start and end point for your enemies to walk from one to another and then a path that they take in getting there and also we need some place where we can place turrets in our case any turret is going to be placed on a platform that we call a node so let's go ahead and make a node right now so right-click in the hierarchy go to 3d object select cube then we're going to reset the transform do a scale of 4 by 1 5 4 and then hit F to assume a nod so you can see here that we are going to keep the box Collider and the mesh renderer that's all very fine and what we can then do is rename this one to node and drag it down to in the to the project to make it into a prefab then we can create an empty game object which we will also reach set the transform on and rename to notes and this is simply going to store all of our node and all of our node objects as children so that's perfect what we can do now is we can simply duplicate this node then we can move it over using ctrl and I'm going to leave a small space here and I just want a bunch of nodes here that will be a bunch of places that we can place turrets and also show the confines of our map so let's go ahead and make a grid of some of these nodes and of course if you make your map too big it's going to be very slow this method of doing it that optimizations that you can make but as long as you give your map a reasonable size it's really not going to be an issue especially because unity has gotten so good at handling a lot of objects of the same type so let's select these two by holding down shift hit control D to duplicate and holding down control again to move them over and keep doing this in shifting direction so that we end up with a complete square and we I will just keep doing this just a few more times to get a map of a reasonable size and we can do this just once more here in this direction and one time in the other direction of course this if this is going to be a mobile game you'll have to think more about performance but this here is going to be fine for any reasonable desktop it's going to be just fine so all of our notes are now in here and the good thing is that we made it into a prefab so if we change one all of them will change so what we can do now is simply collapse this nodes here and then we will save our scene just to be on the safe side and I'm going to call this the main scene and what we can do is now specify a path for enemies to walk along so I want our enemies to start up here so I'm going to select this node and delete it and end down here select that node and delete it and we will not do the same with any notes that these enemies should walk over and then delete them and then instead create some kind of ground object that they will move along so let's go ahead and make a path by simply selecting objects here I want them to and again I'm holding down shift to do this I warn them - oops that was a wrong one are the transform is getting in the way there so I want them to walk down there then over here and then up a bit then I want them to walk over and then take a path down again and this time I want them to go way down here over here and then around and we can make them go up a bit and over and I and over and then I want them to take the straight path down here to their final destination point so this is what my path is going to look like you can of course change yours to whatever you want and make different levels in this way so this is going to be the first level and what I'm going to do now is create some ground objects to fill out these empty spaces so let's right-click go to 3d objects select cube again reset the transform on this and name this a ground object then we can go ahead and maybe move this over again holding down ctrl make this a 4x4 by default you can watch it here zoom in on it by hitting F let's then create a new material for this so create material and call this one ground and we are going to drag it on there and then let's change the albedo to something a bit more dark grayish that we can bump up the metallic Ness just a bit and turn the smoothness all the way down to make it a very matte material so that looks kind of great and it's very clear that this node is different from the others so that's perfect and what we can then do is you can of course go with the same node design here but instead I simply want to scale up this node to fill out the entire path so in order to do this that's maybe move it over towards the center here of this small area of the path then we can instead of just scaling like this we can go in and choose edit snap settings and here we can adjust how our objects snap to the grid and in this case we want the scale to snap every one units so I'm going to scale it up here and it looks like everyone units actually wasn't perfect because now we're getting this offset which we don't want so let's choose 0.1 again here and then we can find adjust this so let's do that's actually too much so we can do point zero one or you can simply type in the correct and upload up here which I'm going to do so let's try twenty-nine here oops 29 and then move this over with a tool and it's still offset because our movement is now offset so what we can simply do is set the position here and you can see this right here is the exposition to seventeen point five and that's perfect so now it's snapped correctly and that looks fine then we can go ahead and duplicate this object rotate it by 90 degrees move it down here again by holding down control and you can see again that this is snapped incorrectly so maybe we should set these to 0.5 on the X and Z so we can move it down there and then we can scale it in and I want to do this every 0.1 units and move it over and you can just keep doing this to fill out the entire level something like that and then we can again duplicate this and rotate it back and I'm just going to do this to fill out the entire path and when I'm done I'm going to be back okay so I'm done creating our map and this looks just fine you could of course spend more time on this than I do but for the sake of the tutorial let's continue and let's right-click in the hierarchy to create another empty object and I'm just going to reset this and call this one environment and then we can take all of our ground objects and drag them into the environment and close that off just like that then let's create a object that will act as our starting point and one that will act as our ending point and again you know the procedure 3d object cube reset it call this one start and I'm going to do capital letters on this one and yeah so that's fine and let's go ahead and add a material for this so actually this start node here needs to be four by four on the X and Z as well and then I'm thinking four on the Y so what we can do with this is that we can actually move it up by two point five and then we can drag it over to stand on our ground here and I'm just going to drag it over so it's x correctly something like that and this is going to be the starting point so I think this looks just fine and what we can do with this is that we can then change the material so let's create a new material and this is going to be this start and I'm just going to drag that on there and then change the albedo to something um let's see let's change this to something green so some kind of matte green I think that color there looks just fine let's again bump down the smoothness quite a bit and maybe just a bit of metallic no no metal Ignace on this one and I don't want this to be on too saturated so something like that looks pretty nice I think and then we can simply duplicate this node and then drag it over here and make this one our end node so there we go and this is going to be our end and we are going to create a material for this I'm just going to duplicate this start material and call this one end let's drag it on there as well and change the albedo to something more red and we want this to be a bit more saturated so it's very clear that this is a red color great so it's going to walk from this star that's maybe just a bit too much something like that looks nice on my screen at least so it's going to walk from start and all the way along this path over to our end node and we should be able to remove the box colliders on the start and end node along with the colliders on all of our ground objects so let's just remove the box Collider on those and if you are very smart you had made the ground object into a prefab I did not think about this you might as well do it if you haven't created them yet but for now unities multiple object selection works just fine so let's save this scene and this is pretty much going to include the very first video on this in the next one we are going to make this scene come to life a bit more so I hope you enjoyed this video I hope that you're looking as much forward to future videos in this series as I am and again thanks to all of the amazing patreon supporters so thanks for watching the video and I'll see you in the next one thanks to all of the awesome patreon supporters who have donated so far and a special thanks to Lux game TV with the real name Jeff sacred
Info
Channel: Brackeys
Views: 800,289
Rating: undefined out of 5
Keywords: unity, unity3d, tutorial, asset, assets, material, materials, beginner, easy, how, to, howto, learn, course, series, tutorials, fix, tip, game, development, develop, programming, coding, basic, basics, C#, create, first, map, shoot, turret, platform, unity 5, beginning, tower defence, tower, defence, defense, tower defense
Id: beuoNuK2tbk
Channel Id: undefined
Length: 13min 56sec (836 seconds)
Published: Wed Jul 06 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.