Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

World Building [RELEASED] Dungeon Architect

Discussion in 'Tools In Progress' started by AliAkbar, Aug 9, 2015.

  1. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
  2. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Wow ! Amazing ! Will you share this ? I don't still get how the whole logic works ;)
     
    Last edited: Mar 1, 2016
    AliAkbar likes this.
  3. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    This is really amazing. It really shows the power of your tool. I hope you can share this example also.
     
  4. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    There are some issues with PDF documentation I have noticed where part of the line gets cut off. I originally noticed this in the quick start samples for the directory paths for the other unity assets used.

    This is on a Windows 8.1 (64-bit) machine using Adobe Acrobat Reader 15.010.20059 for my PDF viewer.

    These are the documents I was looking at and the associated pages in the PDF where I noticed the lines getting cut off.

    01 - User Guide.
    pages (46, 39, 50, 51, 77 and 95)

    04 - quick start samples
    pages (6, 10, 11, 12, 14 and 17)
     
    AliAkbar likes this.
  5. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,929
    Do we not need a new script to do this? Your video is amazing but it doesn't show how simple it is. :) It only shows how nice it looks.
     
  6. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    You drop in a preconfigured dungeon prefab, in this case named DungeonSimpleCity (like DungeonGrid)
     
  7. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Thanks fr pointing it out. Apparently that cannot be controlled and PDF will push the image to the next page if more text can fit in messing up the order sometimes. I tried adding page breaks in LaTeX before compiling to PDF but doesn't seem to work. You can always refer the online versions which doesn't have this problem
     
  8. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Sure, this builder and others will be part of the next update
     
    Teila likes this.
  9. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    I attach the following script to the DungeonGrid2D prefab in the scene but when i open the theme, i don't see the newly created Marker in the dropdown. Why ?

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DungeonArchitect;
    4. using DungeonArchitect.Utils;
    5.  
    6. public class MyAwesomeEmitter : DungeonMarkerEmitter
    7. {
    8.     public override void EmitMarkers(DungeonBuilder builder)
    9.     {
    10.         base.EmitMarkers(builder);
    11.  
    12.         // Your emitter logic here
    13.  
    14.         // Emit as many markers as you like.
    15.         // Emit a marker like this:
    16.  
    17.         // Fill up the marker data
    18.         var markerName = "MyAwesomeEmitter";    // This name will be picked up in your theme file
    19.         var transform = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, Vector3.one);
    20.  
    21.         // Additionaly specify the grid based meta data (optional)
    22.         var gridPosition = new IntVector(); // specify a position value here in grid coordinates
    23.         var cellId = -1;
    24.  
    25.         builder.EmitMarker(markerName, transform, gridPosition, cellId);
    26.     }
    27. }
     
  10. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,929
    I understand. I just thought it was going to give an example of how to create our own dungeon prefab rather than just show us how to use one of yours. I love yours though so thank you for providing several. :)
     
    BackwoodsGaming and DiscoFever like this.
  11. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    You have to right click and create a new marker node and rename it. This is by design, as the theme graph does not (and should not) know anything about your marker emitter script. The scripts you created is attached to the dungeon game object, along with the theme file. If your theme file has those markers defined, it will spawn the items underneath it
     
  12. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,929
    @AliAkbar

    Are the grid based builders that you have shown above with the city the same builder that will be be used for the one I sent you? The medieval city with blocks? Or is that a different one?
     
  13. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi, I've been looking for something like this for a while but it's only now I'm ready to build levels, and I must say Dungeon Architect looks impressive, I'm developing for mobile so would not build in runtime, (not for now) so I could use Unity's NavMesh and bake shadows, I have a few questions.

    Would it be possible to place light probes when building? (that would make my life easier ;))
    Also can I use THIS, THIS and THIS to build levels? As they have ceilings.

    Thanks.
     
    Magic73 likes this.
  14. peanutgallery

    peanutgallery

    Joined:
    Oct 5, 2013
    Posts:
    35
    @Teila @AliAkbar I just wanted to chime in with Teila on this, the thing I was hoping to see was the script for the alternate dungeon builder, or how to make such a prefab. Essentially I want to see exactly how you connect in C# to the API and create your own graphs/layouts... and also how to access floor tiles/their nodes so I can implement tile-based movement.
     
  15. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Same here. That would be awesome !
     
    peanutgallery likes this.
  16. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    That's exactly what it is ;)
    It contains a simple builder script derived from DungeonBuilder class. The prefab I was talking about shows you how you can use this builder script with the duneon object. Just remove the grid builder component and replace with the city builder (with the city configuration and model script) and save as a prefab so you don't have to configure the dungeon object all the time. I'll also create builder tutorials around these samples
     
    peanutgallery, Teila and Sabathius like this.
  17. Sabathius

    Sabathius

    Joined:
    Jul 13, 2013
    Posts:
    55
    My relationship to City Architect...



    :D
     
    DiscoFever likes this.
  18. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Was checking out the GaiaForge stuff, and when I opened the scene and peeked at the DungeonGrid, I found some missing monobehaviors:
    Screen Shot 03-01-16 at 09.52 PM.PNG
    Looks like you have some runaway scripts Ali! ;)

    EDIT: There are no compiler errors, so I think this is a case of missing scripts.
     
    Last edited: Mar 2, 2016
  19. peanutgallery

    peanutgallery

    Joined:
    Oct 5, 2013
    Posts:
    35
    That's great! I think the confusion lies in that I don't have the asset just yet. I was hoping you could post a snippet of what your code looks like in the BuildDungeon override. Your example shows this:

    Code (CSharp):
    1. public override void BuildDungeon(DungeonConfig config, DungeonModel model) {
    2.         base.BuildDungeon(config, model);
    3.  
    4.         // Add your builder logic here
    5.     }
    But I was hoping to see what the code would look like in the "//Add your builder logic" section so I could see how easy it was to make my own logic and tie it into Dungeon Architect.

    Sorry if I'm being a pain! :confused:
     
  20. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Can this be used like DunGen, spawning pre made rooms and corridors?
     
    Arganth likes this.
  21. DRhodes

    DRhodes

    Joined:
    Mar 26, 2015
    Posts:
    4
    @AliAkbar I'm really enjoying the plugin so far. It's so simple to add intricate detail and customization to my dungeons. However, I'd like ask about some possible new features or workarounds for some limitations I've found.

    With regards to selection rules, it would be nice if the selection rule didn't override the probability. Is it possible to have an option where the selection rule could be applied after the probability has been evaluated?

    With regards to the transform rules, I'd really like to make them more modular. With monobehaviours I can use public or serialized fields to adjust parameters as needed. For example, I'd like to make a randomize rotation transform rule that has the ability to set a rotation axis and a snap angle value. Currently, to do this, you have to write a new transform rule for each snap angle value and axis.

    Lastly, it would be nice to use multiple transform rules. What if I want to randomize the y position and z rotation, for example?

    Thanks!
     
    AliAkbar likes this.
  22. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    I think you can simply create an emitter that will emit 'rooms' or 'corridors' no ? Maybe i'm not right ... just saying :)
     
    S4G4N and Griffo like this.
  23. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
  24. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Hey everyone, I've been away yesterday. I updated the simple city builder demo.

    This example shows how you can use marker emitters on your custom builders to extend it further

    In the previous city example, I created a marker emitter script that emits Wall markers around the bounds of the city




    The theme file can then pick this up and beautify it in interesting ways





    I created another theme with @S4G4N's Village Exterior kit and built it on a terrain generated by Gaia









     
  25. S4G4N

    S4G4N

    Joined:
    Mar 13, 2013
    Posts:
    3,194
    That is not just a small village anymore :):):)

    Looking great @AliAkbar
     
    AliAkbar and hopeful like this.
  26. Sabathius

    Sabathius

    Joined:
    Jul 13, 2013
    Posts:
    55
    It is...beautiful! Do want!
     
    AliAkbar likes this.
  27. daschatten

    daschatten

    Joined:
    Jul 16, 2015
    Posts:
    208
    Thank you for this relly nice asset @AliAkbar!

    Is it possible to spawn theme override volumes automatically? So one can spawn themed rooms and floors (like control rooms, bed rooms, living rooms, player spawn floor). It would be helpful to edit a chance and min/max for each override volume to get an end boss room only once :)
     
    AliAkbar likes this.
  28. wheezygeezer

    wheezygeezer

    Joined:
    Sep 19, 2014
    Posts:
    14
    I just bought DA before I went into Geek Apoplexy!

    Now I'm having issues beyond a burned pocket-book.

    I am very slowly learning how to do things - and finding there are some things that I'm finding very difficult:

    First: I cannot work out how to get (the excellent) 3DForge's Village Interiors Kit walls to line up properly. When I download the example theme file posted elsewhere I see a lot of errors in the DA generation - stairs going nowhere, walls not on the edge of the floor tiles or at odd angles, etc. Also I see duplicate wall pieces (it seems there are 4 pieces at a time - where by my understanding there should be only two - to present double-sided walls.)
    So my question is does anyone have a simple sample theme fie that actually has walls correctly placed and without redundant duplications?
    Second: I want to be able to have adjoining rooms without interlinking corridors. Is this possible?
    Third: when in paint mode, if I expand a corridor to room size will DA remap the Room meshes? Can I paint rooms into the procedural dungeon?

    I'm sure when I get the first one sorted I'll be spending way too much time in the Theme editor having fun - but until then, I feel I am stuck in a dark, locked room with no key or light.
    If the second issue is for a future version (like the much anticipated caves and city) then I'm happy to run with it.... but it would be nice.
    The third one would make my life a lot easier and save me from further wallet-damage by not having to get, and learn, another plugin.

    TIA
     
    AliAkbar likes this.
  29. livio3d

    livio3d

    Joined:
    Feb 17, 2009
    Posts:
    145
    Hi guys, i bought to this product yesterday and i can say its really perfect for interior dungeon like diablo3, just what i need, i need ti know if is possible to do external enviroment map with 3d tiles and clift, this mean one single object for corners ( actually is like one flor, 2 side wall and one colums) i post a image with the tile i use for my external maps, is possible to use 3d markers script for use this kind of tiles and if is possible to have a pratical tutorial? (convex /concave cornes ecci have like 140 variations of this tile and i hope to using it ) ?
     

    Attached Files:

    AliAkbar likes this.
  30. FlodLab

    FlodLab

    Joined:
    Feb 6, 2013
    Posts:
    30
    HI Ali,

    in DungeonSceneProvider.cs -> BuildGameObject(...)

    you set gameObj.layer = 0;
    but why?

    all Child Objects keep their layers - but not the actual instantiated.

    i was searching the hell out of my own code because all my Layers of spawned prefabs were missing
     
  31. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @peanutgallery I'll post an update soon. In the mean time, you can have a look at the city builder files. Just drop it into the samples folder
     

    Attached Files:

    peanutgallery and Sabathius like this.
  32. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @daschatten Thanks! Sure, you can spawn theme volumes just like any other game object. I'll create a demo that does the following:
    • Creates a dungeon listener and hooks into the PostLayoutBuilt event. This will be called after the layout is created, but before the theme engine executes
    • The script would spawn theme override volumes around various rooms cells with different themes. Since this is done before the theme engine executes, the rooms will have different look and feel
     
  33. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @wheezygeezer Thanks for the feedback
    1. I'll have a look at this and get back to you soon
    2. You can have a more "packed" dungeon with lots of adjoining room by reducing the "RoomAreaThreshold" variable. When done, DA will start promoting more cells into rooms (instead of corridors)
    3. You can use platform volumes to define rooms. Painting is not supported for rooms for now. This is because this procedural generation algorithm requires rooms to be rectangular / square and that is not guaranteed by the paint tool
     
    wheezygeezer likes this.
  34. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @livio3d its possible. The rabbit demo uses the same type of decoration (as well as the 3D Village interior demo).

    You can use this marker emitter script to do just that. I'll create free assets and a demo to showcase this in the next update.

     
    CrashKonijn, livio3d and Sabathius like this.
  35. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Ah sorry. Unity was assigning a blank layer to all DA created objects after I imported NGUI to my test game. I'll test and remove that in the next update.
     
    FlodLab and Sabathius like this.
  36. Sabathius

    Sabathius

    Joined:
    Jul 13, 2013
    Posts:
    55
    You know, I really love that you freely share these examples. It helps create a foundation of understanding this amazing engine you've built, and it's going to help us all produce better games as a result. :D Cheers.
     
    Tinjaw and AliAkbar like this.
  37. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Thanks Sabathius

    I also appreciate the feedback I get from the community. It helps improve DA ;)
     
  38. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @TonanBora An array of items was exposed to the inspector window when the dungeon object was selected. This was causing sluggish performance in the newer editor versions and it should be bettter now (with the next update).

    A huge thanks to George for suggesting this fix. I'll also profile and further investigate
     
    TonanBora likes this.
  39. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729




    I've added better free assets for the city demo that will be included in the next update. The art license is CC0 so you can use in your games (source1, source2). Also added support for bigger houses whose probability can be controlled from the configuration
     
    Last edited: Mar 8, 2016
    hopeful, wheezygeezer and Griffo like this.
  40. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Created a new theme with free assets that showcases the use of corner emitters (Corner3D emitter in this case) to beautify the sides of the level using cliffs in an out door scene. The awesome art is provided by Kenney and is free and licensed under CC0, so you can directly start using this theme for your commercial games




     
    wheezygeezer and S4G4N like this.
  41. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
  42. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    When will all those FANTASTIC new things be available ?
     
    AliAkbar likes this.
  43. sendmyfile

    sendmyfile

    Joined:
    Jan 31, 2014
    Posts:
    9
    it seems like a super fast way to build a level with a few clicks, I wonder how well does it generate a level at run time on mobile devices? how well does DA handle draw calls?
     
    AliAkbar likes this.
  44. ruairiau

    ruairiau

    Joined:
    Mar 9, 2016
    Posts:
    9
    Hi Ali,
    I just bought your Dungeon Architect extension yesterday and had a heap of fun with it. Well done on making an awesome utility.
    I also bought the MOBA Theme (MK4) and tried out the sample scene you made. There seems to be some scripts missing from the camera and the winter stuff doesn't seem to work either. Also, when I look at the theme file, some of the items appear missing or have a coloured cube placeholder - is this normal or have you added assets to the theme from other resources?
     
    AliAkbar likes this.
  45. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    I have had the same type of issues related to the camera and some other scripts. It almost appears to be an issue with a standard assets.

    What version of Unity are you using?

    I was thinking it might be related to using a later version of Unity (5.3.1 and 5.4 beta8 in my case) compared to the version of Dungeon Architect was uploaded to the asset store which was Unity 5.0.1.

    I have also have issues with some prefabs displaying as colored cube placeholders in the theme view. In all case it was just running the refresh option on the theme that caused those to display correctly.
     
    AliAkbar likes this.
  46. IrishDev

    IrishDev

    Joined:
    Jul 18, 2012
    Posts:
    50
    Hi Ali,
    I am attempting to create a randomly generated dungeon that has five unique rooms. What would be the best way to implement this? You mentioned in another post that using a dungeon listener that hooks into the PostLayoutBuilt event may meet a similar requirement, if it is possible to implement this could you please provide a example?
    Thank you.
     
    Last edited: Mar 9, 2016
    AliAkbar likes this.
  47. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @DRhodes Thanks for the feedback. Those are all very valid points and I'll implement them in 1.2 (after 1.1 which I'll submit by tomorrow).

    1. Multiple Selector rules (with AND / OR combinators)
    2. Multiple Transform rules (that post multiply from the previous result
    3. Customizable Selector rules (public variables)
    4. Customizable Transform rules (public variables)
    5. Selector override probability flag

    For point 3 and 4, I'll need to explore further as I didn't find a way to expose the public variables automatically using Unity's editor framework while I was developing a few months back (any suggestions?)
     
    Teila likes this.
  48. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @sendmyfile Here is a demo of the survival shooter demo running in mobile:


    This is running in my 2 year old Samsung Note 3. At time (~0:35) I tap and regenerate the map, where it recreates the layout, rebuilds the map and generates the navigation mesh within a few seconds.

    I disabled the non-mobile post processing effects (bloom, ssao, depth of field etc)

    As for draw calls, after the level is generated, its like a normal unity level (where draw calls mostly depend on the art assets and the geometry in the cam frustum?)

    Is there a mobile specific optimization you'd like to see?
     
  49. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I'll submit the next version very soon. Need to add a few more demo samples requested by the community
     
    Teila likes this.
  50. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @ruairiau Thank you for using DA :) I'll have a look at the thrid party demo. Also, in the next update, I plan to remove the image effects standard asset scripts and have the end-user import it for their appropriate version. As for DA, I'll upload different versions for 5.0, 5.1, 5.2, 5.3. Since this is my first asset in the asset store, I'm not sure if this is the best way to go. Is there a better way?

    As for the cube placeholder, when Unity doesn't return me a thumbnail, I display that coloured cube. A simple fix is to go to Tools > Refresh Thumbnail in the theme editor window. (Alternatively, right click on your prefabs folder and choose reimport. Unity would then reimport and recreate the thumbs and give them to the theme editor)