ROGUE LIKE RANDOM LEVEL GENERATION - INTERMEDIATE C#/UNITY TUTORIAL - #3 [END]

Поділитися
Вставка
  • Опубліковано 29 вер 2024

КОМЕНТАРІ • 115

  • @waterfallbw
    @waterfallbw 6 років тому +54

    2:23 THE LEVEL GENERATION AND MUSIC AR SYNCED!!!!!

  • @Alex-mq7kt
    @Alex-mq7kt 6 років тому

    Very good! Thanks! *Clapping*

  • @Fbiman93
    @Fbiman93 2 роки тому

    Great videos!! Do you know if this would be possible to do with love2d?

  • @peschken23
    @peschken23 6 років тому +44

    I cannot stress enough how amazing your content is. Not only are you incredibly talented in the many aspects of gamedesign including programming and art, you also explain concepts so well, it's almost harder to not understand something than it is to understand it. I love random generation, and these videos were amazingly well timed for me in particular, since I am planning on making a small halloween themed platformer in the coming weeks. Thank you so much, and keep up the amazing work!

    • @Blackthornprod
      @Blackthornprod  6 років тому +2

      Thanks so much mate for the support :) ! I'm really glad these video helped you out :) ! I would love to play your halloween game when you complete it ! Make sure to join the Discord server : discord.gg/UwqG75R and send me a link to it when you're done :) ! Anyway best of luck on your game creation journey :) !

    • @peschken23
      @peschken23 6 років тому +1

      @@Blackthornprod I'll be sure to do that! :) Much love!

  • @OmniCroissant
    @OmniCroissant 2 роки тому +3

    Awesome tutorial !
    Here is the solution I came up with to fill up the empty rooms :
    in the levelGeneration update function :
    if (stopGen == true)
    {
    foreach (Transform checkroom in roomPositions)
    {
    bool roomDetection = Physics2D.OverlapCircle(checkroom.position, 1, roomLayer);
    if (roomDetection == false)
    {
    int rand = Random.Range(0, rooms.Length);
    Instantiate(rooms[rand], checkroom.transform.position, Quaternion.identity);
    }
    }
    }
    it took me some time to figure it out, but i'm proud that I came up with it myself !

  • @hamzahgamedev
    @hamzahgamedev 6 років тому +16

    Here before 1Million subs ! :)
    Thanks for this amazing quality content!

    • @Blackthornprod
      @Blackthornprod  6 років тому +2

      HAHA Thanks man for your continuous support :) ! Reading your comments is always awesome and very encouraging !

  • @timotheefermeaux9183
    @timotheefermeaux9183 6 років тому +15

    Hi man I really enjoy your videos ! :D
    However you should use less methods as OverlapCircle, Raycast, Destroy, Instantiate, etc... Because it takes a lot of memory and times for things you could avoid. You could create all the maze without OverlapCircle and Destroy.
    Think about creating more class like Room (derive from nothing) which contains directions, the corresponding Prefab, the type and if its visited or not. Then you could have done all the generation before instantiating anything.
    But I think your videos is really great and helpful for beginners. I learned a lot about your way to create sprites and some juicy tricks. Keep doing your videos bro, it's so good !

    • @Blackthornprod
      @Blackthornprod  6 років тому +12

      Thanks a lot mate for the great feedback :) !
      I completely agree that using Overlap circle wasn't one my best ideas :/ ! There were definitely better ways of generating the main path as you pointed out ! I need to refine some of my programming skills before jumping into another series like this ! Anyway I learnt a lot making these videos and by reading comments like yours, it's been a great adventure :) !

    • @CouchFerretmakesGames
      @CouchFerretmakesGames 6 років тому +12

      It's true that he is using a lot of resource demanding operations, but I don't think it's a problem. He probably didn't come from a software engineer background, and he came up with these solutions on his own. In fact, I think his solutions are better for beginners or people who aren't engineers (probably the majority of viewers) by using powerful and handy functions like Raycast. It's easier to visualize the algorithm this way and can teach you to use it to solve your own problems. I understand your point, but I think in the end it's more important to lower the bar for people to learn and comprehend these topics than teaching better but more complex solutions.
      Keep up the good work Blackthornprod, you change a lot of people's life!

    • @timotheefermeaux9183
      @timotheefermeaux9183 6 років тому +1

      Completly agree with you. :)

    • @alexv9607
      @alexv9607 4 роки тому

      @@Blackthornprod hope you will read this. Can you do an updated video then on how to reduce the memory? but great videos i learn a lot about these videos.

  • @boltstrikes429
    @boltstrikes429 5 років тому +10

    Very interesting system. It's not exactly efficient, seen as it takes both time and resources to generate (you use a lot of colliders to simply detect room presence, and spend a lot of time instantiating rooms that you end up deleting later)
    I would suggest figuring out an algorythm that only considers each position once, and have it read/write to a 2D Array. This will not only speed up the generation by a lot, it will also mean you can feel free to recalculate certain things, check for rooms and replace rooms (like you do in this tutorial) with a much, much smaller time/resource penalty.
    When it's done, simply go through the entire array using a nested for loop, and place in all the rooms.

  • @CouchFerretmakesGames
    @CouchFerretmakesGames 6 років тому +7

    This was a very good series on such a unique topic. Thanks man, you are a star!

    • @Blackthornprod
      @Blackthornprod  6 років тому +2

      Thanks a lot for the support and kind feedack :) !! It's been a joy making this small series ! Stay tuned :) !

  • @RealAccidia
    @RealAccidia 5 років тому +4

    Wow a complete trilogy!
    (Better than valve has ever done)

  • @Skizmo
    @Skizmo 3 роки тому +4

    Does anyone know how you could incorporate tilemaps into this?

  • @rattttooooo
    @rattttooooo 5 років тому +4

    exactly what i need. Now i might actually make the game i wanted. Thank you.

  • @crashannburnFPV
    @crashannburnFPV 3 роки тому +2

    Thanks a lot for this informative tutorial.
    Confirmed working in 2021 using 2019.4.20f1 LTS
    I tweaked it a bit in order to make the level in 3D instead as a small personal challenge as I've just started learning Unity.

    • @1JMGames
      @1JMGames 2 роки тому

      did it work? if so can you help me

  • @Kora-h9q
    @Kora-h9q 3 роки тому +1

    Well... I just realize, that I didn't used the right tutorial series XD It wouldn't be so bad actualy, if not the fact, that I'm doing my game for GameJam...

  • @emirhurturk306
    @emirhurturk306 4 роки тому +1

    Hi, I did everything you said until 5:59. Filling up spaces works indeed but they are invisible on the game screen. However, they are visible ın the scene screen. How can I solve?

    • @thedogjuicettv
      @thedogjuicettv 4 роки тому +1

      I am having a similar issue, my first room gets destroyed and not replaced, but it shows up on the scene screen. I have not finished part 3 so I am not sure if I will have a similar issue filling in the other areas.

  • @littlenarwhal3914
    @littlenarwhal3914 5 років тому +1

    This whole physics system to detect rooms is very inefficient. I suggest instead storing your whole level in a 2d array, so as to have a grid and find the room your looking for in it, or simply store the last generated room in a variable. 2d array offers more options for later things though

  • @the_original_jake
    @the_original_jake 4 роки тому +1

    follow up question, just found out the design has box colliders in the very centre, where the gameobject is, any ideas on how to remove this without turning box colliders off in general?

  • @mrphantistic8390
    @mrphantistic8390 3 роки тому +1

    Black, these tutorials are amazing! But I have just ran into a problem where if you reload the scene the dungeon keeps randomly generating as fast as possible to almost the point of crashing. Is there any suggestion thx!

  • @gabinchollet8153
    @gabinchollet8153 2 місяці тому

    It's just incredible ! Thanks to you, you'r awesome !

  • @avanalos
    @avanalos 6 років тому +1

    Thanks for this amazing tutorial :)
    But once a time I have a NullReferenceException, do you have any idea why ? And also, sometimes, my level generator just stop spawning new rooms, I can't figure out why...
    Keep going with the incredible stuff

  • @the_original_jake
    @the_original_jake 4 роки тому +1

    this was exactly what i was looking for, amazing job, thoroughly explained and well presented, thanks for this tutorial!

  • @capnnemo5330
    @capnnemo5330 Рік тому

    @Blackthronprod bro do u have any advices for optimization? Because im kinda struggling with fps issues right now :D
    I'm making new level prefabs out from the output of room generation and i disable object spawner if there is no roomgenerator script in hyearchy anymore but it is sufficient.
    It's checking every single spawnpoint on awake if it has roomgenerator.

  • @ruizpereira8792
    @ruizpereira8792 Рік тому

    Hello! I'm currently working on my undergraduate thesis in the field of procedural generation in games. I would like to know if I can use this implementation as one of the essential components of my work. If so, could you please inform me about the distribution license for the source code, such as the MIT license or another open-source license, and also how to properly attribute credit to your work?

  • @plogo3597
    @plogo3597 Рік тому

    I tried to create the project in 3d and it worked for the most part apart from not being able to fill the remaining empty spaces with rooms. Anyone have any idea how I can fix that?

  • @1JMGames
    @1JMGames 2 роки тому

    Is there a way of implementing this into 3D

  • @kristinewestman5502
    @kristinewestman5502 5 місяців тому

    I just want to thank you for this series. I've watched it several times the last month or so as I built my own generator. This was the closest series I found that does what I wanted to do - a splunky like generator. I did change how I went about things. I used a grid and array system and added a script to create a border, and so now I can make my generator as small or large as I want. I also figured out a way to use tilemaps with this. But the basics of how-to in this guide is the most beneficial in learning this technique. I'm so glad I didn't give up, because now I have something amazing, and it's all because of this series. So, thank you.

  • @SharathThe1
    @SharathThe1 3 роки тому

    Great tutorial! I downloaded the project and would get an error whenever my "Direction" int started off with 5. changing it from direction = Random.Range(1, 6); to direction = Random.Range(1, 5); fixed the error. I think I have an idea of what was causing this error but would really appreciate it if you or anyone could explain it to me. TIA!

  • @forild
    @forild 6 років тому +1

    I will be definitely doing something with this! Thinking to mix this level generation with 3d FPP should be fun. Thanks for the top content, Noa)

    • @Blackthornprod
      @Blackthornprod  6 років тому

      Thanks mate :) ! I'm really glad you liked this series ! Mixing this up with 3D could be fascinating ! Hope you make something great, and definitely post me a link to it when you do :) !

  • @matthewking2158
    @matthewking2158 6 років тому

    I have replaced all the music files in Spelunky with new, high quality game sound tracks. You can find the file here if interested. Just replace the music folder and enjoy! www.filehosting.org/file/details/760396/Matthew%20King

  • @Emilis2023
    @Emilis2023 Рік тому

    I just finished practicing with your more basic level generator series from the the year before this one which was pretty good, but as I was playing around with it in unity, I was thinking about features I'd like it to have, and this series looks like it addresses just about every one of them! Random chunks within the room types, different probability weights, limiting overall map generation size. This looks like just the thing I was hoping to create! It's late now, but I can't wait to try it out myself tomorrow. Thanks!

  • @Berndr
    @Berndr 5 років тому

    I am just curious ,,I am not a programmer but from the logic point of view … why bother moving left and right? you already have 4 perfect positioned spawn points, that represent 4 possible room locations... so why not just use this?rather then Introducing boundaries and working out how much to move... when you could just say something like if moving right spawn point is +1 , and if moving left -1 … instead of working out boundaries you could simply check if spawn point is less then zero and more then 4 ... Logically if you were moving from left to right and ended up on spawn point 4 , only way is down right? also you count down movement , you could use that as well to stop room generation … I think it would have been more accurate I sometimes end up with 5 rooms in a raw ….

  • @3scubestudiosllp
    @3scubestudiosllp 4 роки тому

    One of the best tutorials I have ever watched bro.. hats off to you. You really deserve a thumbs up. My suggestion is that you could make use of events more. It could make the program more efficient in many ways. Good work bro

  • @martintsolov4855
    @martintsolov4855 6 років тому +1

    This has been so helpful. I've been trying to make a roguelike Top down shooter and you've uploaded just as soon as I thought of something.

    • @Blackthornprod
      @Blackthornprod  6 років тому +1

      Hey Martin and thanks for your support :) ! I'm so glad this tutorial series helped you out ! Best of luck making your game !

  • @fmousa77
    @fmousa77 6 років тому +1

    Hi,
    really nice tutorial, although I have a question, in the tutorials you show us how to do rooms, however inside Spulinky game there is a very wide open areas, how can this be generated using this method?

    • @CouchFerretmakesGames
      @CouchFerretmakesGames 6 років тому

      Hey! I think you can achieve that by having empty rooms in the algorithm.

    • @fmousa77
      @fmousa77 6 років тому +1

      Also what about decoration of the levels?
      are you planning to have a video on that?
      Also any idea how can we achieve this?

    • @atkn007
      @atkn007 6 років тому

      @firas mousa Hey! I achieve that by making rooms premade. I made a 10x10 layout and puted random spawners in those layouts. So kinda half random half premade

  • @zipzorp8858
    @zipzorp8858 4 роки тому

    How did you get your arrays to randomly spawn the additional empty game objects, tiles and chunks. When I do this, it spawns each object in the list, at each location.

  • @lukevanlukevan
    @lukevanlukevan 5 років тому

    I know I am really late to the party, and I'm not great at any sort of code, but wouldnt it be a fair idea to have an array of rooms in the level, storing their position in the grid and their openings, then you could have the path finder check that grid slot and its openings, as well as see if there is a block in the way to aim in another direction?

  • @adamring5325
    @adamring5325 4 роки тому

    hi like ur videos. just wondering im making a zelda 1 type of game but instead of a fixed map i like a rouge grid system. do i then make all the rooms and then save them as prefabs and thennuse the things i learned from u. will it not be a great preformence dropp in the game with so many prefabs?

  • @philiplarsen8020
    @philiplarsen8020 2 роки тому

    hey, i know i am a bit late but i get this error code: IndexOutOfRangeException: Index was outside the bounds of the array.
    can someone help me with this

  • @ir3dy656
    @ir3dy656 4 роки тому

    Figured out my question... had to make a new void method for some reason for going down
    for some reason my level generator wont finish the path so stop generation will not enable rooms stop spawning why is this?

  • @vierkilau
    @vierkilau 3 роки тому

    I have followed this great tutorial, I was wondering if anyone could describe a method of spawning an exit in the final room on the main path

  • @aureliencalixte1645
    @aureliencalixte1645 5 років тому

    Hi, Very good video.
    I'd like to know if it is possible to have a generation with the probability that a kind of square appears less than an other, like for exemple a very hard case that would be rare.
    Also, do you think there is a way to implement this procedural generation or a close one but with squares of different size, to have rooms that can be bigger than other ?
    Thanks a lot !

  • @diliupg
    @diliupg 5 років тому

    BTP Yo da man! Yo da new man on da blok! There was Brackey, then there was Sykoo and now there is BTP! Da man!

  • @simoncodrington
    @simoncodrington 6 років тому +1

    Cheers man, thanks again for the mini series :) Can't wait to see what you come up with next

    • @Blackthornprod
      @Blackthornprod  6 років тому +1

      Thanks a lot mate :) ! Loads of cool stuff is coming up ! Stay tuned :) !

  • @atkn007
    @atkn007 6 років тому

    Hey! I have a question. İf there is 4 room types and every room prefab has left-right enterrance, there cant be any dead ends. What is best way to do it? Like adding more room types?

  • @danraskin9200
    @danraskin9200 Рік тому

    Anyone else run into this issue?
    if (roomDetection.GetComponent().type != 1 && roomDetection.GetComponent().type != 3)
    and at Move();
    "NullReferenceException: Object reference not set to an instance of an object"
    ???

  • @midnightchannelers
    @midnightchannelers 2 роки тому

    How do you add the player?

  • @giantsmoy
    @giantsmoy 6 років тому +3

    Don't get me wrong, your system works fine, but having all those child gameobjects receiving Monobehaviour calls from Unity is far from being efficient. But for prototyping, I guess it's cool to be dirty when coding :D

  • @孫イハン
    @孫イハン 5 років тому

    Thank you a lot for you amazing video!! I am a newee game developer from China, and i really learned a lot from your video, meanwhile, I'm also developing one scroll roguelike game with your script logic while I met some problems here, if I attach a box collider to my prefab rooms, when I run the game, my character will be blocked by the invisible wall that the core red ball gave, I'd really apprecaiate it if you could suggest me a good way to fix it, thank you again!

  • @qShaun
    @qShaun 4 роки тому

    Is there a way to repeat this whole process when entering exit/escaping?

  • @nandanvinjamury
    @nandanvinjamury 6 років тому

    You make so many amazing tutorials! Do you know if we will ever be able to have a rope swinging tutorial (like Indiana jones using his whip in the lego games)? That would be a fun mechanic, especially for a randomly generated platformer such as this.

  • @Ghin_Antonic
    @Ghin_Antonic 5 років тому

    I really like this idea of nested objects like this because it allows you to take it a step further and nest different objects inside the room. For example you could have 3 or more different platforms that could spawn inside that same room, so while its shape is the same the visuals are different.

  • @dansplace8161
    @dansplace8161 3 роки тому

    awesome guide, followed and done all perfectly. Just a question: once done...how do i spawn enemies and obstacles etc? could you suggest me a guide or similar? thanks for your amazing work btw.

    • @luck8762
      @luck8762 2 роки тому +1

      if you go to 7:17 he splain how to randomize the spawn object. you could use an enemy prefab or an obstacle in here, just have to got a prefab and this will make the magic.

  • @luciacover9909
    @luciacover9909 6 років тому

    Amazing video! I hope you keep up the good work! I’m wondering though, would this work for an RPG game? I’d like to support your channel via patreon but sadly I don’t have any money :(

  • @chrislupton7521
    @chrislupton7521 5 років тому

    Can I just drop you a belated thanks? I've been overcomplicating this process in my head using 2D arrays, when it really doesn't need to be that intense.

  • @totemofmelon6470
    @totemofmelon6470 3 роки тому

    It doesn't work to fill in the rest of the rooms

  • @rolf1892
    @rolf1892 5 років тому

    Hey man just wanted to say your videos are amazing. Been watching them all day learning more about unity. I've been programming for many years with other softwares and languages and gone through numerous youtube channels for help throughout my time programming and you just kill it with explaining everything clearly. Keep up the great work man.

  • @thedjlj
    @thedjlj 4 роки тому

    Is there a way to pinpoint the ending position?

  • @MILLWALLD
    @MILLWALLD 4 роки тому

    Can this be used for 3D dungeons?

  • @rodnim161
    @rodnim161 3 роки тому

    Thanks for this. Needed it. Having some trouble with the middle box closer though. When my player jumps into it all the time no clue how to prevent this

    • @MyNameisMyka
      @MyNameisMyka 3 роки тому

      ur rooms have a box collider in the center, turn that box collider to a trigger to all rooms and it will be working fine!~

  • @Xmanu_RR
    @Xmanu_RR 6 років тому

    tu realmente fazes uns conteudos muito bons!! mas nao tem uma forma de simplificar esse projecto...

  • @diliupg
    @diliupg 5 років тому

    There is a code error on line 106 in the generation .cs

  • @jordancrepin648
    @jordancrepin648 5 років тому

    Hi, i've got a problem. I would like to delete the "Collider2D" of the center of each Room. Indeed, It block my character. If someone could help, it block my character.
    Ps : Maybe I've missed a part but I don't think.

  • @wandil9758
    @wandil9758 4 роки тому

    My rooms collide with each other, so they move out of position
    How can I solve that?

    • @rulyhyperion8277
      @rulyhyperion8277 3 роки тому +1

      Make the rigidbody static instead of dynamic, also click freeze position and rotation

  • @chrischains9947
    @chrischains9947 3 роки тому

    this is fantastic stuff sir. many thanks :D

  • @arizlunastroir96
    @arizlunastroir96 6 років тому

    Thank you! I've been waiting for this

  • @fozzgeorge8015
    @fozzgeorge8015 4 роки тому

    Thanks for this tutorial series, it's been so helpful! The only problem I'm encountering is that when I press play, the first room spawns fine in the editor, as do the following rooms..but in the game view, the first room doesn't show. Any ideas as to what I've missed? Many thanks!

    • @fozzgeorge8015
      @fozzgeorge8015 4 роки тому +1

      Ok seriously ignore me, literally the camera was just behind the spawn points. FFS lol. great tutorials, great channel!

    • @thedogjuicettv
      @thedogjuicettv 4 роки тому

      @@fozzgeorge8015 Sir I have been stressing about this for days, my first room and fill rooms at the end would not show up. Not sure why everything in the middle shows up fine... You saved my life haha

  • @devmehta6490
    @devmehta6490 3 роки тому

    Thanks alot for this👍

  • @alexv9607
    @alexv9607 4 роки тому

    hope someone will read this. how do i make it so it spawns 1 player in an random room and not more then 1 player can spawn? so you can play in your level.

    • @Mossarell
      @Mossarell 4 роки тому

      instantiate player? as random middle pf the room

    • @alexv9607
      @alexv9607 4 роки тому

      @@Mossarell Yes so if the player is spawned in 1 room you can walk and jump with player but it can't spawn more then 1 player in the level.

  • @bunggo9914
    @bunggo9914 6 років тому

    the blackthornprod game jam will starts in 2 days!

    • @Blackthornprod
      @Blackthornprod  6 років тому +1

      Yep :) ! I'm really looking forward to it ! Hope you'll be taking part :) !

  • @emilhadzimahovic7680
    @emilhadzimahovic7680 3 роки тому

    But how do i make random enemy and item spawns?

    • @luck8762
      @luck8762 2 роки тому

      if you go to 7:17 he splain how to randomize the spawn object. you could use an enemy prefab or an obstacle in here, just have to got a prefab and this will make the magic.

  • @ir3dygames968
    @ir3dygames968 5 років тому

    So how do I go about having only one room spawn ( boss room or even a shop?) So adding only one type of room per level. Please reply, 100% noob here.

    • @NosAltarion
      @NosAltarion 5 років тому +1

      From here, you could just use a bool to check whether or not that specific room was spawn already.
      If not, then it lets it spawn. If yes, then you either spawn something else by default or get another rand.
      When generating the room, turn the bool value to true.
      Be sure to check if the room you destroy is a shop or not when destroying the top room. If so, turn the bool to false again.
      You'd had to add something more or less like this :
      bool shopIsGenerated = false;
      //Code code code
      if ( !shopIsGenerated && /**/)
      {shopIsGenerated = true;
      /*Spawning the shop*/
      }
      And if you want to easily add a boss room to the end of each level, add an else statement to the if checking if the maze is completed.
      bool bossRoomIsSpawned = false;
      //code
      if (timeBtwRoom

    • @ir3dygames968
      @ir3dygames968 5 років тому

      @@NosAltarion thank you I will try this out! I didn't think about that!
      Have you tried to put a chunk together? My chunks keep spawning to far down from it's original location.

    • @NosAltarion
      @NosAltarion 5 років тому +1

      @@ir3dygames968 Nope, didn't try. Tbf, I'm even more a noob than you. Never did any C# and still trying to sort out how to get user's inputs. That's how I found that channel 3 days ago ^^"

  • @HoodStrats
    @HoodStrats 6 років тому

    I'm loving these harder tutorials!

    • @Blackthornprod
      @Blackthornprod  6 років тому +1

      Thanks :) ! I'm glad you like them ! Making this series was loads of fun for me too :) !

  • @MrT0R0NAGA
    @MrT0R0NAGA 6 років тому

    Thank you so much for your videos.

  • @GamePuppetsStudio
    @GamePuppetsStudio 5 років тому

    Great work!

  • @ashwinwalke3981
    @ashwinwalke3981 6 років тому

    thank you so much

    • @Blackthornprod
      @Blackthornprod  6 років тому

      No problem mate :) ! Thank you for your support :) !

  • @owenmp4
    @owenmp4 5 років тому

    This was my first unity tutorial, and although I do have programming experience, I probably should've done some easier ones! Nonetheless, great tutorial series, I learned a lot!

  • @dogukansoysal2390
    @dogukansoysal2390 5 років тому

    why are you pressing your last words so hard like "-mm -tionnn -endds"

  • @jannikbock6756
    @jannikbock6756 6 років тому

    Great Job! I especially like the technique you use to spawn chunks and items.
    However the mazegeneration itself is quite a mess :'D
    The technique where you instantiate and then change rooms with a circle does not seem loadable once you want a bigger maze. The path of your maze will never move up again and will rarely split up in a deadend and a correct path. It Doesnt get apparant in a 4 by 4 but this will create rather boring maps and i doubt spelunky used a similar method. Also your programing style will confuse yourself very soon once you expand on this game. But i guess from a gamedev point of view everything that does the job is fine. Keep it up!

  • @Geri805
    @Geri805 6 років тому

    First