Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Create a hallway between randomly generated rooms

Discussion in 'Scripting' started by wauchope, May 17, 2018.

  1. wauchope

    wauchope

    Joined:
    May 17, 2018
    Posts:
    1
    EDIT: This is probably in the wrong place. If a mod sees this would you be able to move the thread for me please or redirect me to the correct sub-forum.

    A little bit of context: I'm currently toying around with level generation for a game i want to make. I've managed to make it such that the rooms are randomly positioned and sized and none of them overlap as seen below.

    Example of a generated level

    What would be a good way of creating a path inbetween rooms. Perhaps with a variable average number of paths entering/leaving each room?

    Source Code:
    https://github.com/Wauchope/dungeon-crawler
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    2,629
    The general scripting area is fine to discuss this, but there is also a brand-new "World Building" forum right next to us in the main directory.

    The problem you are working with touches on a lot of disciplines: graph theory, game design, spatial distribution, etc. You want to make connected rooms that are believable, not in any way disconnected and unreachable, and yet with enough hallways the entire level becomes open space, and you don't want that either.

    Fortunately there are a LOT of games that do this already, and their source is freely available for you to get ideas from, or sometimes just use outright. Rogue and Angband are two of the most popular grid-based roguelikes, but there are hundreds if not thousands of others out there, all employing varying ways of creating rooms. You might want to google up sourcecode for other roguelikes to get some ideas about how you can connect your rooms in a reliably complete way.
     
  3. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    852

    Some resources I find useful for this:

    https://gamedevelopment.tutsplus.co...ngeons-with-procedural-recipes--gamedev-14360

    https://github.com/DMeville/Unity3d-Dungeon-Generator

    https://catlikecoding.com/unity/tutorials/maze/

    https://naplandgames.com/blog/2016/11/18/unity-3d-tutorial-procedural-map-generation-beginner-level/

    http://www.nathanmwilliams.com/?p=472

    https://www.alanzucconi.com/2015/02/24/to-voronoi-and-beyond/

    and the most useful resource as it has all the info you need to generate hallways etc:

    http://www.nathanmwilliams.com/files/AnInvestigationIntoDungeonGeneration.pdf

    http://www.habrador.com/tutorials/math/13-voronoi/
     
    Kurt-Dekker likes this.
  4. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    759
    GameDevCouple_I and Kurt-Dekker like this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    2,629
    GREAT list of resources there both from @Daemonhahn and @jhocking ... thanks! If either of you spontaneously posted this list over in the World Building forum, I am sure there would be a warm reception there. If you like, I can post it there too, up to you.
     
  6. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    852
    You are more than welcome to :) I am glad it helped!
     
    Kurt-Dekker likes this.
  7. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    852
    I posted in the thread that jhocking also did :)
     
    Kurt-Dekker likes this.