Search Unity

DunGen - Procedural Dungeon Generation

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

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    excellent.. i will try this out!.

    but i can already see this will be much better for the user to be able to do this on the flow graph. we can do this by adding a special node in the graph and do our settings in there. because dungeon gen setting is all in there.. if is not done as node, we should be able to do this on the inspector of flow asset. but for now i will test it out using the code...
     
  2. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Yeah, I'll definitely build a more user-friendly method on top of this for handling simple cases; but for handling custom placement logic, this is certainly the most powerful way I can think of doing it.
     
  3. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hi! I am sure this has been asked a few times but I am not interested in reading through all 13 pages (yes I am very lazy) but is it possible to generate one room only once? I know you can use the flow editor (?) to add a room but this seems to be it obligatory to go through that room to keep going. I just want it to be a room like any other room but only appear once in the whole dungeon.

    ? - Not able to access Unity with DunGen right now so not 100% if it was the flow editor you did this in.
     
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    this is the feature that i was asking for and being discussed right above. and author has added option to do this at least by scripting.
     
  5. JuJuCoder

    JuJuCoder

    Joined:
    Dec 10, 2013
    Posts:
    30
    Do you have idea what would be the best way to implement AI navigation to runtime generated dungeon.Obviously unity navMesh fails since it must be prebaked. Currently I am investigating if RAIN AI could do this, but I really wanted to hear you view on this.

    Second question is that is there a function something like "AfterDungeonTitleAdded", which is called after when a new tile is added to a dungeon. I could use it for initialization purposes (e.g to combine RAIN navmeshes).
     
  6. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    I messed around with RAIN before and managed to generate a navmesh for a dungeon; that was as far as I went with my testing though.

    There is no event from DunGen for when a tile is added; I just generated a navmesh around the entire dungeon after generation was complete. Stitching existing navmeshes together from individual rooms would be faster, but there's so much that could differ between each instance of a room (all the doorways, & props) that I don't think it's feasible.
     
  7. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Wow. I can't believe that I missed that. I am so dumb.
     
  8. Cargh

    Cargh

    Joined:
    May 17, 2011
    Posts:
    36
    Is it possible to have a dungeon inside a dungeon, I.e large outdoor connected spaces with local dungeon structures inside them?
     
  9. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    New beta build is ready.

    Version 2.6.0 (Beta)
    - Download

    - Tiles can now be "injected" into DunGen before randomization occurs. Injection delegates can be added to the generator's TileInjectionMethods property
    - [NEW] Tile injection for simple cases can be done through the DungeonFlow inspector. No code required.
    - Edit: [NEW] Fixed an issue that sometimes caused tiles to not be cleaned up correctly in editor-built dungeons, resulting in what looked like overlapping rooms

    The documentation has also been updated with a new "Injecting Special Tiles" section which explains how to use both the UI and code-driven approaches to inject tiles into DunGen.



    Unfortunately not. DunGen only checks for collisions against tiles within the current dungeon, it won't avoid other dungeon paths (and if it did, there would be a very real chance that dungeons would just block each other's paths and cause generation to fail).
     
    Last edited: Jul 21, 2015
  10. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    I'm not exactly sure what you are intending, but if you don't need to have all of your dungeon layouts existing at the same time, you could toggle them off / on as needed, thus possibly avoiding the conflicts.

    If you don't need runtime randomized dungeons, you could also possibly select layouts in the editor that avoid colliding with each other.
     
  11. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hi!

    I just have a simple question. How can I make so the doorways doesn't destroy the "If not connected" object? I just want it to disable it using SetActive. I've tried editing DungeonGenerator at lines 112-114 and Doorway at lines 87-90something. None of them works.
     
  12. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    I think what you're looking for is the ProcessDoorways() function in TilePlacementData.cs, around line 125
     
  13. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Thank you! I found it and it works perfectly!
     
  14. Tovrin

    Tovrin

    Joined:
    Jul 15, 2015
    Posts:
    70
    Can it do caves?
     
  15. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    As long as you have the models for your cave sections.. I am testing with Underworld Cave asset from Manufactura K4 and it is working.. Not without issues, but I think it is more how the "rooms" are different sizes and not exactly squared off.. But it is working... :)
     
    Aegon-Games likes this.
  16. Cargh

    Cargh

    Joined:
    May 17, 2011
    Posts:
    36
    @AegonGames

    Thank you for answering my previous question.

    Also is there anyway to restrict the size of the dungeon. I.e. 1000m X 400m.

    Is there any concept of tile density or way to control proximity of tile proximity to other corridors or rooms, i.e. rooms in a home, back to back with each other.

    Also is there anyway to have procedural placement of models within a tile, i.e. If a wall has no other dungeon tiles blocking it visually to place a window model instead of a solid wall.

    I am looking for something that would allow me to proceduraly generate rooms in a skyscraper, while allowing a view outside for rooms that are at the outer bounds of the restricted area.

    I am guessing I will need to build my own solution or would need to heavily modify this asset.
     
  17. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    New beta build with some suggested quality-of-life changes:

    Version 2.6.0 (Beta)
    - Download

    - Tiles can now be "injected" into DunGen before randomization occurs. Injection delegates can be added to the generator'sTileInjectionMethods property
    - Tile injection for simple cases can be done through the DungeonFlow inspector. No code required.
    - Fixed an issue that sometimes caused tiles to not be cleaned up correctly in editor-built dungeons, resulting in what looked like overlapping rooms
    - [NEW] There's now an "Overwrite Existing?" option when generating dungeons in the editor
    - [NEW] Doorways now have a "Hide Conditional Objects?" option which hides all GameObjects in the "Add when in use" and "Add when NOT in use" lists (for the purpose of reducing clutter at design-time - has no effect on the runtime results)


    There's no built-in solution for any of this. It would be possible to swap the "IsOverlappingAnyTile" method with a more generic "IsValidPlacement" function that could check constraints (for things like size & density), but the way DunGen works doesn't play nicely with constraints; more often than not, constraints would just prevent dungeon layouts from being generated properly.

    For replacing walls with windows, you could have a script attached to your walls that cast a ray outwards after generation is complete - which would allow you to swap the mesh for a window if nothing is occluding it.

    Overall, I think it'd take just as long (or longer) to make DunGen suitable for your purpose as it would to build a custom solution from scratch.
     
  18. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    DunGen is the wrong concept for what you want. DunGen is different from most of the other dungeon generators in that it is made with more of an RPG type play scenario in mind, so you have a flow of rooms from start to middle to end without regard as to whether the layout makes sense from an external architectural standpoint.

    There are other dungeon generators in the store that ought to come closer to your needs. Also, Buildr is a plugin aimed at procedurally creating buildings and it does do some of the interior work as well as the exterior. It might make a suitable starting point for you.
     
  19. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sorry about the rapid-fire beta builds recently. These have been mostly small feature requests made over the last few weeks that I thought I'd get out there as quickly as possible.

    I don't expect many more changes to be made to 2.6.0, so hopefully I can get it pushed to the Asset Store in the next few days.

    Version 2.6.0 (Beta)
    - Download

    - Tiles can now be "injected" into DunGen before randomization occurs. Injection delegates can be added to the generator'sTileInjectionMethods property
    - Tile injection for simple cases can be done through the DungeonFlow inspector. No code required.
    - Fixed an issue that sometimes caused tiles to not be cleaned up correctly in editor-built dungeons, resulting in what looked like overlapping rooms
    - There's now an "Overwrite Existing?" option when generating dungeons in the editor
    - Doorways now have a "Hide Conditional Objects?" option which hides all GameObjects in the "Add when in use" and "Add when NOT in use" lists (for the purpose of reducing clutter at design-time - has no effect on the runtime results)
    - [NEW] All object lists now report how many objects they contain
    - [NEW] Doorways now have a "Blocker Prefabs" list which works similarly to the existing "Door Prefabs" list, except with doorways that are not in use. Allows you to define blocking objects without placing them in the tile first, if that's your preferred workflow
     
    CineTek likes this.
  20. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Version 2.6.0 has now been released.

    I've gone back to uploading a separate package for both Unity 4 & 5 so anyone still using Unity 4 shouldn't have any problems getting it from the Asset Store this time around.
     
    hopeful likes this.
  21. SkygodGames

    SkygodGames

    Joined:
    Feb 23, 2014
    Posts:
    18
    Im looking to buy this asset, however, im wondering if it will provide me with something similar to procedurally assembled rooms in Counterspy?
     

    Attached Files:

  22. Dwight_P

    Dwight_P

    Joined:
    Feb 26, 2013
    Posts:
    42
    I have never played Counterspy, but based on your image I do not see why this asset would not work. It appears that the complexity is just camera "magic" vs really complex procedural systems.Just just build the rooms so that they door ways are always on the far outside near the camera, don't add an external wall, and then add room depth. Again, that's all based on just the screenshot, but it should work just fine. it is actually a VERY flexible system. I have been using it to create outdoor dungeons, and even though it was not designed for it, i've yet to have a single issue with it. You just have to follow the few documented restrictions.
     
    Aegon-Games likes this.
  23. Al-

    Al-

    Joined:
    Jun 5, 2015
    Posts:
    26
    Hello,

    Please, I'm having some error messages with dungen in Unity 5.0.2f. Could you, please, help me with it?. I add a printscreen.

    Thank you
     

    Attached Files:

  24. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    I just imported your asset for the first time. I am on Uity 5.1.2f1. I get an error.

    [CompilerError] `NodeType' does not contain a definition for `Normal'
    0. Compiler Error at Assets/DunGen/Code/Editor/Inspectors/GraphObjectInspector.cs:40 column 43

    ==UPDATE==

    I think it involves a clash with Benchy Profiler. I get an error in MonoDevelop when I attempt to find the declaration of NodeType, but it is attempting to load the BenchyEditor.dll assembly.

    ==UPDATE==

    Visual Studio didn't crash. Yes. There is a enum NodeType defined in BenchyEditor.dll.

    ==UPDATE==

    I see you use NodeType in GraphObjectInspector.cs once and in DungeonFlowEditorWindow a couple of times. I will try using a fully qualified DunGen.Graph.NodeType in those instances to see if it helps.

    ==UPDATE==

    DunGen now compiles w/o these errors.
     
    Last edited: Aug 19, 2015
  25. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sounds like there's another "Key" class somewhere that's not inside a namespace. There are two ways you can fix this:

    1. Find the other Key class and put it inside a namespace
    2. In the KeyColour.cs file on line 7, change this:

    Code (CSharp):
    1. public void OnKeyAssigned(Key key, KeyManager manager)
    to this:
    Code (CSharp):
    1. public void OnKeyAssigned(DunGen.Key key, KeyManager manager)

    I'm glad you got it working. I might start using fully qualified names in DunGen when referencing types with common names like that, although ideally people putting stuff on the asset store should have their own code in namespaces anyway.
     
  26. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    I have had several issues with assets being sold that don't have their own namespace. It is my belief that it should probably be mandatory to do so to be sold on the asset store. It was much easier to just qualify your names than get another developer to change their dll for me. Thanks for supporting with source code.
     
    hopeful likes this.
  27. Al-

    Al-

    Joined:
    Jun 5, 2015
    Posts:
    26
    Thank you very much, Aeongames
     
  28. Dwight_P

    Dwight_P

    Joined:
    Feb 26, 2013
    Posts:
    42
    I have a feature request that I think may be great for expanding on the rotation system, and i'll explain why. I am working on an outdoor style dungeon with a hedge style wall. Recently I noticed that the tiles will look fine if they rotate left and right from the default location, but if they are rotated to 180 of the default the seamlessness and material pattern is distorted. Being able to define what directions any specific tile can be allowed to rotate if rotation is active may not be a bad idea, and will help add to the procedural logic for rooms designed to flow only in certain directions.
     
    Alverik likes this.
  29. Tovrin

    Tovrin

    Joined:
    Jul 15, 2015
    Posts:
    70
    Can anyone recommend a good 3D dungeon tileset and Cave Tileset that can be used with DunGen?
     
  30. AlmightyGames

    AlmightyGames

    Joined:
    Jul 11, 2015
    Posts:
    21
    I'm having difficulty setting up Locked Doors and Keys. I've tried reverse engineering the Demo with no luck at all. I've followed the documentation to the best of my abilities. I searched Google high and low and found nothing that points to anything useful. I don't usually ask for help, but I'm running out of options here.

    Is there anyone who might be willing to help me understand this procedure, or even walk me through it step by step? It might make more sense to publish a video that better explains this to everyone (rather than just me).

    Also.. I'll bet there's many different ways that this can be accomplished. I'd be especially pleased if I could look at 2 or 3 methods for getting this to work, but would settle for one if it does the trick. With just a couple of walk-through demos, I think I could deductively figure out what is going on, and from there, build my own system (as recommended in the documentation).
     
  31. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    I am having trouble with my dungeon creation. I am able to create the first 4 floors fine but then on the 5th floor it gives an Argument is out of range exception, parameter name: index. It's not a problem with that particular floor though because its the same thing as the other floors. Just on the 5th time it gets hung up on something. The dungeon will still be in the hierarchy but is inactive/not initialized. Can you make any sense of this error message? the screenshot has the details, thanks

    EDIT: here is a copy-paste of the error in case its easier

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[DunGen.Graph.GraphLine].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    DunGen.Graph.FlowLineReference.get_Line () (at Assets/DunGen/Code/DungeonFlowGraph/References.cs:41)
    DunGen.Tile.get_Line () (at Assets/DunGen/Code/Tile.cs:66)
    DunGen.DungeonGenerator.GenerateBranchPaths () (at Assets/DunGen/Code/DungeonGenerator.cs:543)
    DunGen.DungeonGenerator.InnerGenerate (Boolean isRetry) (at Assets/DunGen/Code/DungeonGenerator.cs:276)
    DunGen.DungeonGenerator.OuterGenerate () (at Assets/DunGen/Code/DungeonGenerator.cs:165)
    DunGen.DungeonGenerator.Generate () (at Assets/DunGen/Code/DungeonGenerator.cs:122)
    DunGen.RuntimeDungeon.Awake () (at Assets/DunGen/Code/RuntimeDungeon.cs:19)
    UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
    <LoadLevel>c__Iterator1C:MoveNext() (at Assets/CA/Scripts/LoadingNextLevel.cs:120)

     
    Last edited: Aug 28, 2015
  32. AlmightyGames

    AlmightyGames

    Joined:
    Jul 11, 2015
    Posts:
    21
    I've been dealing with the same error all day. What I have been doing to get through it is rather tedious. First, I'll pause the game, and fly around looking for anything that seems out of place. For my game, I might have some lights that were not on, or pipes in the wrong places. I noticed a bunch of PROXY rooms (instead of CLONES) which I found confusing at first. If I could find anything out of order, it at least helped me pinpoint where to look for the problems. Then, I'd stop the game, and take a look at the random piece where the problems resided.

    Check to see that the Prefab's position and rotation have been set to zeros. (That seemed to be one of the biggest causes for me) Also, I'd check the tilesets. Sometimes I would delete the room from my tileset's list, and add it again. But, most often, it was the rotation and location not set to zero.

    One of the reasons (I imagine) why you don't see this error throughout the first few floors of your generation is because DunGen doesn't experience it until it opens up the can of worms. In other words, the program creates the dungeon in a procedural way, starting from the beginning, and branching outwards. The first few rooms could be fine, but then DunGen discovers one bad Prefab, and things get weird. Perhaps the Prefab to blame never appears until the 5th floor.

    Hope this helps! :)
     
  33. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    Hey SquareForge, thanks for your help!

    I have actually had problems before with tile positioning etc as you mentioned but those should have been ironed out by now.

    With this problem, when I get the proxy rooms, it makes a active proxy copy of every single room in addition to a inactive clone so I couldn't narrow anything down like that. I never thought of deleting the rooms from the tileset and adding them again. That didn't work by itself but I took your idea further and deleted the all of the tilesets from the dungeon flows and then added them again as well and it seems to have fixed the problem for now! It may have been that both of those steps were needed.

    Thanks again!
     
    hopeful likes this.
  34. AlmightyGames

    AlmightyGames

    Joined:
    Jul 11, 2015
    Posts:
    21
    I must admit, I don't fully understand how I was able to fix my errors, but I thought sharing what I did about them might help. There definitely seems to be something weird with the tilesets tho.. I only experience these sorts of problems when I am changing things around in my existing rooms.

    Anyway... Cheers!

    Now... I'm hoping someone can help me understand Locked Doors and Keys.. ;)
     
  35. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    48
    the RecalculateBounds method doesn't correctly calculate the bounds for tiles with less than 4 doorways.

    heres a picture of a dungeon with debug information on:


    but when I comment out the CalculateBounds method in RecalculateBounds the dungeon looks like this:


    Both of these dungeons have been generated with the same seed, but they look completely different. So this bug also influences the dungeon layout.

    Edit: I might know what the cause of this is, I am building my tiles with Probuilder that might cause the wrong bounds calculations. However I am running a heavily modified version of DunGen (I have turned the methods in DungeonGenerator.cs into Coroutines so if the dungeon generation takes a long time it won't freeze the game) the cause of this can also be in the modified code. I will do more testing and will update this post afterwards.

    Edit 2: I tested it again with only the demo dungeon and it is definitely because the tiles are build with ProBuilder, since Probuilder generates the meshes when the prefab gets instantiated. So I just need to save the probuilder meshes to disk in order to solve this. But why are the bounds correctly generated in the preprocess stage but not when the prefab gets placed?
     
    Last edited: Aug 29, 2015
    hopeful likes this.
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Ok I found one issue with tile injection.

    Sometimes tile infection fails and it doesn't inject the tile I have asked.

    I can understand that sometimes, it may fail because of how dungen is working. But at least when it fails, it should return failure instead of complete so I can iterate until it has successfully generated.

    Please take look at this urgently because this is game breaking stuff for me.

    Thanks.

    - edit -

    This issue is very urgent so I tried to dig into the code, but it looks like validate code isn't checking anything related to tile injection. Perhaps code is assuming that tile injection always succeed?
     
    Last edited: Sep 1, 2015
  37. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I think I have similar problems using 2dtoolkit where meshes gets generated on instancing.

    The way I solved this bound issue is that I have manually placed dummy doors and modified code to double check the bounds using the dummy doors to make sure the bounds are all correct. I like this way because at least there is one way that I can make sure that the bounds can be correct. (and be corrected)
     
  38. Over00

    Over00

    Joined:
    May 23, 2013
    Posts:
    3
    I recently bought DunGen (amazing stuff btw) and was trying to figure a way to have multiple paths but then saw your reply from 2014 above.

    I'm still experimenting to find a way around this limitation though I was curious if you or anyone else had some tricks to share about this.

    My own tricks so far are:

    - Having big rooms with wall props that could give the impression it's actually more than one room.
    - Having many doors for each tiles which seems to help getting closer to at least the feeling there's more than one path.

    I don't actually need multiple distinct paths but the player must be given some choices. Something like go left or right but still end up at the same place anyway after. So any trick that can help with this would be welcomed.
     
  39. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    48
    If by multiple paths you mean that there are different paths to reach one goal tile, that would be quite difficult to implement with the current system, but if by multiple paths you mean there is more than 1 goal tile to reach than that is quite possible. You need to modify the code though. For example you could after the mainpath generation force the generator to create a second mainpath that starts from a randomly selected tile from the first mainpath.
     
  40. Over00

    Over00

    Joined:
    May 23, 2013
    Posts:
    3
    Haven't thought of that but I think this might actually work for my needs. I'll need to look into that.
     
  41. Over00

    Over00

    Joined:
    May 23, 2013
    Posts:
    3
    oh, just figured there was the connection chance I could play with as well. I made a quick test with a fairly small dungeon setting and using a squared tile with mostly just doors and I do get an effect close to what I'm looking for but it do takes a while to generate.
     
  42. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    622
    Sorry for the delayed response to a lot of these questions, I'll try to work through as many as I can now and I'll get through the rest as soon as possible.


    That could definitely come in handy; it's not something I can get done straight away but I'll add it to my list.

    I really need to buy ProBuilder so I can see exactly what it's doing because right now I have no idea why it doesn't play nicely with DunGen. I assume the bounds checking doesn't work when the prefab is placed because ProBuilder requires a special Instantiate method to be used.


    I've made some quick changes and released a new beta build (download link at the bottom of this post) that gives you the option to mark an injected tile as required.



    [NEW] Version 2.6.1 (Beta) - Download
    - Injected tiles can now be marked as required. If a required tile is not present at the end of the branch path stage, the generation will fail (and retry until the layout is successfully generated or until the maximum number of failed attempts is reached)
     
    hopeful likes this.
  43. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    This may be a silly question but could there be transition 'rooms' defined for when one tile is connected to another particular tile of set of tiles? I ask this so it could be made that normal dungeon flow be preserved but the dungeon be able to transition between quite different environments within one layout, I suppose this being particularly useful when blending between archetypes
     
  44. AlexSledge

    AlexSledge

    Joined:
    Nov 13, 2013
    Posts:
    17
    The site still shows 2.6.0(Beta) - I assume this is an oversight, or is 2.6.1(Beta) not posted yet?
     
  45. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    There's a small bug in the demo scene in 2.6 where if you press c to change the camera, the display becomes black and shows nothing.

    I fixed this by changing the starting Y pos of the player to 1 whereas previously it was 0. When it was 0, the player fell through the floor due to gravity and that explains why the camera just shows black.

    cheers

    Nalin
     
  46. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    BTW - when picking up the blue key I saw this error:

    Destroying GameObjects immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
    UnityEngine.Object.DestroyImmediate(Object)
    KeyPickup:OnTriggerEnter(Collider) (at Assets/DunGen/Demo/Scripts/KeyPickup.cs:33)
     
  47. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    I have a question! How could DunGen handle prefabs outside of the tile rooms? For instance, what if I have a floating island (which would have no walls) and I wanted to add some visuals such as floating rocks, but these rocks are outside of the tile bounds. Could prefabs outside of it be generated with the rooms as well? I don't need them to be randomized, just as long as they are visible along with the room tiles.
     
  48. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    I'm having problems setting the number of side paths in my generated dungeon. I've set the following parameters:
    • dungeon flow to have length of 8-10, and 0 connection chance
    • flow has one start tile, one end tile, and one archetype
    • dungeon archetype is set to branching depth 6-6, branch count 3-3, and straighten 1
    • archetype has one tile in the standard tileset, and one tile in the cap tileset
    Shouldn't this always give me exactly 3 branch end cap tiles?

    It doesn't. Upon generation, I get anywhere from 2-6 end cap tiles. How can this be?
     
  49. AlmightyGames

    AlmightyGames

    Joined:
    Jul 11, 2015
    Posts:
    21
    I ran into this problem myself, and after reading through most of the posts on this forum, I found the answer on page 6. I'll paste what I read here..

    AegonGames said:
    I tested 2000 seeds of the demo scene and you're absolutely right, not one of them had a branch depth greater than two even though the branching depth is set to 2-4.

    After looking through the code, I think I've found the problem. In DungeonGenerator.cs, in the GenerateBranchPaths function, you should see this line (around line 336):

    Code (csharp):
    1. branchCount = Mathf.Clamp(branchCount, 0, tile.Placement.UnusedDoorways.Count);
    If you comment it out so it looks like this:

    Code (csharp):
    1. //branchCount = Mathf.Clamp(branchCount, 0, tile.Placement.UnusedDoorways.Count);
    Things should work properly. It seems I was confusing branch count and branch depth and was capping the branch depth by the number of available doorways, which makes no sense. This bug must have been in DunGen since at least 2.0. Thanks for pointing it out, I'll get the fix submitted to the asset store as soon as possible.
     
    Dwight_P, hopeful and BackwoodsGaming like this.
  50. AlmightyGames

    AlmightyGames

    Joined:
    Jul 11, 2015
    Posts:
    21
    I should note this... In my game, I've created a multiplayer environment, where 8 players are randomly spawned into the game, and each spawn location is at the end cap of these randomly generated dungeons. It was crucial for the branching to ALWAYS produce at least 8 end caps every time a dungeon is generated for this reason. This was how I noticed that DunGen wasn't coming close to that, and I had to find answers. The solution I pasted above worked. I commented out the suggested line of code, and immediately, everything started working as intended.
     
    BackwoodsGaming likes this.