Unity Tutorial: ROGUELIKE Room / Dungeon Generation (Like the Binding of Isaac)

Tutorial on how to make roguelike rooms and doors generation in Unity, like it's done in the binding of isaac.
Scripts coming soon.
Join the discord server: / discord
0:00 Setup Unity Scene
4:42 Coding "Room" script
6:14 Coding "RoomManager" script
20:15 Make rooms spawn randomly
21:49 Adjacent Rooms logic
25:00 Open Doors
35:06 Outro

Пікірлер: 45

  • @matthieuboissel3676
    @matthieuboissel36763 ай бұрын

    Hey! Great tutorial! Just want to post my solutions for the two problems i can see in your system. 1) The room overlapping Put this check in the TryGenerateRoomFunction : if (_roomGrid[x, y] != 0) return false; 2)The error when a room tries to be created outside of the grid Put this check also in the TryGenerateRoom function (put it before all the other checks by the way) : if (x >= gridSizeX || y >= gridSizeY || x return false; Hope this helps anyone!

  • @rootbindev

    @rootbindev

    3 ай бұрын

    Thank you

  • @ke77i

    @ke77i

    Ай бұрын

    when you fix the overlapping the first room never spawns with any doors

  • @FennrirWolf
    @FennrirWolf5 ай бұрын

    Great tutorial! One of the better, well explained ones I have seen on this topic. Would love to see more on this series for sure!

  • @rootbindev

    @rootbindev

    5 ай бұрын

    Thank you very much!

  • @PaniniDev
    @PaniniDev5 ай бұрын

    AHHH Root how did I miss this upload of yours. I have always had notifs on D: Nonetheless, very organized tutorial!!

  • @rootbindev

    @rootbindev

    5 ай бұрын

    Thank you Panini! :D

  • @MadChirpy
    @MadChirpy6 ай бұрын

    Great video, please continue! Adding a few timestamps/chapters to videos as long as this one could be nice, just a thought. But good job, mate!

  • @picatsso6721
    @picatsso67215 ай бұрын

    Everything works just fine! Great tutorial! I'd like to see you explain how to spawn a boss room, a shop, secret rooms, like in Isaac!

  • @rootbindev

    @rootbindev

    5 ай бұрын

    I'm glad you liked it! I might do that in the future!

  • @picatsso6721

    @picatsso6721

    5 ай бұрын

    Oh, by the way, I just did it myself, with help of ChatGPT, now it's perfect: Boss Room is always has a connection to only one room and is always the furthest room from the start, also Treasure room and Shop room generating with only one room adjacent to them. It is still based on your code, just saying, if you are interested to see how AI implemented this - let me know.@@rootbindev

  • @littlenugget4711
    @littlenugget47112 ай бұрын

    Hey, awesome tutorial! I'm currently making a game for my school's game jam, and this helped soooo much. Thank you!

  • @rootbindev

    @rootbindev

    2 ай бұрын

    Thank you, and Good luck with the game jam!

  • @LizzySphinx
    @LizzySphinx7 ай бұрын

    LOVE THIS tutorial! Very thorough and to-the-point!

  • @rootbindev

    @rootbindev

    7 ай бұрын

    thank you!

  • @ItsReece2
    @ItsReece26 ай бұрын

    This tutorial is great, well done and keep it up! I did notice that some of the rooms do overlap on top of each other during runtime. Do you know why?

  • @rootbindev

    @rootbindev

    6 ай бұрын

    Did you follow the tutorial 100%? In my game, using this code I get no overlaps

  • @ItsReece2

    @ItsReece2

    6 ай бұрын

    Yes, I did follow it but might be possible I missed something in the tutorial. I must say it's very uncommon it happens the overlap; normally overlaps from starting room and occasionally another room from the neighbouring nodes. @@rootbindev

  • @FennrirWolf

    @FennrirWolf

    5 ай бұрын

    I also noticed this same issue. It is pretty far and few between, and also as Reece mentioned it is usually an overlap on top of the starting room. Rarer occasions do include non-starting rooms overlapping too. I'm not sure if this is the most efficient fix, but in our Update when we call the TryGenerateRoom 4 time, I added checks for neighbors prior to actually generating in any direction. I have not seen any overlap since I added these checks. if (gridX > 0 && roomGrid[gridX - 1, gridY] == 0) { //No neighbor to the left TryGenerateRoom(new Vector2Int(gridX - 1, gridY)); } if (gridX { //No neighbor to the right TryGenerateRoom(new Vector2Int(gridX + 1, gridY)); } if (gridY > 0 && roomGrid[gridX, gridY - 1] == 0) { //No neighbor below TryGenerateRoom(new Vector2Int(gridX, gridY - 1)); } if (gridY { //No neighbor above TryGenerateRoom(new Vector2Int(gridX, gridY + 1)); } @@rootbindev

  • @bsdrago

    @bsdrago

    4 ай бұрын

    @@rootbindev I have the same problem, and you can see the problem in your video too (eg, 20:07). You can see 17 room created, but only "12" visible

  • @rootbindev

    @rootbindev

    4 ай бұрын

    Try adding the checks that @FennrirWolf posted above@@bsdrago

  • @migalesch1839
    @migalesch18393 ай бұрын

    thank you!

  • @MaximumSpice
    @MaximumSpice3 ай бұрын

    I assume you forgot or didn't want to add the scripts in the description :(

  • @RG-vv4wcRG
    @RG-vv4wcRG5 ай бұрын

    Nice

  • @migalesch1839
    @migalesch18393 ай бұрын

    Sometimes rooms are generating inside of existing rooms, any idea how to fix this?

  • @rootbindev

    @rootbindev

    3 ай бұрын

    I've noticed as some guys told me below, I'm not sure why

  • @SurvivalGamingyt
    @SurvivalGamingyt3 ай бұрын

    Would this also work with tilemap based rooms?

  • @AvoDev

    @AvoDev

    3 ай бұрын

    yeah, I was able to do it with minimal effort, just create a tilemap grid on the room object, and give it some colliders.

  • @codered_dev
    @codered_dev2 ай бұрын

    ummm some dungeon patterns are repeating like

  • @LogicStudios_1
    @LogicStudios_12 ай бұрын

    Great tutorial, how would I go about instantiating something at the last room generated... Edit: Figured it out. Add this code where you set generationComplete = true. GameObject lastRoom = roomObjects.Last(); Instantiate(boss, lastRoom.transform.position, Quaternion.identity); Make sure your script is using System.Linq;

  • @rootbindev

    @rootbindev

    2 ай бұрын

    Thank you for sharing!

  • @Arcann_bhp
    @Arcann_bhp4 ай бұрын

    Does this work with tiles?

  • @rootbindev

    @rootbindev

    4 ай бұрын

    I haven't tried it but it should work

  • @Arcann_bhp

    @Arcann_bhp

    4 ай бұрын

    @@rootbindevalso how can you edit the room like as content, if there’s only one prefab how can you make different type of rooms

  • @rootbindev

    @rootbindev

    4 ай бұрын

    Make another room prefab that suits your needs, and before instantiating the room you decide which prefab to Instantiate :) @@Arcann_bhp

  • @Arcann_bhp

    @Arcann_bhp

    4 ай бұрын

    @@rootbindev so I can just make a list of room and then randomize with the length of the rooms?

  • @rootbindev

    @rootbindev

    4 ай бұрын

    Exactly! Atleast that's how I would do @@Arcann_bhp

  • @MrBerfayHunalp
    @MrBerfayHunalp5 ай бұрын

    where are the scripts

  • @rootbindev

    @rootbindev

    5 ай бұрын

    I can send them at discord