Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

DunGen - Procedural Dungeon Generation

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

  1. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi AegonGames, Can you please explain how to implement stairs?

    In my test scene, I dragged one of the doorways down on the Y axis and away from the room like so:

    $error2.jpg

    However, when I generate the dungeon, they seem to get all spread out:

    $error.jpg

    I'm probably doing something silly here, I'm just not sure what it is.
     
  2. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    [Solved]
    Ah I figured it out - I missed a vital step of the room editting/creation which was to set the parent object to the origin (0,0,0) before applying the change as instructed under the "Making a Tile" section
     
  3. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Glad you got it sorted. That's caused me quite a few problems as well.

    I'm not sure why Unity allows you to set the transform of a prefab, I can't think of a situation where you would ever want to do that. Seems like more trouble than it's worth to me.

    I'll see if I can get DunGen to completely ignore the prefabs' translation because it does cause a lot of confusion if you ever forget to reset it to (0,0,0).
     
  4. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Thanks Aegon! No worries on this one, I'm ok with setting the tiles to the origin for the time being.
     
  5. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Aegon, what's the best way to find out when the dungeon generation is complete? In my game, once the player gets to the goal, I teleport him back to the start, but I want to make sure that the game starts again only when the dungeon has finished generating.
     
  6. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    The DungeonGenerator class has an OnGenerationStatusChanged event that you can handle to do something at different stages in the generation.

    If you're using the RuntimeDungeon component, you can do something like this:

    Code (csharp):
    1.  
    2. private void Start()
    3. {
    4.     // Get the RuntimeDungeon component however you like
    5.     RuntimeDungeon runtime = Component.FindObjectOfType<RuntimeDungeon>();
    6.  
    7.     runtime.Generator.OnGenerationStatusChanged += MyHandlerFunction;
    8. }
    9.  
    10. private void MyHandlerFunction(DungeonGenerator generator, GenerationStatus status)
    11. {
    12.     if(status == GenerationStatus.Complete)
    13.     {
    14.         // Do stuff
    15.     }
    16. }
    17.  
    You can also use the same method to handle when DunGen fails to generate a dungeon.
     
  7. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Nice one thanks!
     
  8. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Version 2.2.0 was approved and is now available on the Asset Store.

    This is a smaller update than I would have liked. The main feature is an analysis tool used to auto-generate a set number of copies of your dungeon and provide detailed information on generation times, success rate, retry counts, etc. Hopefully this will help with spotting problems in the way a dungeon is set up (usage is explained in a new section at the end of the readme file).

    Other than that, there were two minor fixes:

    - You no longer need to set a tile prefab's position to (0, 0, 0) DunGen now just ignores the translation of your tiles - previously, this caused the tiles to be offset and appear in the wrong place in the dungeon.

    - The generation stats were being reset whenever a dungeon failed to generate which resulted in inaccurate timings (it only counted the time taken to generate the successful dungeon and didn't include the failed attempt(s) before that)


    Concave room collisions and portal culling were both supposed to be in this release but I didn't manage to get either working. I guess I just burned myself out on DunGen development so I'll be taking a short break before trying again. Obviously, I'll still be here to provide support, bug fixes and any quick additions that can be made to the code base.


    Also I'd like to mention that DunGen is going to be on sale next Saturday (24th May) for 50% off. So anyone who's considering buying it might want to hold off until then.
     
  9. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Nice one Aegon, we appreciate the hard work! Yeah definitely take a break dude esp. if you're burned out. It's better to come back refreshed!
     
  10. Wylaryzel

    Wylaryzel

    Joined:
    Sep 13, 2013
    Posts:
    126
    Thx for your work Aegon,

    will play around with the analysing tool as it will for sure help to find gaps in the design of the rooms :)

    And take the break needed to further update the dungeon generator - sometimes its better to leave a project and when coming back have a different eye on things :)

    With regards to portal culling I want to mention that I consider using DunGen for generating the overworld too - I'm still in the evaluation phase how to use it to make it work. There are some culling assets on the store already - I might end up buying one of those as it already include culling on dynamic created meshes. For sure, others may want have it already included.

    While you are off - I want to spend some ideas / topics I still have a grip around the handling of DunGen.
    1) I don't know the internals of the UnityEditor - but would it be possible to change the probability of using rooms in the archtype with percentages? Currently its very hard for myself to identify how likely a room will be choosen. Maybe it could be possible to create a node-based few with the rooms listed below including the percentages? Like the layout used for playmaker / behaivor tree? And move the length of the dungeon to the archtype and not using it in the DungeonFlow? Only as an idea.

    2) Would it be possible to change the DungeonFlow to a node-based info similar described above? like adding nodes of archtypes or dedicated Tiles and creating branches there as well?

    If you are interested to hear more, I may can make some programmer-style graphics?

    Thx for listening, and thx again for the cool asset.

    Wyl
     
  11. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Thanks for the support guys! I do really appreciate your comments feedback.

    Portal culling is something I'd like to have built-in if possible. Everything is already separated into rooms, and the rooms' bounding boxes and doorway positions sizes are known. DunGen pretty much has all the information needed (and the data structured correctly) to handle portal culling already. Since we already have all of this information, built-in portal culling should be more efficient than most general-purpose culling solutions available and would require no extra effort from the user. The problem comes from trying to clip a view frustum to a rectangle in world space. I've done it before in an engine I was building a year or two ago, I just can't seem to get my head around it this time for some reason.

    Of course, I'd implement some way to toggle the portal culling on tiles that aren't surrounded by walls so you can still use DunGen for outdoor zones.


    It might be possible to display the chance a room has of spawning in a given part of the dungeon more clearly. Although it gets a little complicated when archetypes can have multiple tile sets and each tile in a tile set has a different weight for main branch paths, I'll look into it and see what I can come up with.


    I chose to put the length into the dungeon flow so that you could more easily control the overall length of the dungeon. But I suppose I could put the length into the archetype and have an optional override on the dungeon flow. That way, you can pick whichever is more important to you for your project.

    I did want the dungeon flow to be more of a node graph than it is now but I ran into a couple of problems while developing it. This is a (really bad) sketch I threw together of what I would have liked the dungeon flow editor to be: (the branch line should be coming off one of the archetype nodes, not the line itself)
    $DungeonFlowSketch.png

    Is that kind of what you were thinking? I do still want to go in that direction if I can but it'll likely come in a major update further down the line since it would require breaking changes. I wasn't happy about peoples' dungeons made with v1 not being compatible with v2 but it's likely to be the case again if I do this. But it does streamline the process a lot if everything is just treated as a node on a graph. It'll also allow for a lot more customization than the current system.

    Bear in mind that it wouldn't be possible to make a circular connection though, DunGen just can't handle making a dungeon path between two pre-existing rooms.
     
  12. Wylaryzel

    Wylaryzel

    Joined:
    Sep 13, 2013
    Posts:
    126
    Hi,

    the rough flow pictured by you would be more or less exactly what I was meaning :) With regards to the circular connection I can't think of a need for my type of game - others may have different opinions on it.

    The further I think of the possibilities, the more I come to the conclusion that with some clever visualization the whole process to create a dungeon would be more intuitive. And it would open up some nice options like having an sort of overland map for the main-branch and the side-nodes could be some sort of dungeons :)

    With regards to breaking changes: As a user, as long as the basic requirements (ie the designed rooms) are staying as a basis, I personally wouldn't mind the needed changes - every little piece that makes the tool better is more than welcome.

    BR
    Wyl
     
  13. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Aegon, I started getting this error recently. I had a look at the underlying code, but wasn't sure where the problem was. Note that this error is caused when I use my own prefabs, your demo scene still works fine.
    $dungenerror22may.jpg
     
  14. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Hi,

    I haven't been able to reproduce this. Can you do something for me please?

    In the file "Assets/DunGen/Code/DungeonFlowGraph/References.cs", on line 42, can you replace this:

    Code (csharp):
    1. set { index = flow.Lines.IndexOf(value); }
    With this:
    Code (csharp):
    1. set
    2. {
    3.     if(flow == null)
    4.         Debug.LogError("Flow is NULL");
    5.     if(value == null)
    6.         Debug.LogError("Value is NULL");
    7.  
    8.     index = flow.Lines.IndexOf(value);
    9. }
    Then run it again and see what it says. Something isn't set properly there but I don't know if it's the value being passed in or the flow graph itself. I think it's most likely to be the flow graph that's null but I'd like to be sure before trying to fix something that might not even be broken :p

    Thanks

    EDIT: If it turns out that the flow is null, selecting the dungeon flow asset (so that the inspector shows up to configure it) should fix the references. You might need to make a change to one of the dungeon flows properties to force Unity to re-save the asset with fixed references.
     
    Last edited: May 22, 2014
  15. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Ah yes, you're quite right, the node range in one of my tilesets exceeded that of the total nodes specified in the main flow. Correcting this fixed the error, thanks!
     
  16. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    I'm definitely looking into picking this up, since the current generator I'm using isn't that great (good for corridors, but not good for rooms or placing objects). A few questions, though:

    1. How are the dungeons stored internally? Currently I've got a 2D map for the player that I build based of a list of walls, doors, etc. Is there a way to do something similar with this (list/array of different object types and their positions)?

    2. Any documentation? I tend to go code-spelunking quite often, as I generally have specific use-cases that I need to implement, which brings me to:

    3. Full source included?

    Thanks!
     
  17. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Just as a reminder, DunGen is on sale today for 50% off: Asset Store Page

    1. The dungeons are stored as four lists: one containing all tiles, another for just main path tiles, one for branch path tiles and another for all of the doorway connections. It's also stored in graph form so you can easily deal with anything related to how the tiles are connected.

    2. The readme file is available here. It's very wordy though, I need to redo it at some point, and preferably make some videos.

    3. Yeah, full source is included although the level of "commented-ness" varies quite a bit. That's something else I'm looking to improve upon.
     
  18. dorukai

    dorukai

    Joined:
    Apr 16, 2014
    Posts:
    6
    This is looking great!

    Will it work ok with Unity's new 2D stuff?

     
  19. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Yeah, it should work fine in 2D. I haven't tested it but I see no reason why it wouldn't work.
     
  20. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hello,

    This asset looks great. I noticed in the documentation that you can generate levels in editor, so does this mean I can generate a level and customize it by hand, bake a nav mesh, and basically just treat it like a regular unity level once it is generated?

    Thanks
     
  21. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Yes, that's exactly how it works.
     
  22. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Nice. Pretty sure I am going to get this.
     
  23. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Awesome, thanks for answering my questions. A couple more before I buy, if you don't mind:

    1. Currently, I've got ladders that I place inside of rooms to get from floor to floor. It seems like with this, I can only have exits/stairs at the edges of rooms. Is it possible to have rooms "stacked" on top of each other and use a ladder to connect them? Likewise, would it be possible to have the stairs inside of a room leading up to the next floor?

    2. As for how dungeons are stored, is it possible to distinguish between floors for multi-floor dungeons (e.g. if I wanted a list of all tiles on the second floor)?

    3. Is it possible to weight how room-heavy or corridor-heavy the dungeons are? i.e. If I wanted a dungeon packed with rooms, or a dungeon that's sparse with a lot of corridors instead.

    Thanks! I'm extremely tempted, but I wanted to check if most of my use-cases are covered, since the last generator I used didn't really work.
     
  24. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    1. I was going to say that this is possible but decided to check just to be sure. I'm glad I did since having doorways on the top/bottom of a room actually doesn't work. I was quite sure it did before - so maybe I broke it at some point. So right now, the only way you could achieve ladders is to have your stacked rooms actually only being a single, tall room with a ladder taking you to the top half, where you can have doorways leading out as usual. Sorry.

    2. Unfortunately, since rooms can be arbitrarily sized, it's impossible to distinguish between floors. If you have rooms of a uniform height, it wouldn't be too difficult to write your own logic for this in a post-process step however.

    3. Yes. Within TileSets, you can specify the weight of each tile, so you could just give room tiles a higher weight and they would appear more frequently. There's also the option for separate weight values for if the tile is on the main or branch path, as well as a depth scale to control how a Tile's weighting changes based on how deep in the dungeon it is.

    Hope that helps!
     
  25. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Ah, alright. Doing it as a double-tall room with a doorway at the top and bottom and a ladder connecting it sounds fine. Does that work alright, though? It won't break the generation or have rooms overlap since it's technically 2 rooms being counted as 1? Also, any chance of having doorways on the top/bottom of rooms being a feature at some point?

    That doesn't sound too difficult to do height-checking, except with the aforementioned double-tall rooms needing to be split. (Actually, could just have a rectangle trigger fit to the size of each floor and do bounds/intersection checking)

    That sounds perfect.

    It definitely has! Thanks for being so quick to respond!
     
  26. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Web Demo 3 (found here) uses double-tall rooms with stairs so it should work fine. If doorways on the top/bottom of rooms is something I can get working without changing half the code of DunGen, I'll do it. No guarantees on when that'll be though I'm afraid.
     
  27. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    So I bought the asset, and so far so good. Pretty much a 5 star asset, I think it is going to be incredibly useful!


    The only thing I have to complain about, I am a bit disappointed that only one of the demos is included in the package. In the long run, not such a big deal, but it would be nice to have more example to poke around with (especially stairs) "out of the box".

    Other then that, for what it does it seems to be just about perfect.

    Cheers!
     
  28. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Yeah, sorry about that. The other two demos are from before DunGen v2, which was a complete re-write of the original, so those demos just aren't compatible with the new version and I haven't got around to porting them over yet.
     
    Last edited: May 24, 2014
  29. ChaneDev

    ChaneDev

    Joined:
    Feb 12, 2013
    Posts:
    66
    Hi, thanks for the package. I was following along through the documentation and when I get to the part where I open the dungeon flow I get this:

    NullReferenceException: Object reference not set to an instance of an object
    DunGen.Editor.Inspectors.GraphObjectInspector.DrawKeys (DunGen.KeyManager manager, System.Collections.Generic.List`1 keyIDs, System.Collections.Generic.List`1 lockIDs, Boolean isNode) (at Assets/DunGen/Code/Editor/Inspectors/GraphObjectInspector.cs:61)
    DunGen.Editor.Inspectors.GraphObjectInspector.DrawLineGUI (DunGen.Graph.GraphLine line) (at Assets/DunGen/Code/Editor/Inspectors/GraphObjectInspector.cs:56)
    DunGen.Editor.Inspectors.GraphObjectInspector.OnInspectorGUI () (at Assets/DunGen/Code/Editor/Inspectors/GraphObjectInspector.cs:24)
    UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/Inspector/InspectorWindow.cs:850)
    UnityEditor.DockArea:OnGUI()

    I don't have a key manager assigned (don't need it for my levels).
     
  30. iKronos

    iKronos

    Joined:
    Sep 1, 2012
    Posts:
    14
    Hi AegonGames-Team,
    I bought the DunGen today. This product is really impressive.
    But I missing more demos in order to understand how the product is working, can you share the "web demo 2"?
    Many thanks in advance.
     
  31. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Thanks for reporting, I'll fix it now. In the meantime, you should be able to create and assign a blank key manager just to stop the error from showing.


    I'll have to port the other two demos over from DunGen version 1. I'll make them available as soon as possible but I have a lot of other stuff that I have to deal with right now.
     
  32. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Awesome, thanks! Purchased.
     
  33. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Aegon, is there a way in which I can reload a dungeon at runtime, but with a different dungeon flow?
     
  34. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    So you just want to change the dungeon flow that's being used at runtime? Something like this?

    Code (csharp):
    1.  
    2. // Get the generator however you like
    3. var generator = Component.FindObjectOfType<RuntimeDungeon>().Generator;
    4.  
    5. generator.DungeonFlow = Resources.Load<DungeonFlow>("New DungeonFlow");
    6. generator.RandomizeSeed(); // You can leave this line out if you want to keep the same seed
    7. generator.Generate();
    8.  
    Just remember that any asset loaded at runtime using Resources.Load needs to be in a "Resources" folder or Unity won't load it. Also, the asset name ("New DungeonFlow" in the above example) is relative to any folder named "Resources".
     
  35. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    I'd like to point out the issues that I'm aware of right now and let you all know what's being done:

    - [Fixed in 2.2.1] Error messages when selecting a line or node in the dungeon flow graph while you don't have a key manager assigned. This is fixed now but until it becomes available, you can work around the error by creating and assigning an empty key manager asset.

    - [Fixed in 2.2.1] Error messages when trying to utilize multiple doorway socket types. I thought this was just a problem with doorways on the top/bottom of a room but it seems to be across the board. I'm working on a fix for this now.

    - [Fixed in 2.2.1] Error messages when archetypes/tilesets haven't been applied to lines/nodes in the dungeon flow. This should be an error but I've added more helpful error messages so it's easier to see what's gone wrong.

    - Some people want the two other demos (web player demos 2 3 from the OP) included in DunGen. These demos were made in version 1, before the complete re-write so they're incompatible with the current version of DunGen. It'll take some time to port them over. Also, I might not be able to make demo 2 available at all - the assets used were made in a student version of 3ds Max (which means commercial use is not allowed) and I'm unsure about the legality of including them in a paid product, even if they're only part of a demo scene.

    - [Fixed in 2.2.1] Some of the object fields in the inspector (for things like doorways) won't accept certain objects, specifically, objects that used to be part of a prefab. This is an error with the way I'm filtering which objects can be placed in certain slots. This is fixed and ready for release.

    - [Fixed in 2.2.1] Some of the links on the asset store page don't work. This is fixed and pending review by Unity. The broken links point to information that can be found in the "Limitations" section of the readme file (can be found here or in the DunGen package).

    I'll be releasing a bug fix version as soon as I've dealt with all the issues. If anyone finds any more bugs, please post them here or send me an email at dan@aegongames.com. Thanks!
     
    Last edited: May 25, 2014
  36. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Yes that is what I'd like to do. Strangely, using the code will return an error that the namespace name 'DungeonFlow' could not be found?
     
  37. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Oops, DungeonFlow is in a separate namespace. Try including this at the top of the script:

    Code (csharp):
    1. using DunGen.Graph;
     
  38. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    That worked perfectly - Thanks! :D
     
  39. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    The bug fixes are ready in DunGen version 2.2.1, which is currently pending review by Unity. Here's the changelog:


    If you would like access to the bug fixes sooner, you can get the new version here. If the form doesn't work, send me an e-mail at dan@aegongames.com with your invoice number and I'll send you the new version manually.

    If anyone is still having errors with the new version, please post here or contact me at the aforementioned e-mail address. Thanks!
     
    Last edited: May 25, 2014
  40. iKronos

    iKronos

    Joined:
    Sep 1, 2012
    Posts:
    14
    Hi,
    regarding the web demo 2, no problem, if you provide simmilar demo with stairs and different floors then I can imagine the steps to reproduce similar levels.
    Perfect would be also a short tutorial with all steps for Dungeon flow Editor.

    Many thanks.
     
  41. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Aegon, is there a way currently of creating a single door in a connecting doorway between rooms? I could create a door currently for each doorway, but that will mean I'd have 2 sets of doors between each room which looks weird. It's not a critical problem, more of a nice to have.
     
  42. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Aegon, sorry to spam you with questions, but what are the upper limits for objects per dungeon?

    I've created a few tiles with possibly 10-20 props under it, and DunGen seems to have trouble generating dungeons greater than 8-10 rooms in the main path.
     
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,

    I am making a game that takes place within a cave complex, but I am looking a 'room' based generation because I want the cave to be made out of large tiles like 10x10 meters that can be modeled with care. So DunGen look great in that part.

    As far as I understand, your generation works in an expansive way, but is it possible for the generator to interconnect new modules to existing placed modules, so that 'loops' can be created at some points?

    If you want more clarification as of what I mean, please ask.
     
    Last edited: May 26, 2014
  44. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    I'll try to get a demo scene up that has some stairs as soon as possible. Although conceptually, it's no different than any other room. In the web demos, I just had a room that was twice as tall as the others and placed a doorway at the top of the stairs. The same way I usually would, just further up the wall.

    With regards to the tutorial, I'd like the whole of the documentation to be shorter. At some point, I'll be re-writing it and possibly splitting it into separate tutorial-style sections. Video tutorials could also be a possibility if I can get some recording equipment.

    There's no built-in way to do it unfortunately. I'll add it to my list of things to look into for future versions.

    Does it just fail to generate a dungeon with more rooms (DunGen gives you an error if it fails to generate a layout)? The number of props in a room shouldn't have any effect on how likely DunGen is to successfully generate a layout.


    Unfortunately, due to the way DunGen works and the fact that no restrictions are imposed on tile size or doorway placement, DunGen can't connect between existing rooms and I don't think it would be possible to implement it in a reliable fashion.
     
  45. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Yeah I wouldn't think it would depend on the props in the tile, but for some reason as soon as I increase the main path size, it fails 90% of the time.

    Are there any other things aside from the gameobjects under the tiles which could be causing the failure? I have checked to make sure that none of the props extend beyond the borders of the walls.

    EDIT: I just checked this again, and a dungeon with under 8 rooms seems to work ok, any more and it will fail to generate. I just limited the archetype to a single room with lots of props under it as well.

     
    Last edited: May 26, 2014
  46. Matt_S3E

    Matt_S3E

    Joined:
    Apr 27, 2014
    Posts:
    7
    Hi, I've created some custom tiles and when I generate a dungeon I get a number of _PROXY items appear. Any idea with whats going on?
     
  47. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Eyehawk, I'm looking into this right now and doing some tests, I'll post back here as soon as I'm done.


    You'll be getting some kind of error. The _PORXY items are used in place of the actual rooms when checking for intersections since it's much faster to move them around than moving the room itself and all of its children. When an error occurs, DunGen doesn't finish generating the dungeon, and so doesn't have a chance to clean up these proxy objects - you can safely delete them yourself though.

    Can you post the error message you're getting please?
     
    Last edited: May 26, 2014
  48. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Ok, so I just ran a couple of tests and so far, haven't been able to reproduce this problem. I tested with a single room (square with four doorways) with few props in it and another, otherwise identical room with more props. I also repeated the test with a simple corridor in the tileset as well as the aforementioned room (because having only a single, square room was actually increasing the failure rate).

    I also ran all of these tests twice, once using the analyser and once manually (just incase the results were skewed since the analyser doesn't place props). The analyser results will be slightly more accurate due to the higher iteration count.

    This is what the room looks like in both its sparse and heavily populated forms:
    $TestRoomComparison.png

    I ran these tests using the default value of 20 for the maximum number of failed attempts. The archetype used has the default values set for branching (branching depth: 2-4, branch count: 0-2) and the dungeon flow has a length of 20-100.


    Success rates - using the analyser (100 iterations)

    Single room, low prop count: 43%
    Single room, high prop count: 38%

    Multi-room, low prop count: 97%
    Multi-room, high prop count: 97%


    Success rates - calculated manually (20 iterations)

    Single room, low prop count: 35%
    Single room, high prop count: 45%

    Multi-room, low prop count: 93%
    Multi-room, high prop count: 100%


    So, at least from my tests, it doesn't look like props have any affect on the generation success rate. I also appear to have a much lower failure rate even with dungeons up to 80+ tiles in length. I'd expect the failure rate to increase with longer dungeons because with more tiles, there's a higher chance of the dungeon cutting itself off, but I wouldn't expect the kind of failure rates you're seeing with such a small dungeon path.


    By far the biggest factors in the success rate of a dungeon seem to be:

    - The number of doorways. More doorways = more ways out of a bad situation.
    - The variety in room shapes. Just adding a simple corridor to the above tests, even though it had fewer doorways, improved the success rate significantly.


    Anyway, I'll continue to look into it and see what I come up with.
     
  49. Petethegoat

    Petethegoat

    Joined:
    Jun 12, 2013
    Posts:
    39
    The new version resolves all my issues, thank you.

    Would it be possible to add a way to prevent certain tiles from being used to end branches?
    For example you might want to prevent branches from ending in corridor or ladder tiles, or force them to end in a room tile.
     
  50. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    621
    Glad to hear it!

    That's something I could possibly add. Perhaps the archetype could have an extra (optional) list of TileSets for the tile at the end of a branch in addition to the list it has now.

    Although it might be a little more difficult to implement than I first thought since branches can be considered "good enough" by DunGen even if they don't reach their target depth. This means that DunGen doesn't know what the last tile in a branch is going to be until it happens.

    Still, I'll add it to my todo list.


    EDIT: Speaking of my todo list, I've put up a public list of what I'm planning and what I'm currently working on. These can be commented and voted on if you're logged in. If I've missed anything, please let me know.
     
    Last edited: May 26, 2014