RANDOM DUNGEON GENERATOR - EASY UNITY TUTORIAL - #1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to Blackthorne Prague's I'm Nora now I'm sure many of you are familiar with The Binding of Isaac an action-packed adventure this sees you crying over monsters while navigating a randomly generated dungeon the randomness in the map and encounters is an aspect of the creation that makes it so popular for if all the rooms and monsters were always in the same place at the same time then once the final boss defeated many would see no real point in returning to that worlds so randomness can be key in keeping things fresh interesting and replayable and that is the topic of today's video begin creating a random dungeon generator we will take as inspiration The Binding of Isaac and try building a simple system that will get our own game rife with random dungeon mayhem now note that this is the first tutorial in what will be a mini series of three videos since there is quite a lot to cover and I don't want to weigh you down with a bulleted twenty minute video lastly I coded and put into place this system with beginners in mind in other words very basic unity and c-sharp knowledge is all you need to follow along with that said let's ponder what our dungeon mustn't and must have in order to be fun cohesive and actually playable first of all we want our dungeon to have a start and exit room this exocrine can then be home to a monstrous boss treasure or both secondly and also of utmost importance we need a clear path between the start and exits room in other words the players should be able to navigate to his destination without getting stuck and lastly our dungeon must be closed meaning there must not be any leading to nowhere with those three crucial points and minds let's jump into unity and begin creating our random dungeon generator so you'll see that I've put together a bunch of different rooms and all they're really made up of are white square sprites that act has walls to keep things simple algorithms have the same size ten times ten units white to place your walls in a clean and precise way you can head over to edits snap settings and change the X&Y move values to one now by holding down ctrl on your keyboard and moving your sprites you will see that it snaps of one in the x and y directions the room with doors in all four directions is my entry room this is where I will like my player character to start his adventure I then have rooms with a door at the bottom top left right left and right and so on I mean each room with one or two letters each letter signifying the doors position for example a room with an opening at the top and bottom will be called TB T for top and B for bottom a room with a door to the right will simply be named R R for right and yeah I think you get the picture lastly with each door comes what I call a spawn points so a room with a door to the left will have a spawn point placed ten units back in the x-direction this is where another room will be spawned obviously a room with multiple doors will have multiple spawn points for a concrete example let's take this room with a door to the top and to the right I'll create a new empty game object make sure it's parented to the actual room and call it spawn points I'll make sure it's positioned right at the center of my room we will now create a new C sharp script college room spawner and drag and drop it onto the spawn points so we won't have to do it later also create a new tank called spawn points and give this really created object that tag less than add a simple 2d bot Collider set to trigger to our spawn point and a 2d rigidbody set to kinematic lastly I also recommend that you give your spawn point a colored gizmo so you don't lose sight of it in the dark and mysterious scene view now we can grab our translate tool and since we have a top door increments the Y position of our spawn point of 10 R then duplicate our spawn points bring it back to the center of my room and this time for my door to the right increment the x position of the spawn points of 10 with all that in mind you can now pause the video create a bunch of rooms each nicely named and with their own spawn points then make a prefab out of each room so make a folder called prefabs and drag and drop each room into that folder then delete all rooms from your seam except the entry 1 we can now begin coding I'll open up my room spawner script and create a public int variable called opening direction now this is key for each and every spawn points we will have to set a value for this opening Direction variable 1 will mean that that spawn point will have to spawn a room with a bottom door to a top door 3 a left or and for a right door for example take the entry room for the top spawn point we will type 1 because we need that spawn point to spawn a room with a bottom door for the two rooms to be connected for this right spawn point we will type in 3 because we need a left opening for a connection for the bottom spawn point we'll type in 2 for a top door which will once again connect the rooms and lastly I'll type in for for the Lex Bob points because I need that spawn point to spawn a room with a right door all right back in monodevelop I'll create an if statement inside my update function and check whether opening derp is equal to one if it is we will now write a simple comment stating that this spawn points will have to spawn a room with a bottom door we will follow this with else if and check whether opening dirt is equal to two if so we will want to spawn a top door and so on with those if statements in place and some comments to give us an idea what we must mix dude I will wrap up the video episode two of the series should come out in two or three days so stay tuned until then if you enjoys the content don't forget to leave a like and subscribe to the channel also consider joining the blackthorn prod discord server and following me on Twitter alright have a great day see you very soon Cheers [Music] [Music] you
Info
Channel: Blackthornprod
Views: 250,996
Rating: undefined out of 5
Keywords: blackthornprod, noa calice, game dev, dungeon, the binding of isaac, generation, random, rooms, rogue likes, terrain, world, tutorial, beginner, how to, unity, indie game dev, RANDOM DUNGEON GENERATOR - EASY UNITY TUTORIAL - #1, blackthorn, 2D, 3D, basic, easy, episode 1, #1, nuclear thrones, spelunly, prefabs, C#, coding, programming, create, make, design, art, drawing, creation
Id: qAf9axsyijY
Channel Id: undefined
Length: 7min 47sec (467 seconds)
Published: Tue Mar 13 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.