Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

DunGen - Procedural Dungeon Generation

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

  1. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    484
    True, but us college students can't really spend that much from our monthly allowance ;P
    (I prefer if I could stay out of the student loans, thats why we do part time too!)

    I know we are the minority, but we can dream too can't we? x)

    And I am only asking of plans for sale.
    If he had any.

    Probably I can save a bit of my savings of it goes on sale, if not, well..
     
    Last edited: Feb 28, 2015
  2. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    I'd love for DunGen to be on sale again. I've filled in the form, but it's up to Unity to decide when/if it goes on sale now.

    I can manually drop the price but I'd rather not since I wouldn't have much control over sale duration (even changes to metadata such as price has to be approved by Unity first, which can take several days) and I'm not sure how that would interact if Unity decided to put it on sale during that time - I'm fine with a sale for 66% off (what I've set now); not too crazy about ~90% off :p
     
    Gekigengar likes this.
  3. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,294
    Unity can and will put an asset on 24-hour sale using the price that's posted, not the regular everyday price. I've seen publisher discounted items (50% off in one case) go on an additional 24-hour sale (for another 50% off) twice in the last couple of months.

    So publishers do have to be careful when putting their assets on sale.
     
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    484
    That's a wonderful news!
    I will definitely purchase it this time when it goes to sale!

    Cheers! :D:D
     
  5. bigdaddio

    bigdaddio

    Joined:
    May 18, 2009
    Posts:
    219
    I have been using this for 2D in a pretty major project. It works really well. The only time I have really had an issue was my error. You basically build your room tiles the exact same way except using 2D assets instead of 3D. Also need to rotate doors 90 degrees dependent on which way they are facing.
     
  6. Mikeedee

    Mikeedee

    Joined:
    Jan 5, 2015
    Posts:
    42
    One question, is it possible to generate Diablo/torchlight-like outdoor maps with Dungen ?
     
    Last edited: Mar 10, 2015
  7. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    Not in the way Diablo does it, since they use a lot of manually placed tiles. I haven't used DunGen for any outdoor areas, but here's how I'd do it:

    1. Make several large, square patches of land
    2. Add a doorway to each edge as well as some way to block progress in that direction (e.g. a cliff face)
    3. Use the "Add when NOT in use" list on each doorway so that the cliff face is removed when another tile is attached at this point
     
    Alverik likes this.
  8. Mikeedee

    Mikeedee

    Joined:
    Jan 5, 2015
    Posts:
    42
    Sounds simple enough :) Thanks !
     
  9. Ariedhan

    Ariedhan

    Joined:
    Mar 11, 2015
    Posts:
    3
    Hello Everyone!

    Dan, thank you very much for this Asset it has helped me a lot with my game.

    I am finding an issue with Unity 5. When creating a 2D Dungeon a lot of errors appear:

    curveT >= m_Curve[lhs].time && curveT <= m_Curve[rhs].time
    UnityEngine.AnimationCurve:Evaluate(Single)
    DunGen.GameObjectChance:GetWeight(Boolean, Single) (at Assets/DunGen/Code/GameObjectChanceTable.cs:49)
    DunGen.<GetRandom>c__AnonStoreyA:<>m__20(GameObjectChance) (at Assets/DunGen/Code/GameObjectChanceTable.cs:99)
    System.Linq.Enumerable:Sum(IEnumerable`1)
    DunGen.GameObjectChanceTable:GetRandom(Random, Boolean, Single, GameObject, Boolean, Boolean) (at Assets/DunGen/Code/GameObjectChanceTable.cs:99)
    DunGen.DungeonGenerator:AddTile(Tile, IList`1, Single, DungeonArchetype, Boolean) (at Assets/DunGen/Code/DungeonGenerator.cs:420)
    DunGen.DungeonGenerator:GenerateBranchPaths() (at Assets/DunGen/Code/DungeonGenerator.cs:371)
    DunGen.DungeonGenerator:InnerGenerate(Boolean) (at Assets/DunGen/Code/DungeonGenerator.cs:196)
    DunGen.DungeonGenerator:OuterGenerate() (at Assets/DunGen/Code/DungeonGenerator.cs:101)
    DunGen.DungeonGenerator:Generate() (at Assets/DunGen/Code/DungeonGenerator.cs:81)


    It also happens with the 2D Demo Scene which is unplayable (3D seems to be working fine).

    Also, about the multiple keys' locks feature added in 2.5.2. Do you mean that the player will the specified amount of keys to open the lock or that any of the spawned keys will open it?

    Thanks!
     
  10. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    The errors you're getting were caused by some faulty logic when calculating the normalized path depth for tiles on a branch path. Oddly enough, this must have been wrong the whole time, but Unity 4 didn't throw errors.

    Anyway, the new beta build should work (for both Unity 4 & 5):

    Version 2.5.3 (Beta)
    - Download
    - DunGen should no longer try to apply a lock to the same door twice, causing an exception to be thrown
    - Doorways with no possible "locked door prefab" will no longer be considered when adding locks
    - In-editor dungeons will once again generate correctly
    - Dungeons should now be generated in the local coordinate space of it's root GameObject, rather than at the world-space origin
    - [NEW] Minor changes to make the demo scene compatible with Unity 5.0
    - [NEW] Fixed a divide-by-zero error when calculating a branch tile's NormalizedPathDepth, resulting in errors in Unity 5


    My intention was that any of the spawned keys would work on the lock but since DunGen doesn't actually handle the unlocking of doors (how that's done varies from game to game), it's really up to you how it's handled.
     
  11. Ariedhan

    Ariedhan

    Joined:
    Mar 11, 2015
    Posts:
    3
    Thanks for the fast responde the new Beta Build works wonders!

    That makes sense, I can just ask the door to open with certain amount of keys.

    Cheers!

    Adrian
     
  12. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,294
    Any idea how long will 2.5.3 be kept in beta before moving to the store as an update?
     
  13. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    Not long at all. There isn't much in 2.5.3 that could introduce new bugs, it seems stable. I'll probably submit it tomorrow assuming I don't find anything wrong with it by then so it'll be on the Asset Store as soon as Unity approves it (a few days usually).
     
    Mikeedee and hopeful like this.
  14. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    364
    Hi!

    I just have a simple question. Is it possible to make a room that only has one entrance? If I do put just one entrance it just gives me an error. If it isn't possible at the moment, it would be great if you could add something like that! My game is depending on random generation and "one entrance rooms".

    EDIT: This keeps happening. A simple room is overlapping with my start hall. If you could also help me fix this it would be awesome!

     
    Last edited: Mar 15, 2015
  15. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    You can use rooms with a single entrance, but only if they're contained in TileSets used exclusively for start & goal nodes, and for branch caps. DunGen will throw an error if you try to use a one-entrance room in an Archetype, since a room with a single entry-point effectively breaks the path once it's placed.

    For the overlapping issue: could you select the dungeon's root object in the hierarchy please? This will draw a red bounding box around all of the rooms and let you see if any of them are being calculated incorrectly.
     
  16. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    364
    I fixed the single entrance problem and I highly suggest you could add/"advertise" this solution. It is all in the spoiler if you are interested. It is also very simple.

    1. In the DoorwaySocket.cs script add a new socket called "NoConnect" or something like that.
    2. Go down to the IsMatchingSocket and replace the code...
    Code (CSharp):
    1. return a == b;
    with...
    Code (CSharp):
    1. if (a == DoorwaySocketType.NoConnect && b == DoorwaySocketType.NoConnect)
    2. {
    3.        return false;
    4. }
    5. else
    6. {
    7.       return a == b;
    8. }
    3. Go to the room you want to only have one entrance and select the door you want to have as entrance.
    4. Make several doors so the whole room gets the red box and set all those door's socket group to NoConnect.

    Now the doors with NoConnect shouldn't never connect to anything and just set the "Add when not in use" object there.
    :)

    Now for the overlapping part. Since I edited a bit of the code to fix some issues I have I can very rarely get a overlap but it happens. But these are the tiles I have had most problems with.

    Start hall


    A basic room

    BUT I got a idea what I can do to fix the problem. I'll add "fake doorways". The doorways will just be used to fill out the whole area. As of what I've seen it makes a box that connects to the doorways. So if I place 4 for a simple room it would fix it. The fake doorways would use the previous solution as I mentioned before.
     
  17. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    What version of DunGen are you using? There have been some bounding-box problems in the past but they should have been fixed in 2.5.2.
     
  18. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    364
    I am using 2.5.0. I haven't really felt like updating because I've had some nasty problems with updating assets before so I am afraid it would break some of the extra work I've done.
     
  19. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    484
    Any date about the sales?
    I have been revisiting DunGen asset store and thread everyday since then :p
     
  20. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    Nope, sorry. I filled in the form months ago, but Unity decides when it goes on sale; it could be tomorrow, three months from now, or never. Last time it went on sale, they didn't even tell me.

    I'm considering manually lowering the price for a few days, but I haven't made a firm decision on that just yet.
     
  21. PhantomThom

    PhantomThom

    Joined:
    Nov 22, 2014
    Posts:
    6
    Branch Depth and Branch Count seem to have issues.

    Logically by name one would assume:
    Branch Depth - controls the number of tiles in a branch
    Branch Count - controls the amount of branches that appear along a main path
    And maybe an additional parameter:
    Branch Options - controls the amount of branches that can originate from a single tile with more than one door

    The documentation says:
    Branch Depth - Two values the represent the min/max depth of any branches (assuming by depth you mean the amount of tiles in a branch). Confusingly it then says this setting also determines how many branches there will be.

    Branch Count - Two values representing the min/max number of branches that
    can come off a single tile (can't tell if this even works but seems more like an option after deciding how many branches you would like to see in total).

    But in actuality these do completely different things:
    Branch Depth - currently does nothing
    Branch Count - determines the amount of tiles in any given branch (isn't this Branch Depth?) (In the function GenerateBranchPaths in DungeonGenerator.cs, it seems branchCount is being used to control the number of tiles added to each branch, and isn't being referenced anywhere else.)
     
  22. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    Oops, looks like I forgot the second for-loop to handle Branch Count (and then misused the BranchCount number for the depth). I've fixed that in the new build - thanks for reporting it.

    Branch Count controls the number of branches that can come off a Tile rather than the total number of branched along the main path. It would be tricky to set the number of branches along the main path since they'd all be coming off different rooms (and even from different discrete segments of the path). I'll look into added an option for this in the future though.

    For the new version, I've also changed the documentation so that the line "The minimum and maximum branching depth can both be set to zero to produce a dungeon with only a single route with no branching if you prefer." is now referring to the Branch Count (I assume that was the confusing part you mentioned). Technically, it's true of both the branch count and depth, but it makes more sense to refer to the branch count.

    Version 2.5.3 (Beta) - Download [Also submitted to the Asset Store, awaiting approval]
    - DunGen should no longer try to apply a lock to the same door twice, causing an exception to be thrown
    - Doorways with no possible "locked door prefab" will no longer be considered when adding locks
    - In-editor dungeons will once again generate correctly
    - Dungeons should now be generated in the local coordinate space of it's root GameObject, rather than at the world-space origin
    - Minor changes to make the demo scene compatible with Unity 5.0
    - Fixed a divide-by-zero error when calculating a branch tile's NormalizedPathDepth, resulting in errors in Unity 5
    - [NEW] An archetype's "Branch Count" and "Branching Depth" variables should now work as intended

    WARNING: Updating to this new build could drastically change the appearance of your dungeons. You may need to tweak your archetypes' branch count and depth variables to get the results you want.
     
    hopeful likes this.
  23. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    I've added a new web demo showing a fully-furnished 3D dungeon with multiple floors using art assets from 3DForge's Village Interiors Kit; also using SECTR VIS for culling. I've basically taken one of the demo scenes included in the kit, cut the rooms out into individual prefabs, and added doorways so that DunGen can piece them together.

    Obviously, I can't include the demo in DunGen but it's nice to finally be able to show what it was made for.


    EDIT:
    If you have DunGen & Village Interiors Kit, you can download the demo package from here. Here are the steps for getting it to work:

    1. Create a new Unity 5 project (I made the demo scene in 5.0 so it won't work in anything lower)
    2. Import packages for DunGen & Village Interiors Kit
    3. Import the KeepDemo package you just downloaded

    If you own SECTR VIS as well, you can enable that in the demo (due to there being many objects created at runtime, the demo can be a little sluggish without proper culling)

    1. Import SECTR VIS package
    2. Add a SECTR Culling Camera component to the "Player Camera" GameObject
    3. Follow the instructions in the "SECTR VIS Integration" section of the readme file
     
    Last edited: Jun 24, 2017
    Steve-Tack and SecretStudio like this.
  24. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Wow what a fantastic demo! Is there a way for you to distribute the demo to people who own all the assets?
     
    SecretStudio and Tortyfoo like this.
  25. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    I've edited my post to contain a download link and instructions for getting the Keep Demo. I really wasn't expecting to release it so I had to re-arrange a few things to make it work as a package, hopefully everything is working. For the same reason, there are no comments in the scripts so things are a little messy; I might go back and clean things up later.

    I'm afraid there's not much to learn about how to set up dungeons though, the demo uses a layout that's about as simple as it can possibly be (and there's no use of props); it was really just for promotional purposes since I didn't have a web demo with actual art.
     
    eridani and SecretStudio like this.
  26. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Wow, thanks for posting the full demo. I happen to own all three assets (DunGen, Village Interiors, and SECTR VIS), so I followed the instructions and it worked perfectly.
     
  27. SirGive

    SirGive

    Joined:
    Sep 27, 2010
    Posts:
    384
    Got this and started playing with it. Really like it so far. Glad you've fixed the NaN issue, that was getting to be annoying. I did find an issue with a Destroy call vs DestroyImmediate - inside Dungeon, RemoveTile(). I am assuming this has to do with retries? Most likely not an issue for in game generation, but it does leave straggling pieces behind for editor generation. Don't have the latest, so you might have fixed it.

    I would like to mention that we had our initial models imported a a bad angle, so we had the prefabs rotated to counter this. Doors were children of that badly imported object and had weird rotations to fit in correctly. When generating the dungeon, all positioning and rotation was really crazy. Ofc, I agree this is bad practice for art exports and should not be done this way. I was able to fix it by rotating everything under a parent GO. ;) Not sure if that's something you want to consider or deem a configuration issue.

    I do have a question, though. Is there a way to specify connection room types to prevent dead end corridors? Maybe I should extend the door type enum. I currently have the archtype set like so and it somewhat works :

    Wanted to see if there was a better way to do this.

    Great tool! Really glad on the buy
     

    Attached Files:

    Last edited: Apr 10, 2015
  28. nitoh

    nitoh

    Joined:
    Mar 20, 2014
    Posts:
    29
    Hello Everyone!
    Before purchasing, i have a question:
    Is it possible to create an infinite dungeon? Something like: the Goal tile would have 2 doors: Enter( it is already exist) and an exit. but there is no dungeon connected to this exit, until you reach the goal tile. when you enter the room, thats when it generates the new dungeon, that connects to this exit.
    Is it possible? If yes, a little guidemark, or a few idea how to do it, would be nice!
    Thank you for your answer!
     
  29. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    176
    Hi, i think that's what the Branch-Cap Tile Sets are for.

    You can generate an infinite amount of dungeons at runtime, though you have to do the transition between them yourself.
     
  30. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,294
    Making an infinite dungeon is not available out of the box, but now that you can specify the starting coordinates for each dungeon generation, so long as you can properly tell DunGen where to make the new room(s) it sounds like you can do it. Of course, you'll have to have code to destroy old rooms and to make sure new dungeon layouts don't intersect with any old ones still around.

    (Prior to the most recent update, DunGen would always make new dungeons at 0,0,0.)

    If in addition to a starting point we could also specify a volume in which DunGen could build, it would probably ease concerns about new dungeons overlapping old ones. But no such constraint exists yet.
     
  31. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    176
    The fun thing is that DunGen does that already, if u already have a dungeon and generate a new one, its gets generated into the free space, with just the start room overlapping. :)
    It was once the last, easy resort to double or even triple the dungeon size if you needed to. However with recent changes you can have pretty large dungeons, much larger then it makes sense for a level to be played.
     
    Last edited: Apr 11, 2015
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,294
    Well, maybe it is better to say that if you have in your mind that you need each dungeon to lay itself out in a way that does not overlap with previous ones, it may not be the case. Let's say your end room after one or two iterations turns out to be in a pocket. How does the next dungeon attach to it and get laid out?

    If I'm misunderstanding the situation I'm happy to be corrected, as I'd like to use multiple dungeons together myself.

    My thinking is that with being able to set a new origin, I can move each starting point away from each other and transition players from one to the next via "elevator" or "teleporter" mechanisms. You mentioned this before, and that will work for me, but if you don't use teleporting type transitions, I'm not sure you can build new dungeons right on the end of old ones.
     
  33. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    I wasn't able to find any uses of Destroy() in DunGen, it looks like everywhere should be using DestroyImmediate() now. Have you been using the most recent version?


    I don't think there's much that can be done about that. Odd-angled tiles won't generate a proper axis-aligned bounding box so their collisions will be off.

    For the weird positioning/rotation: I'm using a new method for aligning doorways in the new beta build that I'm hoping will fix any remaining issues with DunGen's tile placement. Originally, it was a bit of a hack since transformations & quaternion maths confuse the hell out of me; this new method took me the better part of two hours to get right but it should be capable of aligning any arbitrary object with another by their sockets, regardless of position/rotation/scale (Note: This doesn't mean that doorways can be placed off the AABB yet though).


    The best way to do this right now is as Binary42 says: use the branch-cap functionality. It's not a great solution (and the branch-cap list was originally meant for something else), but it's the best option for now.


    As Binary42 and hopeful have said, infinite dungeons aren't possible out of the box. Depending on how you want it to work, you might be able to implement it yourself but if you want it to be seamless, it's going to be very tricky to do.


    On that note, here's the new beta build:

    Version 2.5.4 (Beta) - Download
    - DunGen is using a new method for socketing doorways together which is more robust. Doorways can now be aligned vertically (for stairwells, for example)
    - The DungeonGenerator class now has a DetachDungeon method allowing you to "tear-off" the dungeon from the generator so that it is not overwritten next time Generate() is called
    - [EXPERIMENTAL] The DungeonGenerator class now has a GenerateAppended method which will generate a new dungeon appended to a previous dungeon that you specify. NOTE: This is entirely experimental and NOT supported functionality; dungeons generated in this manner will likely overlap or fail depending on whether allowIntersection is set. You'll have to decide how/if this is handled when it occurs. This is mostly in place as a starting point for those of you who want to implement infinite dungeons - but it needs additional logic (likely game-specific) to work as a complete solution.
     
    Last edited: Apr 12, 2015
    hopeful likes this.
  34. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,294
    Does anyone have experience with using DunGen to make maps that move upward or downward?

    I'm thinking of something like where you're heading ever downward into the abyss, or maybe you've already been in the abyss and you're trying to head up and out.
     
  35. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    176
    All you have to make sure is that the start and end room are at the dungeons extends. The dungeon generation has a direction, that is where the door of your starting room is pointing to. All generated tiles will be in that direction and will never reach behind that start tile (unless some ridiculous branching depth). And it is also possible to tweak the flow so nothing reaches behind the end room.

    So your start and end rooms will be at the dungeons extend's, from there you can treat each dungeon like a tile with 2 doors.

    [BRAKING POST] Ah well thanks Dan! :)

    The way i do it, is having the last dungeons end tile look like the next dungeons start tile (actually it looks like two rooms).
    When the player enters Room2 the old Dungeon gets destroyed and the new one gets generated, if he goes back to Room1 the old one gets regenerated. I've just still a little hickup because the navmesh generation takes noticeable time.
    Don't forget that you don't need to hold all your dungeons in memory and can recreate the exact layout by the seed number.
     
    hopeful likes this.
  36. SirGive

    SirGive

    Joined:
    Sep 27, 2010
    Posts:
    384
    I'm allowing rotation on the tiles, so the branch cap doesn't entirely prevent dead end corridors. But I guess that's good enough. Pretty solid so far. Wish I could show some work.

    I've got a feature request:
    - Add references to the "next" rooms on the doors (could be the other door or other room, doesn't matter to me). I am using this to enable rooms as you move from one to the next. Could also fire this as an event during the generation too. I have some code if you want it

    Yeah, I was on 2.5.2. its good now in 2.5.4

    You could always put the generator in different scenes with different flows. And transitioning back and forth, just maintain the seeds and use them to re-generate when going back to a scene
     
    Last edited: Apr 13, 2015
  37. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    Thanks, I'll add this to the next build. For now though, it's possible to go through the list of Connections found in the Dungeon component to achieve this, if anyone else needs to do it. From that, you can find out which doorway in the adjacent tile is connected to a given doorway (and each doorway has a reference to it's own tile). It's a little cumbersome but it should work.

    One thing I have noticed though is a lot of this connection information isn't being serialized so it probably won't work for editor-created dungeons. Hopefully I'll be going through and fixing all of that for the next build as well.
     
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,294
    This approach could work for some folks, but one thing it would preclude is enemy AI being able to cross over from dungeon to dungeon at will.
     
  39. hike1

    hike1

    Joined:
    Sep 6, 2009
    Posts:
    401
    Referring to this video

    Do the floors require a unity plane or could some 2-triangle mesh from blender be used? Unity planes have
    too many polygons.
     
  40. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    176
    Yes, but you can also use a unity quad, it has two triangles.
     
  41. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    You can use whatever you like; I just used a plane in that example for convenience.
     
  42. six981

    six981

    Joined:
    Apr 20, 2015
    Posts:
    2
    Is it possible to know the current room the player is in? What I'd like to do is be able to have the player exit through a door, have the scene fade out and then fade back in inside the next room, so basically you only ever see one room at a time. Is this doable?
     
  43. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    It is as of about 5 minutes ago if you download the beta version. Just attach the new DungenCharacter component to your character and check it's CurrentTile variable. There's also an OnTileChanged event (and corresponding virtual method if you want to inherit a new component from DungenCharacter instead).


    Version 2.5.4 (Beta) - Download
    - DunGen is using a new method for socketing doorways together which is more robust. Doorways can now be aligned vertically (for stairwells, for example)
    - The DungeonGenerator class now has a DetachDungeon method allowing you to "tear-off" the dungeon from the generator so that it is not overwritten next time Generate() is called
    - Experimental: The DungeonGenerator class now has a GenerateAppended method which will generate a new dungeon appended to a previous dungeon that you specify. NOTE: This is entirely experimental and NOT supported functionality; dungeons generated in this manner will likely overlap or fail depending on whether allowIntersection is set. You'll have to decide how/if this is handled when it occurs. This is mostly in place as a starting point for those of you who want to implement infinite dungeons - but it needs additional logic (likely game-specific) to work as a complete solution.
    - [NEW] Doorway components now have a ConnectedDoorway variable
    - [NEW] Tiles now have some methods of getting/checking adjacent Tiles
    - [NEW] Tiles now contain a BoxCollider trigger component. There's a new DungenCharacter component which handles information about which Tile it's currently in (with events fired when switching tiles)


    Here's a component for making only the tile your character is currently in and all adjacent tiles visible:
    Code (CSharp):
    1. public sealed class MyDungenCharacter : DungenCharacter
    2. {
    3.     public RuntimeDungeon RuntimeDungeonGenerator;
    4.  
    5.  
    6.     private void Awake()
    7.     {
    8.         RuntimeDungeonGenerator.Generator.OnGenerationStatusChanged += OnDungeonGenerationStatusChanged;
    9.     }
    10.  
    11.     private void OnDungeonGenerationStatusChanged(DungeonGenerator generator, GenerationStatus status)
    12.     {
    13.         if (status != GenerationStatus.Complete)
    14.             return;
    15.  
    16.         // Hide all rooms when the dungeon is generated
    17.         foreach (var tile in RuntimeDungeonGenerator.Generator.CurrentDungeon.AllTiles)
    18.             tile.Hide();
    19.     }
    20.  
    21.     protected override void OnTileChangedEvent(Tile previousTile, Tile newTile)
    22.     {
    23.         // We've just left a room
    24.         if (previousTile != null)
    25.         {
    26.             // Hide the previous room..
    27.             previousTile.Hide();
    28.  
    29.             // ..and all adjacent rooms..
    30.             foreach (var door in previousTile.Placement.UsedDoorways)
    31.             {
    32.                 // ..but ignoring rooms that we would have re-shown in the next step
    33.                 if (!door.ConnectedDoorway.Tile.IsAdjacentTo(newTile))
    34.                     door.ConnectedDoorway.Tile.Hide();
    35.             }
    36.         }
    37.  
    38.         // Show the newly entered room..
    39.         newTile.Show();
    40.  
    41.         // ..and all adjacent rooms
    42.         foreach (var door in newTile.Placement.UsedDoorways)
    43.             door.ConnectedDoorway.Tile.Show();
    44.     }
    45. }
    If you have solid doors blocking vision between rooms, the above will work for effectively culling everything that isn't in sight.
     
    hopeful likes this.
  44. ShivaFooL

    ShivaFooL

    Joined:
    Jul 3, 2010
    Posts:
    16
    I love this asset, but still experimenting with it. For some reason the keys and locked doors are no longer being generated for me, even in the demo scene. I don't think I did anything to disable it: Key Manager is there, keyspawnpoints, keys and locked doors are in the flow. What am I missing? Also I updated to latest beta, no change.
    Btw, thanks for the simple integration with Sector Vis. It's nice for us out here to have assets be friendly with each other.

    Edit: So this is what fixed this for me: looking at the code for placing locks and keys, there was an if statement that looks for door prefabs -
    "&& entrance.DoorPrefabs.Count > 0)"
    but in the demo there were no prefabs specified for doors in the doorways of the tile prefabs. When I loaded those in, the keys and locked doors are there correctly. I hope this helps someone else. Cheers.
     
    Last edited: Apr 22, 2015
  45. Aegon-Games

    Aegon-Games

    Joined:
    Mar 7, 2014
    Posts:
    495
    Thanks for looking into that. It seems there could be a bug in the implementation then; I don't think the lock & key system should care about the door prefabs on doorways, it should probably be checking to see if there are locked door prefabs assigned in the Key Manager instead. I don't have access to DunGen right now so I'm thinking of this from memory (which is admittedly limited for the lock & key system), I'll take a look at the code tomorrow and hopefully get any bugs fixed.
     
  46. Ariedhan

    Ariedhan

    Joined:
    Mar 11, 2015
    Posts:
    3
    Hello everyone,

    So since, 4.5.3 I'm having a weird issue with Dungen. Most of the times, when I create a Dungeon it adds some tiles(rooms) outside of the main path or over the other tiles, overlaping them, which of course gives many problems once the game starts.

    Has someone find this issue before? What can I be doing wrong? It worked fine until one day it started doing this.

    Thanks for your help.
     
  47. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,343
  48. roydor

    roydor

    Joined:
    Mar 16, 2015
    Posts:
    9
    Hello!
    I recently purchased this asset and just wanted to say it's amazing!

    I have a quick question, that I haven't really found a good way to solve.
    With respect to doorways, I have my boss room with special fancy boss doors.

    is there:
    - a way to make sure my boss door appears on the entrance to this room?
    - a way to know which door is the 'entrance' vs the 'exit' along the main path?

    Thanks!
    --Roy
     
  49. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    364
    Hi!

    I just have a quick question. Is there a way to check when the map is done generating? I need to generate the AI graph when the map is done but currently it is only doing it before the map is generated.
     
  50. Sehlor

    Sehlor

    Joined:
    Feb 10, 2012
    Posts:
    199
unityunity