Search Unity

DunGen - Procedural Dungeon Generation

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

  1. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Unfortunately you can't do that. Tiles placed by a node in the flow graph (including the start and goal tiles) have no branching; even if they did, DunGen doesn't make any guarantees about the number of branches it will produce.
     
  2. RobertMassart

    RobertMassart

    Joined:
    Apr 26, 2014
    Posts:
    16

    It took me all of 1 hour to create the variant I described. Just created my own class extending dungeon generator (changed private methods to protected). I could shared the new class with you but it's really simple and it works fine for my purpose.
     
    hopeful likes this.
  3. ctfan

    ctfan

    Joined:
    Mar 25, 2015
    Posts:
    13
    So I'd like to generate my dungen around 1 unique prefab so it appears as a square.My layout is that of a 3 by 3 grid with the middle 2,5,7 being unique. The others become randomised around it and priority to fit as a square of 3 by 3. My problem is I keep geeting several random instances that either misalign ,overlap or go out of the boundary. Any idea on how I can solve it.

    I've included an example. So the red represents the unique. The green can randomise from each other and the blue likewise but not either or. So red has 6 doorways attached to it. example.jpg
     
    Last edited: Aug 11, 2017
  4. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sorry, I don't think you'll be able to get results like that out of DunGen. You've got some very specific requirements that DunGen just wan't made to handle.
     
  5. Wolar

    Wolar

    Joined:
    Sep 25, 2014
    Posts:
    38
    Hello, I'm about to buy your plugin, it looks absolutly amazing I have just few questions for which I wasn't able to find answer anywhere (sorry if they are already here, I tried to search this thread but not read it all through)

    • Is there any documentation available? I found only PDF with tutorial but nothing describing the classes, it's APIs and so on, that might anwser my next questions.
    • Am I able to tweak some (most) of the generation properties via code, before running the runtime generation? I know I can for example create dungeon flow via editor, is there a possibility to create it via code? My goal is to have different dungeon flows for differente difficulties / parts of the game and I don't want to create the flows and tweak all the properties by hand all the time so I would prefer if my code could (probably generate and) inject these into your generator. (I guess yes since Archetype and DungeonFlow are just Assets I can generate at runtime right?)
    • How spawning of the NPCs is working? Is there any support in the DunGen or do I have to implement it in a way that for example each room has a spawner and than I have some manager that finds all the spawners and spawns something after the dungeon is generated? I guess I can use props for that but than I have very little control about what enemy get's spawned where right? (Like easy at start, tough at the end of dungeon or spawning a group of enemies of the same kind in one room)
    • Is there a way how to get distance / order of the room of the room in the generated layout? Or to get information whenever it's on the main or branch path?
    Thanks, Martin
     
  6. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    • There's no API documentation at the moment. I'll look into creating some in the future.
    • You should be able to create everything at runtime through code. There's a fluent interface in the form of the DungeonFlowBuilder class for putting flow graphs together that hides a lot of the manual work. For example, this would create the default (blank) dungeon flow with a start and goal node connected by an empty archetype:
    Code (CSharp):
    1. var emptyTileSet = new TileSet[0];
    2. var emptyArchetype = new DungeonArchetype[0];
    3.  
    4. var builder = new DungeonFlowBuilder(dungeonFlow)
    5.     .AddNode(emptyTileSet, "Start")
    6.     .AddLine(emptyArchetype, 1.0f)
    7.     .AddNode(emptyTileSet, "Goal");
    8.  
    9. builder.Complete();
    • You could use the prop system to spawn enemies though as you mentioned, you'd have more control using your own spawner. You can adjust the chance of a specific prop spawning based on how deep into the dungeon it is to handle the "easier enemies at the start" case.
    • Each tile GameObject will be given a Tile component that has a PlacementData property that should contain all the positional information you could need: whether it's on the main path or a branch, distance along the main path, and distance along a branch (if applicable). Distance is given both as a concrete number of tiles and as a normalised percentage through the dungeon.
     
  7. slowdev1

    slowdev1

    Joined:
    Sep 12, 2011
    Posts:
    35
    Hi Aegon-Games,

    I have runtime nav mesh baking working pretty well in your demo scene. One thing I can't figure out is how to exclude the walls from getting nav mesh baked at runtime. Making the walls "Not Walkable" in the navigation>object setting doesn't seem to work, and turning off Navigation Static doesn't seem to work also. A nav mesh keeps getting baked on top of the wall.

    I even tried changing the Height and Step Height in the Humanoid Agent and that doesn't change anything either. Any ideas on how to stop nav meshes from being baked on top of walls at runtime?

    Thanks
     
  8. slowdev1

    slowdev1

    Joined:
    Sep 12, 2011
    Posts:
    35

    Actually, I figured it out. If you put NavMeshComponents/Scripts/NavMeshModifier.cs on the objects you would like not-walkable, you can check "Override Area" and set it to not walkable. It's working well now! Thanks.
     
    hopeful likes this.
  9. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    @Aegon-Games

    im unable to use more than 2 nodes in my flow, & always have the "failed to generate 20 times error" flow.PNG flow1.PNG
     
  10. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
  11. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Does the error give any additional information? The "failed to generate 20 times" error should tell you vaguely what caused it to fail.
     
  12. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    eh... managed to fixed it... apparently my studio's git overwritten the doorways socket script..haha
     
    hopeful likes this.
  13. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    can i build a oval coliseum in dungen?
     
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    You can add an oval room to your dungeon, but it will be treated as square for boundary purposes.

    Strictly speaking, you can't "build" a structure like a building, though. That's not how this works.
     
  15. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    All-in-all this is a really great asset. I can't get over how many contingencies you've considered. Thanks!
    However, I think I've found a couple bugs. Haven't looked into the code much so I can't confirm what is going on but the behavior is definitely off.

    1) My endcap settings are being blatantly ignored in some cases. There are many times when there is plenty of room to spawn an endcap, ANY of them (though I have specific ones for very small spaces) but instead it appears that either another normal tile is spawned or it is simply blocking off the path at that point. This simply won't do since it results in many dead end halls that go nowhere rather than to a room. I've checked my tiles many times over and it definitely isn't a configuration error.

    EDIT: A quick look seems to indicate this occurs any time BranchDepth is set higher than 1 for min and max. It seems to be happening somewhere in GenerateBranchPaths().

    Capture.PNG

    2) 'Allow Rotation' on tiles is being ignored. That is to say if un-check that option on a tile, it does nothing. The tile is still rotated. The global override in the generator seems to work though.

    ~Sluggy
     
    Last edited: Sep 26, 2017
  16. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I think I have asked this before, but how does weight play in between different tilesets?

    So for example, if I have one tileset with 3 rooms with weight 1,1,1 and one tileset with 1 room with weight 1, will they respect rooms from each others tilesets so that they all have the equal chance? or the 1 room that is in the tileset with one room will have significant higher chance of being spawned?

    Since there is no weighting between different tilesets, I was wondering what is the case and how we control it.
    Having number of tilesets to be used in the archetype is great for organizing the tilesets, but without proper control, it would be difficult to actually use it in practice.
     
  17. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    I might be able to answer this since I'm browsing the code right now trying to fix another issue. It appears that for any given tile spawning, all viable choices of tiles are considered in aggregate as though from one giant list.


    In regards to my above post I think I've tracked it down. It actually appears that these two issues are somewhat related. The reason the endcaps don't always spawn is because in the function IsValidDoorwayPairing() it returning false when it tries to attach a room to a tile in a direction that it thinks is impossible due to the 'Allow Rotation' flag being un-set. This seems odd since at this point it really shouldn't care if the room was rotated or not when considering valid door pairings. Either way, this is getting way over my head since I don't know enough context for the whole system to know if changing this small part will break anything else.
     
  18. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Since 5.6 unity nav mesh can be generated at runtime. Does dungen handle that?

    Also what culling engines are supported at runtime?
     
  19. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Humm.. I was also wondering about the end cap tiles not spawning sometimes. (well more than I liked) I used "insteadof" but it doesn't spawn it far too many times. So you think it is related to the rotation issue?
     
  20. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    Well there's the obvious issue that sometimes it's simply impossible to spawn an endcap due to bounding box issues of rooms. But that aside, yes it definitely is due to the 'Allow Rotation' flag being un-checked for tiles. If you make sure all of your tiles allow rotation then it will always use endcaps when possible (assuming you have it set to 'instead of').
     
  21. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Version 2.11.3 (Beta 3) - Now Available on the Asset Store
    Available on the Asset Store as of 8th January 2018
    Updated: 29th October 2017

    Changes

    • Auto-calculated bounds should now ignore particle systems

    Bugfixes

    • Large tiles should no longer overlap a small amount
    • Per-tile "Allow Rotation" and "Allow Immediate Repeats" options should work correctly again
    • [New in Beta 2] DunGen now supports setting Physics.autoSyncTransforms (new in Unity 2017.2) to false
    • [New in Beta 3] Lock & key placment should now correctly be done after props are processed


    It seems the rotation issue was a bug. I was checking the "allow rotation" option for the tile that was being attached to rather than the new tile that was being attached. This could be the cause of some issues with your cap tiles as well. Hopefully both issues will be fixed in the new beta version above.


    All of the weights for your tile sets are combined before a tile is selected. In your example, all four rooms will have an equal chance to spawn.


    Yes, DunGen can work with Unity's built-in NavMesh generation from Unity 5.6 onward. The process is described on page 29 of the documentation.

    DunGen includes a simple (optional) culling solution which only renders the tile the player is in and any adjacent tiles (for which the door is open). The built-in solution only really works for games with interior dungeons where the player camera is actually contained within the rooms though. For third party culling solutions, DunGen is integrated with SECTR VIS portal culling.



     
    Last edited: Jan 8, 2018
    laurentlavigne and hopeful like this.
  22. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    Great! I'll check it out tonight.
     
  23. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    Ye-ah! This fixed both the 'allow rotation' and the end-caps bug. Thanks! You've put me back on track!
     
    hopeful likes this.
  24. Enoch

    Enoch

    Joined:
    Mar 19, 2013
    Posts:
    198
    Hello,

    I am about to tackle some code changes to Dungen and was looking for any advice. What I want is each tile to have a list of acceptable neighbor tiles. So that when a tile spawns only those tiles in the acceptable neighbor list will spawn next to it.

    Dungen already uses weights to select the next tile, so I am hoping that all I need to do is find the function where you select a tile to add by weight (from the list of tiles) and simply change the input list to that of the source tiles acceptable neighbor list.

    Simple right. Hardly, Murphys law of software dev, the first casualty of any software battle is always the pseudo-code inspired plan!

    Any helpful pointers or advice of any potential pitfalls would be most appreciated.
     
  25. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    I'd look at the DoorwayPairFinder class; it's responsible for determining what is considered a valid connection between tiles. You could probably achieve what you want by modifying CalculateOrderedListOfTiles().

    Perhaps something like this (untested):
    Code (CSharp):
    1. private List<GameObjectChance> CalculateOrderedListOfTiles()
    2. {
    3.     List<GameObjectChance> tiles = new List<GameObjectChance>(TileWeights.Count);
    4.     GameObjectChanceTable table = new GameObjectChanceTable();
    5.  
    6.     // This is the first tile in the dungeon, just take all possibilities
    7.     if (PreviousPrefab == null)
    8.         table.Weights.AddRange(TileWeights);
    9.     else
    10.     {
    11.         // Only consider tiles which can be connected to the previous one
    12.         foreach (var tileWeight in TileWeights)
    13.         {
    14.             bool canConnect = CanTilesBeConnected(PreviousPrefab, tileWeight.Value); // Your logic here
    15.  
    16.             if (canConnect)
    17.                 table.Weights.Add(tileWeight);
    18.         }
    19.     }
    20.  
    21.     // We use the weightings to randomly construct an ordered list of tiles to consider
    22.     while (table.Weights.Any(x => x.Value != null && x.GetWeight(IsOnMainPath, NormalizedDepth) > 0.0f))
    23.         tiles.Add(table.GetRandom(RandomStream, IsOnMainPath, NormalizedDepth, null, true, true));
    24.  
    25.     return tiles;
    26. }
    Where CanTilesBeConnected is your own method for checking if two prefab GameObjects can be connected to one-another.
     
    Enoch likes this.
  26. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    I'm hitting a wall here trying to generate side-scrolling dungeons using Dungen. Foolishly, I felt confident enough to design and build several rooms without testing only to find that even the simplest scenario isn't valid. I have no idea what could be wrong so I'm not sure if it's a bug in Dungen or just something I'm missing.

    I've included a screen shot which shows the only tiles being used. The start tile, the archetype tile, and end tile. Nothing else is being used. I've minimized as many options as I can - no branching, no end caps, etc. I originally had all three tiles set to not allow rotation but I've tried every combination with that setting. Nothing builds successfully. I also tried fiddling with the 'Up Vector' for the generator but that doesn't seem to affect anything either.

    Capture.PNG
     
  27. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sorry for the late reply.

    I can't see anything wrong with the setup of the tiles in your screenshot. One thing to maybe check is that all of your doorways are oriented with their local Y-axis pointing upwards.

    When you say it doesn't build successfully, you mean nothing shows up at all? In that case you should get an error message about x number of failed attempts. That error message should usually give some more details about what's going wrong with the generation process.
     
  28. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    No worries. I know how it is.

    UPDATE:
    Got it. It's unity's new AutoSyncTransforms setting. If it's turned off (which in most cases it should be for performance reasons) then the colliders aren't updated until the end of the frame. So when a room is spawned into the scene and then repositioned the physics system still believes that the collider is at the original location, thus Dungen believes that it is stacking rooms on top of themselves.



    Sorry, I wasn't clear. I mean to say that the dungeon fails to generate after X number of attempts and then reports this to me as an error. Now that I look into it further - nothing builds. Even the dungeons I've successfully built before. Even a basic cube with four doors for all three tiles. I'm using the 2.11.3 beta and I did just upgrade to 2017.2. Gonna try it in 5.6 next chance I get and see what happens.

    EDIT: Just tried out 2.11.3 beta with 5.6. Works just fine. Looks like I'll be rolling back to 5.6... again... for the third time.

    EDIT: So as a final remark for this: It appears I can get the simple cube with some doors generating in 2017.2 after all. If I start a clean, empty project. For some reason when using the the exact same assets in my actual project (I imported the working ones to my actual project just to be sure) simply fail to generate. No idea what is going on at this point. I've tried a fresh scene with the previously established working dungeon assets and it fails.
     
    Last edited: Oct 20, 2017
    hopeful likes this.
  29. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    I want this but for a 2D sidescroller where you have rooms and randomize the content inside. Any plans for 2D?
     
  30. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Thanks, I'm glad you figured it out. I had no idea that option was added in 2017.2 - guess I should read the release notes more carefully.

    I've updated the beta build so that DunGen manually syncs transforms when needed if Physics.autoSyncTransforms is set to false.


    DunGen actually already works in 2D as well.
     
    hopeful likes this.
  31. ctfan

    ctfan

    Joined:
    Mar 25, 2015
    Posts:
    13
    say i need to generate a linear set of rooms in a straight line.but each room is connected by a corridor generated from within the tile set list. How can i go about doing so?
     
  32. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    For the moment, something like this will require some code to be changed in DunGen. The easiest way would be to make specific doorway socket types for rooms and corridors and then forcing DunGen to only connect rooms to corridors that way. I've described the process in a little more detail and provided some code in this post.
     
  33. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    Amazing! that code works!
     
  34. Sanginius

    Sanginius

    Joined:
    Apr 21, 2013
    Posts:
    14
    Hi there,

    I have a pre-sales question regarding tiles and doorways. I would like to create tiles that have predefined exits, which are always used until the dungeon ends in a dead-end tile, or the tiles run into another, already existing tile (you could run in a circle).

    Is that possible?
     
  35. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    You can have pre-defined exits for tiles, but there's no way to have the dungeon generate until it reaches a dead-end tile or runs into an already existing tile. DunGen only works using a fixed (between min and max) length for the dungeon layout.
     
  36. inthemilkywat

    inthemilkywat

    Joined:
    Dec 29, 2013
    Posts:
    56
    Is it possible to keep generating main tile branches until certain amount of enemies have been spawned?
     
  37. N0R7H

    N0R7H

    Joined:
    Jan 19, 2017
    Posts:
    42
    After fiddling around with dungeon generation on my own for a while I am finally considering the purchase of a more complete solution.
    DunGen seems particularly interesting since it allows for multistory dungeons.

    I do have a few questions though:
    - Is it possible to have branches circling back on each other? So that you could make shortcuts available after you reached the other side of a door? (I am not really sure how to describe this feature properly.)
    - Can you create something like a hub room, that connects multiple parts of a dungeon?
    - Since you support multistory dungeons, do you also support multistory rooms? Can you, for example, have a room with 2 exits on the ground floor, one exit on the middle and two more on the upper floor?
    - Can you circle back using multiple floors? This would basically require multiple stairs or ladders connecting those multiple floors.
    - Can you have all those things together to create something wonderfully complex?

    @Aegon-Games I would really appreciate it, if you could take the time to answer those questions. Thank you so much, in advance.
     
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I'm not the author of this plugin, but it sounds like you have some misconceptions. DunGen is designed to create maps that won't circle back; they will proceed from a starting room to an ending room. This is for the play style where you enter the dungeon and basically fight your way to the end, where the boss and/or treasure is located.

    The multiple stories are only if the rooms you make have multiple floors, and no, new rooms placed by DunGen can't overlap other ones. If you want to have a looping or overlapping scenario, it has to be within the room you add to the DunGen room list. (In other words, you can make a multistory room that has overlapping walkways and corridors that loop, and use that room and others like it in your DunGen layout.)

    Because it has a guaranteed pathway from start to end, DunGen can also let you insert doors with keys where the key will always be found somewhere between start and the door. Other algorithms that do looping and overlapping layouts cannot provide this feature.
     
    Aegon-Games likes this.
  39. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Unfortunately, no. DunGen needs to know how long a path is expected to be in advance. A work-around to guarantee that enough enemies will be spawned would be to over-populate rooms with enemy spawn points and randomly select as many as you need to spawn after DunGen is finished generating the layout.


    Anything that requires the dungeon to loop back on itself isn't possible with the way DunGen works I'm afraid. Loops can only happen by accident - if two doorways perfectly overlap by chance, then DunGen can connect them, but there's no way to do it by design.

    Multi-story rooms work just by placing doorways at varying heights in the room. As with any other room, DunGen isn't guaranteed to use all available doorways and there is only one main path through the dungeon, the remaining paths are simply branches off the main route.
     
  40. N0R7H

    N0R7H

    Joined:
    Jan 19, 2017
    Posts:
    42
    Well thanks for chipping in, anyway.
    I respectfully disagree with your last statement, though. That kind of algorithm is definitely possible. At least for tile based solutions.

    @Aegon-Games
    Thanks for the response. I still like your approach very much, but unfortunately it is too close to what I already have come up with on my own.
     
  41. francescobr

    francescobr

    Joined:
    Apr 2, 2017
    Posts:
    45
    @Aegon-Games I'd like to attach one (or more) dungen generated dungeon to an existing scenario, would this be possible? What I imagine is that a door in my current world would be attached to what dungen creates, is that too much?
     
  42. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sorry for the late reply.

    You can generate as many dungeons as you want in the scene. Connecting them to existing scenery is trickier though, there's no built-in way to do that. You do have access to information about doorway locations, so it can be done manually, the most difficult part would be ensuring the generated dungeons don't overlap with any other geometry.

    On possible work-around that avoids most of this frustration would be to instead teleport the player into the dungeon when they interact with a door in your hub world.
     
  43. francescobr

    francescobr

    Joined:
    Apr 2, 2017
    Posts:
    45
    I understand, thank you for replying :)
     
  44. CentViRe

    CentViRe

    Joined:
    Dec 6, 2016
    Posts:
    15
    Hello, i am using Dungen for VR game. And issues with optimization. Do you have some advice to use?
     
  45. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    im also working in VR too, my fix was to use a mesh combine tool to combine the meshes into parts then use occulusion area to bake the the culling in
     
  46. CentViRe

    CentViRe

    Joined:
    Dec 6, 2016
    Posts:
    15
    And how you added occlusion area to the room prefab? or you bake it in scene?
    How much your rooms have polygons, and your fps?
     
  47. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    1. use Occlusion Area (https://docs.unity3d.com/Manual/class-OcclusionArea.html) Bake culling at runtime
    2. each room prefabs i had close to 2.2mil tris, fps per room avg around 110-125fps
    3. i did not bake anything, i had only 1 directional light (for shadows)+ post processing stack (AO + Bloom) + Amplify Color
     
  48. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Hello,

    I'm having issues trying to make the rotation of my entrance tile match the rotation of my dungeon root object. I'm using an entrance tileset in the flow.

    It seems whatever I do, the rotation of the starting tile seems to match its starting rotation in the tile prefab, relative to the world. I've tried allowing tile rotation and there seems to be no effect. Even if I rotate the dungeon root's parent object, when the dungeon is generated, the entrance will always face the same way, relative to the world. Same with rotating the root directly.

    Rotating the tile prefab's contents will not help me in this case, as I need to be able to generate the dungeon at a specific point, on the edge of a bounding box I've created and restricted it to.

    The entrance tile's doors are set to Entrance and Exit, and I've tried allowing and disallowing tile rotation.


    Also if I could tack on one more question: is there a way to execute a function when generation completes? Can I check the dungeon status somehow?

    Thanks for any help.
     
    Last edited: Jan 23, 2018
  49. glishh

    glishh

    Joined:
    Oct 25, 2015
    Posts:
    5
    Would you be willing to explain this a little more? Sorry, I'm still pretty new to working with VR and want to make sure this asset would be worth it for me haha
     
  50. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sorry, that looks like a bug. In the DungeonGenerator.cs file around line 741 you should see this line:

    Code (CSharp):
    1. newTile.Root.transform.localPosition = Vector3.zero;
    Directly underneath it, if you also add the line below, you should start seeing the expected behaviour of the start tile respecting the root object's transform:

    Code (CSharp):
    1. newTile.Root.transform.localRotation = Quaternion.identity;
    Regarding your second question: there is a callback on the dungeon generator which reports its current status. Here's an example of a component that would do something when the dungeon generation completes:

    Code (CSharp):
    1. using UnityEngine;
    2. using DunGen;
    3.  
    4. namespace Test
    5. {
    6.     [RequireComponent(typeof(RuntimeDungeon))]
    7.     public class DoSomethingOnDungeonComplete : MonoBehaviour
    8.     {
    9.         private RuntimeDungeon runtimeDungeon;
    10.  
    11.  
    12.         private void Awake()
    13.         {
    14.             runtimeDungeon = GetComponent<RuntimeDungeon>();
    15.             runtimeDungeon.Generator.OnGenerationStatusChanged += OnDungeonGenerationStatusChanged;
    16.         }
    17.  
    18.         private void OnDestroy()
    19.         {
    20.             runtimeDungeon.Generator.OnGenerationStatusChanged -= OnDungeonGenerationStatusChanged;
    21.         }
    22.  
    23.         private void OnDungeonGenerationStatusChanged(DungeonGenerator generator, GenerationStatus status)
    24.         {
    25.             if (status == GenerationStatus.Complete)
    26.             {
    27.                 // Do something here
    28.             }
    29.         }
    30.     }
    31. }
    32.  
     
    hopeful and tapawafo like this.