Search Unity

World Building [RELEASED] Dungeon Architect

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

  1. Teila

    Teila

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

    Just to let you know, the pdf download for the new examples does not work. :)
     
    AliAkbar likes this.
  2. FlodLab

    FlodLab

    Joined:
    Feb 6, 2013
    Posts:
    30
    HI @AliAkbar

    I want to have something like a chest in a room but maximal one per room - but i got stuck.

    I tried using a SelectorRule but i couldn't find a reference to the current room or something.
     
    AliAkbar likes this.
  3. Voltarrens

    Voltarrens

    Joined:
    Feb 14, 2016
    Posts:
    16
    Just discovered your post and I'm very impressed with the work you've done. Well done, keep it up and want to see more so I'll keep watching. :) Just having a look at what's possible, my mind is ticking over with ideas I could carry out to create environments without too much fuss, being an artist and not a programmer.
     
    AliAkbar likes this.
  4. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @Teila thanks for the heads up. I'll have that fixed
     
    Teila likes this.
  5. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @Floddi Drop this script into your dungeon game object.




    You can specify as many props you'd like to have from the array. Specify a marker name (which you can use to attach your chest from the theme file). The probability is how often you want this marker to be available in the room (0.5 if you just want it 50% of the time). CenterToEdgeRatio is 0 = center of the room,, 1 = edge of the room on the walls. 0.8 for it near the walls. It takes care of rotating the marker to face the opposite side of the walls





    If you want more than one chest in the room, add more entries to the list
     

    Attached Files:

    c-Row likes this.
  6. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Thank you @Voltarrens!
     
    Voltarrens likes this.
  7. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    SharpNav has some heavy allocations. Have you tried to compile it to a DLL and see if it reduces the allocations any? I know that allows some sensible C# coding (foreach and such) without the extra Unity allocations.
     
  8. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Bought! Guess I know what I am going to do this weekend. :D
     
    wheezygeezer likes this.
  9. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Thanks @c-Row! Let us know what you create
     
  10. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Fixed scaling issue with 2d sprites (4x4 sprite)
     
  11. Ryrumeli

    Ryrumeli

    Joined:
    Aug 1, 2012
    Posts:
    1
    This is an asset which I have been keeping my tabs on. I will be honest in saying that the only reason I haven't yet bought it was the fact our team has already adquired DunGen and it fits our current needs. However I have to say that when this asset has a form of flow control allowing gameplay rules such as Midboss Room, Key Room, Boss Rooms and the like to impact the generated maps in a more controlled way, frankly based on what I have seen it might actually kick our game's quality up a knotch, if we can add ceiling and vertical dungeons as impressive as your catedral one.

    Definitely keeping tabs on this topic to know the updates in this asset, and when it has such a feature I will honestly see this in a level of impulse purchase for me. :)
     
    AliAkbar likes this.
  12. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Hello @AliAkbar

    Whenever I try and change the Z scale to a value lower than 1 (0.5 for example) Unity seems to freeze for a couple of seconds. Sometimes it comes back on its own, other times I need to click another input field to make it react again. Furthermore I get 999+ log messages as follows (mostly the second).

    This happens with both the bundled dungeon themes as well as a new theme with simple 3D objects only. I suppose this is a problem with scaling to a zero value (Unity tries to auto-update the scale as soon as I enter "0" when I want to enter "0.5") though I don't quite understand why it only happens on the Z scale.


    Furthermore, updating the paint mode selection square's X and Z position in the scene edit view seems to be rather laggy on my machine (despite my game-ready setup). Painting the tiles themselves works fine, though, as well as changing its height via the mousewheel.
     
    AliAkbar likes this.
  13. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    After a bit of experimenting I realized that for now entering "5" and then putting a decimal point before it to end up with a Z scale of "0.5" works fine.
     
  14. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @c-Row I'll look into this and fix it
     
  15. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Dungeon of Isaac? :)

    WEB DEMO

    Created a new builder that generates levels like Binding of Isaac and some more interesting variations. Still a WIP and will be available in the next update. It uses the new spatial constraint feature to select sprites/gameobjects based on nearby geometry. This gives a lot of flexibility while designing your themes. More on this tomorrow.







    PS: Some cases of holes in the room needs to be handled in the theme file by adding more sprite variations. So you'll see some weird hole / wall combo inside the room sometimes. This is not a bug, but is due to the lack of sprite variations of those cases in the theme file

    Awesome art by Daniel
     
    c-Row and Arganth like this.
  16. ruairiau

    ruairiau

    Joined:
    Mar 9, 2016
    Posts:
    9
    @AliAkbar
    I was getting build errors on the Mac with a file called Bulk_Generics.cpp (null reference errors) and managed to track it down to the navigation code in Dungeon Architect. By removing SharpNav and your navigation code that was dependent on it, I managed to resolve the issue.
     
    AliAkbar likes this.
  17. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I've fixed the issue
     
    c-Row likes this.
  18. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @ruairiau I'll have a look
     
  19. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Revamped the builder with proper 2D support. You now have access to 2D specific markers (Ground2D, Wall2D, Door2D). You use spatial constraints to apply different sprites on the marker with a easy to use visual editor



    You attach all your wall sprites under the same Wall2D marker and assign how the layout constraint of the nearby tile should look like. The above example shows a constraint for a wall corner tile.



     
  20. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Great - any idea when the update will be live?
     
    AliAkbar likes this.
  21. PeterShoferistov

    PeterShoferistov

    Joined:
    Sep 22, 2013
    Posts:
    59
    AliAkbar likes this.
  22. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @PeterShoferistov I am planning to add a procedural platformer builder to create side scrolling games (2D and 3D) in the near future. It should be easy to implement it as a builder and I was looking at this algorithm apart from other algorithms for creating mario like levels. Do you have any good papers / articles in mind for the algorithm?
     
  23. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I've submitted to Unity for review. It will be available soon
     
    c-Row likes this.
  24. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    It looks like 1.2.0 is now available in the asset store.
     
  25. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    I am definitely keeping an eye on this. Procedural 2D\2.5D platform level generation would be an amazing addition!
     
  26. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
  27. hammertime2014

    hammertime2014

    Joined:
    Jan 16, 2014
    Posts:
    6
    Hey @AliAkbar , DA looks great and I think you just saved me a TONNE of work. I'm trying to read up on Recast and NavSharp to see what it offers but have a quick question as I'm not sure how much navagent support there is.

    Looking at A* Pathfinding Project Pro (https://goo.gl/joQqyn), would it be possible for us to get it to work with DA do you think?
     
    Last edited: Apr 10, 2016
  28. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    Can the the whole dungeon be constrained in a volume ? I would like to generate the dungeon inside a hull.

    I could add negation volumes around the hull and rebuild, but it would be way more efficient to have the functionality in the layout generation phase !
     
  29. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    There is no answer for a long time.

    It is a bad signal.
     
  30. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I wouldn't be too worried. There are both Unreal and Unity versions of DA, and also I believe he's deeply involved in a version upgrade (if I recall correctly). His last reply was March 25, which is only about 6 posts back from this one. He's probably just busy.
     
  31. Twoonebe

    Twoonebe

    Joined:
    Mar 30, 2013
    Posts:
    174
    Seems not to be so good at so few Disskusion architect dungeon about ? I do not see new images and no hassle he followed up by the developer his project
     
  32. zbzbz

    zbzbz

    Joined:
    Oct 6, 2015
    Posts:
    9
    It's giving me all compile errors...
     
  33. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Hi everyone. I'm sorry, life got in the way. I had to be in another city for a while.

    @Razmot, I've added an inverse flag in the negation volume. If enabled, it negates everything outside the volume, so you can constraint you dungeon with in

    Negation volume without inverse


    Negation volume with inverse enabled. This makes sure the dungeon is within the bounds
     
    daschatten, Razmot and hopeful like this.
  34. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @zbzbz could you give me more info so I can reproduce it locally? What is your unity version. Also please post the errors messages

    Thanks!
     
  35. zbzbz

    zbzbz

    Joined:
    Oct 6, 2015
    Posts:
    9
    ss+(2016-04-23+at+02.44.06).png
     

    Attached Files:

  36. zbzbz

    zbzbz

    Joined:
    Oct 6, 2015
    Posts:
    9
    5.0.1 and 5.3 none work
     
  37. zbzbz

    zbzbz

    Joined:
    Oct 6, 2015
    Posts:
    9
     

    Attached Files:

  38. jasonMcintosh

    jasonMcintosh

    Joined:
    Jul 4, 2012
    Posts:
    74
    You have compiler errors. Look in the console to see those and figure out what is causing the errors. Open the console from the Window -> Console menu item.
     
  39. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @zbzbz Thanks for the console log. I tried here and cannot reproduce it locally (Unity 5.3.3 and DA 1.2.0). Please do a clean reimport
    • Delete the DungeonArchitect folder and DungeonArchitect_Samples) folder
    • Update DA from the asset store to the latest version (1.2.0)
    • Import
    Let me know if you still face the issue
     
  40. zbzbz

    zbzbz

    Joined:
    Oct 6, 2015
    Posts:
    9
    Nope you got it fixed thanks! Btw can you leave a tutorial on roofs?
     
  41. zbzbz

    zbzbz

    Joined:
    Oct 6, 2015
    Posts:
    9
    How do I add custom scripts?
     
  42. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    Thanks for the "inverse negation" - let's call it a positive volume ;)

    Is it possible to have pre-made parts, made by hand with the tiles, that connect to the dungeon ?

    Like this :

    1.jpg

    Then generate the dungeon in the volume to obtain this :

    2.jpg

    Like your hand painting feature, but reversed :

    I want to design a set of fine tuned dungeon parts in advance, like shells, and then fill the rest procedurally (at runtime if possible). My objective is to let players assemble "dungeons shells" in game and fill the inside with procedural elements. Except in reality my "dungeons" are spaceships ;)

    Here the airlock is hand made and the wall / floor tiles would be generated by dungeon architect :

    3.jpg

    Btw, do you have the unity version of the top down sci fi manufactura theme ? Or a good screenshot of the unreal theme maybe :)
     
    AliAkbar and syscrusher like this.
  43. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I love the idea of this. Hand-craft the layout and topology of a map, carefully planning encounter zones and strategic combat options such as raised platforms and cover, then automate the tedious parts. This concept could save a ton of time for things like guard barracks where the rooms can follow a more-or-less common pattern, but you want some variation in furniture and clutter placement.
     
  44. yohami

    yohami

    Joined:
    Apr 19, 2009
    Posts:
    124
    Hi AliAkbar,

    Im new to DA, I want to create prefabs of rooms / segments and have DA include them when creating the map. Where should I look to add this?

    Thanks,
    Yohami
     
  45. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    I have a small problem; the asset i'm using for the dungeon has walls but they're only one simple plane; thus making normal facing one direction ... how can I detect the direction of the wall so i can 'flip' rotation 180° ?
     
  46. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Also, adding a custom emitter :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DungeonArchitect;
    4. using DungeonArchitect.Utils;
    5.  
    6. namespace DungeonArchitect
    7. {
    8.     public class RoofGabelEmitter : DungeonMarkerEmitter
    9.     {
    10.         public float elevation = 1;
    11.         public string markerName = "Gable";
    12.         public override void EmitMarkers(DungeonBuilder builder)
    13.         {
    14.             if (!(builder is GridDungeonBuilder))
    15.             {
    16.                 Debug.LogWarning("Unsupported builder type used with marker emitter MarkerEmitterFindLowestPoint. Expected GridDungeonBuilder. Received:" + (builder != null ? builder.GetType().ToString() : "null"));
    17.                 return;
    18.             }
    19.             var gridModel = builder.Model as GridDungeonModel;
    20.             var gridSize = gridModel.Config.GridCellSize;
    21.  
    22.             foreach (var cell in gridModel.Cells)
    23.             {
    24.                 if (cell.CellType != CellType.Room) continue;
    25.                 var location = cell.Bounds.Location * gridSize;
    26.                 var y = cell.Bounds.Location.y;
    27.                 var isize = cell.Bounds.Size;
    28.                 for (float x = 0; x <= isize.x + 0.001f; x += 0.5f)
    29.                 {
    30.                     var mult = (float)x / isize.x;
    31.                     var angle = 0;
    32.                     if (mult > 0.5f)
    33.                     {
    34.                         mult = 1 - mult;
    35.                         angle = 180;
    36.                     }
    37.                     var height = mult * elevation;
    38.                     for (float z = 0; z <= isize.z + 0.001f; z += 0.5f)
    39.                     {
    40.                         var position = location + Vector3.Scale(new Vector3(x, y + height, z), gridSize);
    41.                         var rotation = Quaternion.Euler(0, angle, 0);
    42.                         var transform = Matrix4x4.TRS(position, rotation, Vector3.one);
    43.                         builder.EmitMarker(markerName, transform, new IntVector((int)x, (int)y, (int)z), 0);
    44.                     }
    45.                 }
    46.             }
    47.         }
    48.     }
    49. }
    50.  
    I don't see the new emitter:


    I have quit restarted rebuild everything still doesn't show ... what's wrong here ?
     
  47. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    Hi, I'm having a bit of trouble implementing tile based movement using dungeon architect's pathfinding. How can I go about implementing non-diagonal tile based movement? Any Examples would help.
     
    Last edited: May 2, 2016
  48. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Why not use Unity's navmesh ?
     
  49. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I experimented with that while building Eternal Crypt. Try adding a Platform volume to your pre-built room prefab. When you drop it in (and set the dungeon reference in the volume), the dungeon should build a room around it as you move it
     
  50. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @yohami You can insert your prefabs in the middle of the room like in this:

    1. Drop in this script in your DungeonGrid game object: DungeonArchitect_Samples\Support\Scripts\Emitters\RoomMidEmitter
    2. Go to your theme file and create a marker named "RoomCenter"
    3. Rename the marker to "RoomCenter". Add you pre-built room prefab here and it will show up


    Some examples:



    It is not perfect as you cannot control the room size to match up with the prefab size. The game Ziggurat has a nice and simple system of pre-built rooms (1x1, 1x2. 2x2, 2x3 etc) and it works very well. I'll builder like that is in my todo list
     
    Razmot likes this.