Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

DunGen - Procedural Dungeon Generation

Discussion in 'Assets and Asset Store' started by Aegon-Games, Mar 7, 2014.

  1. wwm0nkey

    wwm0nkey

    Joined:
    Jul 7, 2015
    Posts:
    39
    I am having an issue that's preventing me from continuing with a small project, I am generating a state tile with 4 rooms at the bottom and 3 ontop, however only 1 room will get a branch spawning from it rather than all of them. Can't seem to find a fix for this?
     
  2. tonywalsh

    tonywalsh

    Joined:
    Jun 4, 2014
    Posts:
    15
    Thanks for the tips, will try this out!
     
  3. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    It doesn't support cyclic paths yet. I think I have a solution to that problem now, but it's one of those features that needs a complete rewrite of the code base and I just don't have the time to do that right now.


    Sorry, I'm not sure I understand the question. Was 'state' meant to be 'start'?

    Any tiles that are nodes on the graph (including the start and goal tiles) don't have branches and instead just lie on the main path. Only line segments on the graph (archetypes) have branch paths coming from them.
     
  4. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    78
    Anyone had success with a "Fixed Camera" kind of game with this? Like Binding of Isaac or the old Zelda games?

    The camera is fixed over each room and only shows that room, when going through a doorway, then the camera pans into the other, connected room.

    Can you please share some tips?
     
  5. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    77
    Just wanted to throw in my +1 for this if you ever do find the time, it would be greatly appreciated =)
     
  6. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,392
    I would assume that you'd assign an empty "camera snapto" prefab to each room when you create the room. That way you know you've got the camera centered and capturing everything in the room.

    Then when the player moves through a doorway to a new room, you'd need to find out what room you're in and move the camera to the position for that room. You can make a trigger volume game object part of each room that you enter, and upon entering the trigger volume a script grabs the camera and makes it a child of the camera snapto object, so it automatically sees the world from that position and rotation. You can have the camera either immediately snap into the new position, or use a tween component to control the camera movement.

    I haven't done anything like that before, but it seems logical. You may have some additional details to fiddle with, but we'd be getting into things probably specific to your game. Like ... maybe you want lighting turned on for just the room in view and you don't want the light shining into other rooms ... things like that.
     
    Creiz likes this.
  7. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    78
    Thanks, @hopeful. I got more or less an idea how to start, now. Volume Triggers are a good idea.

    Another quick question for @Aegon-Games: is it possible to add a specific type of tile after each room?

    For example, I want to add a corridor on all exits Dungen chooses. I have rooms that have 3 exits, for example and sometimes Dungen chooses to allow 1 or 2 exits. Which is fine, that's actually wanted.

    Now, I can't add my corridors straight on the room tile because it's going to overlap with another room if this specific exit isn't chosen.

    So what I want is simple: Room -> Corridor -> Room -> Corridor, etc.
     
  8. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    If you added corridors straight into the room tile, it shouldn't overlap other rooms since the corridor would be factored into the room's bounding box. You would however be left with a lot of empty space around rooms if you hid any unused corridors.


    While DunGen doesn't technically have a concept of rooms vs corridors, it's possible to hack something together by using custom logic for how doorways are allowed to be connected.

    Here's how it would work:

    1. Create two doorway socket types ('Create > DunGen > Doorway Socket'). Call one "Room" and the other "Corridor"
    2. For every doorway in your tiles, change the socket to be one of your new socket types. Use the "Room" socket for any doorways in tiles that are rooms, and the "Corridor" socket for all tiles that are corridors.
    3. Override 'DoorwaySocket.CustomSocketConnectionDelegate' with your own custom logic. By default, doorways can connect if the sockets match. We want doorways to connect only when a "Room" socket meets a "Corridor" socket; the easiest way to do this is to just flip the logic so doorways can only connect if their sockets don't match (see example here).

    It's a bit of a hack, but it works. Having corridors between rooms is a commonly requested feature and I do have plans for implementing it, but this workaround is probably the best way to do it right now.
     
    John-G and Creiz like this.
  9. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    78
  10. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    359
    Hey I'm trying to add enemies based on the depth of the tile on the path with the TilePlacementData

    But when I print the Placement.NormalizedDepth it always prints 0 for the main Path it seems.

    It should be 0.2, 0.3, etc right?

    Edit: Nvm it works, it seems the depth is not yet initialized when calling it in Start
     
    Last edited: Feb 16, 2021
    hopeful likes this.
  11. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    359
    Does the branch depth also take into account how far along it is on the main path?

    Or is it just the depth of the branch itself.

    F.e. I want something to spawn only on a branch and also more towards the end of the main path.

    bamboo depth.png
     
  12. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Hello!
    Im trying to make something like a maze, what would be the best way to make it?
    I made a few tiles for corridors or others for rooms, but i would like to have rooms interconnected and maze-ish with some dead ends.
     
  13. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    The branch depth is just how far the tile is along the branch itself. Branch rooms do also have the path depth property to determine how far along the main path the branch is.

    In your example image, you should be able to just uncheck 'Can appear on Main Path?' and it will spawn the room only on branches (specifically in the latter half of the dungeon and towards the end of the branch).


    Dead ends would have to be accomplished by using branch paths since there can only be one main path. To make the dungeon more interconnected, you would increase the 'Connection Chance' setting in the dungeon flow asset - that makes it so doorways that overlap have a chance to be connected together, forming new paths through the dungeon. You might also want to place doorways in such a way to make random overlaps more likely (for example, make all of your rooms square with doorways appearing only in the middle of each wall).
     
  14. DoomGuy24

    DoomGuy24

    Joined:
    Feb 20, 2021
    Posts:
    2
    Hey there! I'm having a bit of an issue with the current syntax of unity. When trying to assign door socket rules, the code wont allow use of "==" or "&&" with DoorSocket or DoorSocketType. What we're trying to achieve, is allow "Corridor" sockets to connect to other "Corridor" sockets, as well as "Door" sockets, while preventing "Door" sockets connecting to other "Door" sockets. Do you have any advice on how to tackle that in the current version of the syntax??
     
  15. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538

    DoorwaySocketType
    is a legacy type that I've left in to allow DunGen to upgrade older projects. DoorwaySocket is all you should need. The new way to define custom connection logic is to provide your own function for DoorwaySocket.CustomSocketConnectionDelegate.

    If you only have two doorway socket types, the easiest way to achieve what you want is to just disallow room-room connections and allow everything else. Something like this.
     
  16. DoomGuy24

    DoomGuy24

    Joined:
    Feb 20, 2021
    Posts:
    2

    Thank you dude!
     
  17. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Hey, im having some trouble with the navmesh generator.
    I need the Height mesh option activated when baking the mesh on runtime, because all the AI characters are floating like 5 cm above ground, and i think using Height mesh will fix it, however i don't see any option to enable that option when baking the navmesh on runtime.
    How could i fix/do this?
     
  18. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    It looks like Unity's newer navmesh components don't support baking a height mesh (and the legacy system can't be used at runtime).

    If your character is floating at a consistent height, you can use the 'Base Offset' property of the NavMeshAgent to push it down to the ground, or just move the character mesh down a bit. If the offset changes based on what the character is walking on, you'd probably have to cast rays downwards periodically to find where the ground really is.
     
  19. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    77
    Hey, I just imported DunGen fresh into an existing project and then imported the internal playmaker integration package. One of the scripts is throwing an error out. It works fine if I just delete the script, but that's not ideal obviously. Any ideas please? =)

    Code (CSharp):
    1. Assets\DunGen\Integration\PlayMaker\GenerateWithSettings.cs(92,4): error CS0200: Property or indexer 'DungeonGenerator.UpVector' cannot be assigned to -- it is read only
     
  20. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    oh damn, ill have to see what i can come up with.

    Regarding the local prefabs (props) inside a tile, is there any way to indicate Dungen to only put X or Y prefab, but never both at the same time?
     
  21. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    359
    Create another prop set with just those 2 props but set the count to 1
     
    Aegon-Games likes this.
  22. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    Sorry about that, I sometimes forget to test the integration packages with new changes to the core DunGen code. This will be fixed in the next version, but in the meantime you can replace all of the code in 'DunGen/Integration/Playmaker/GenerateWithSettings.cs' with the code here.


    As lejean said, if you have two objects in a tile and you want only one of them to appear, you can put them both in a local prop set with the count set to one.

    You can achieve a lot by nesting the various random prop components together to create more advanced logic, but if that's not enough, it's possible to create your own logic entirely by creating a new component that derives from the RandomProp class.
     
    MrZeker and Candy-Bomber like this.
  23. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Thanks!
     
  24. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Hey I seem to be having a problem with Reflection probes, some times the reflection probe area is not rotated when the whole prefab is rotated, which makes some rooms to only have reflections in 50% of the room. How could i fix this?

    Also this asset is compatible with A-star pathfinding? (for runtime generation)
     
  25. ghastlysmilegames

    ghastlysmilegames

    Joined:
    Dec 23, 2019
    Posts:
    7
    Same here. Cyclic and alternate paths would be an awesome feature :)
     
  26. ghastlysmilegames

    ghastlysmilegames

    Joined:
    Dec 23, 2019
    Posts:
    7
    I think it is, but you need the Pro version. Source: DunGen documentation -> http://www.aegongames.com/blog/wp-content/uploads/DunGen_Readme.pdf (Integrations section)
     
  27. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Oh you are right, I completely missed that!
    thanks!
     
  28. elok11

    elok11

    Joined:
    Dec 9, 2019
    Posts:
    9
    Hello!

    I understand that you are busy, but do you have any approximate date for the cyclic generation?

    Thank you.
     
    Last edited: Mar 13, 2021
  29. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    Looks like reflection probes in Unity just can't be rotated at all. The only workarounds I can think of are to:

    1. Only use square reflection probes. If you have non-square rooms, go with the smallest square you can that still covers the whole tile when it would be rotated. This is an easy fix but not really a good one.

    OR

    2. After the room is placed, programmatically adjust the size and origin position of the reflection probe to fake rotation. This is a better solution but is much harder to implement.


    Unfortunately, I don't have a timetable for that right now. Cyclic generation is one of those big features that really requires DunGen to be re-written from the ground up. I have a few features like that in mind and I'm hopeful that when I get some more time to work on DunGen, the overhaul will be what I work on, but it's still in the ideas phase right now.
     
  30. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Oh damn, Ill probably go with option 1 then.

    Is it possible to change the dungeon flow at runtime?
    For example in the main menu select from a toggle to set the length of the dungeon. Im interested in changing the length and the branch count mostly.
     
  31. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    You can change the dungeon flow settings at runtime. You'll want to make a copy of the dungeon flow using Unity's Instantiate() function and make your changes to the copy to avoid making permanent changes to the dungeon flow asset in your project. I wrote a quick script here to show how it's done.
     
  32. Fyrburn

    Fyrburn

    Joined:
    Aug 30, 2013
    Posts:
    11
    Hello, I'm a little stumped on how to get specific tiles from the finished graph. in OnGenerationStatusChanged I can make a callback. Previously, I would do something like...

    Code (CSharp):
    1.  
    2. for (int i = 0; i < dungeonGenerator.CurrentDungeon.AllTiles.Count; i++)
    3. {
    4.     DunGen.Tile tile = dungeonGenerator.CurrentDungeon.AllTiles[i];
    5.     if (tile.Node != null && tile.Node.Label.Equals("Start"))
    6.     {
    7.         start = tile;
    8.     }
    9.     if (tile.Node != null && tile.Node.Label.Equals("Goal"))
    10.     {
    11.         goal = tile;
    12.     }
    13. }
    14.  
    However that no longer seems to be possible.
    I can't seem to find any other way in the documentation of picking a specific room out based on a label, manually. Is this just no longer supported?
     
  33. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    78
    @Aegon-Games

    Sorry if I missed it, but I can't seem to find a setting for it.

    Is possible for dungen to fill the "empty space" it doesn't use when the dungeon is generated?

    Or perhaps to include "rooms" that have no doors? I'm trying to make a "forest" level and I want to put trees "off the path". For decoration and background purposes.
     
  34. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,392
    There are probably several different ways to accomplish this, depending on your game and what you want. Essentially, though, you could have a trigger collider for each room that you make, and have it be slightly oversized for each room. When the dungeon generates, you've got colliders overlying each room. Then randomly spawn however many trees you want, but before instantiation check to see the if each random location is within a trigger collider. If not, then instantiate it.

    This should give you trees outside your dungeon.
     
    Creiz likes this.
  35. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    78
    That's how I was thinking of doing it, pretty much. Have "grids" all over a plane, see if there's a room in it or not, and if not, instantiate a random "room" of trees.

    Except my dungeon always generates rooms right next to each other and has no space for it.
     
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,392
    Then put the trees in your dungeon rooms to start with?
     
  37. GerPronouncedGrr

    GerPronouncedGrr

    Joined:
    Mar 30, 2013
    Posts:
    22
    @Aegon-Games Hi! Just bought this, have a quick question. I set things up according to the quick start in the docs, except I wanted to try using the Scene Objects blockers instead of the Random Prefabs. So after looking at the examples, I set it up so that each doorway has its own child blocker. The dungeon generates mostly correctly, but for some reason some doorways are open on one side, but blocked on the other. To put it another way, if room A has a doorway with no blocker spawned, then sometimes room B adjacent to room A will have the connecting doorway with a blocker spawned. Since my walls are simple planes and the materials are set to render only the front, it's very obvious that this is what's happening.
     
  38. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,135
    Do you have a list of DunGen asset creators (Mana Station type) on the asset store?
     
  39. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    Sorry for being so late with the replies. I thought it was suspiciously quiet over the last few weeks - I just wasn't getting an email for any new posts. I guess I didn't clear out my alerts last time I checked the thread.


    Start and goal tiles are easy enough to get, they're just the first and last elements of the MainPathTiles array:

    Code (CSharp):
    1. start = generator.CurrentDungeon.MainPathTiles[0];
    2. goal = generator.CurrentDungeon.MainPathTiles[generator.CurrentDungeon.MainPathTiles.Count - 1];
    I don't remember there ever being a way to get the label from a graph node the tile was spawned from though.


    There's no built-in solution for that because what it means to fill the empty space between tiles differs wildly from game to game.

    If you already have a ground plane that extends beyond the playable area, the easiest approach would be to just randomly scatter tree meshes. You can use the individual tile bounds to discard any object that would be spawned inside them to avoid overlapping any of your tiles.

    If your tiles are all the same sized squares, you could instead use the dungeon bounds to construct a uniform grid. You can then check each grid cell against the bounds of each tile to determine if the grid cell is empty, and if it is, spawn a filler tile there. If your tiles don't nicely fit to a grid though, the problem becomes much more difficult.


    I've only heard of this issue one other time and I wasn't able to reproduce it myself, but one thing that often causes some really weird issues is when one of your doorways is facing the wrong way. You can check for this by selecting your dungeon flow asset and clicking on the 'Validate Dungeon' button in the inspector - that will run a series of checks for the most common configuration errors and print them to the console.


    Mana Station's Multistory Dungeons pack is the only art pack I know of that comes with pre-made DunGen prefabs.
     
  40. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    85
    Hi,

    How can I set a doorway to always be the entrance and another doorway to always be the exit.

    I have a dungeon that is very linear, and I don't want some tiles rotated at the wrong way.

    Per example, the first tile(number 1) after the starting tile is inverted, while all the other ones are on the correct rotation, how can I set the tile number 1 to be rotated just like the 2, 3 and 4?
    upload_2021-4-11_23-40-52.png

    Many thanks,
    Gabriel.
     
  41. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    You can add a Tile component to your tile prefabs (if they don't already have one) and at the bottom of the inspector, you can tell it which doorways you'd like to use for the entrance and exit.

    TileEntranceExit.png
     
    CrandellWS and gliealonso like this.
  42. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    85

    Thank you very much!
     
    CrandellWS likes this.
  43. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Hello, Im having some trouble with double doors.
    So the hting is, im building an office level, and I set all the doors to the offices and not to the corridors, which kind of works, however if dungen connects 2 offices I get double doors which not only looks bad but it doesn't work.

    Any idea how to fix this?
     
    Last edited: Apr 15, 2021
  44. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    If you assign your door as a connector prefab it should only spawn one door for each doorway pairing. The scene objects list on the other hand will actually keep the objects for both tiles when doorways are connected. I tend to only use the scene objects list for things like door frames.

    DoorConnectorPrefab.png
     
  45. quadralift

    quadralift

    Joined:
    Jun 7, 2019
    Posts:
    3
    I made a test tile and tried to generate a dungeon but it's failing on some cryptic errors.

    Failed to generate the dungeon 20 times.
    This could indicate a problem with the way the tiles are set up. Try to make sure most rooms have more than one doorway and that all doorways are easily accessible.
    Here are a list of all reasons a tile placement had to be retried:
    UnityEngine.Debug:LogError(Object)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:251)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<InnerGenerate>d__91:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:299)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
    DunGen.<GenerateMainPath>d__96:MoveNext() (at Assets/DunGen/Code/DungeonGenerator.cs:530)
    DunGen.DungeonGenerator:Wait(IEnumerator) (at Assets/DunGen/Code/DungeonGenerator.cs:223)
     
  46. quadralift

    quadralift

    Joined:
    Jun 7, 2019
    Posts:
    3
    There was something wrong with my doorways, I got it to work by modifying the example assets.
     
    hopeful likes this.
  47. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Oh im gonna try it tomorrow.
    Another question I have is, im having problems with the integration with SECTR, I followed the (short) documentation on it, however, It culls a lot more things than needed, sometimes it culls the next room (when opening a door) or the end of hallways.
    I contacted the Sectr dev, but he tells me to export the "dungeon", however the dungeon doesn't exists while not in play mode.
    How could I fix this?
     
  48. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    I wasn't able to reproduce these issues with the basic sample project.

    Culling the next room when opening a door sounds like the Door component's 'IsOpen' property is set to false when it shouldn't be. The included AutoDoor prefab for the sample project sets IsOpen to true as soon as the door starts to open so SECTR doesn't cull the room behind it - IsOpen is only set to false when the door is fully closed.

    Unfortunately I have no idea what would be causing it to cull rooms at the end of a hallway.

    Do these issues happen for you in the basic sample project (DunGen/Samples/Basic/Basic Sample.unity) as well?
     
  49. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    203
    Oh I wasn't using the .IsOpen at all in my door script, I looked at your script and copied that and now it works, thanks!
    On another note, is it possible to set a dungeon to go from one direction to the other?
    Like always having the start room on (as an exampe) (-50,0,0) and have the end room at (50,0,0) im using the exact numbers as an example, but im rather interested in the possibly to have the dungeon go in the desired direction.
     
  50. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    538
    The start tile isn't rotated by DunGen so if you only give it one doorway it'll always be guaranteed to at least start in the same direction.

    Making the rest of the dungeon follow suit is a bit more of a problem, but you might get some decent results using the 'Straighten' property inside your archetype assets. Settings this to 1 will make DunGen try to lay out the tiles in a straight line.

    Another option would be to mark specific doorways in your rooms as the entrance & exit - this can be done in the tile component on your room prefab. If you mark doors on opposing walls as the entrance/exit, DunGen should always have to place the tiles in a straight line.
     
unityunity