Search Unity

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
    I'm designing a new way of dealing with spatial constraints. This will give you more control on your prefab placement from the theme file.

    The purple node is the base node relative to the marker you are checking against. You can add as many rule nodes and place them around your base node to specify the constraints. The nodes can have multiple constraint rules attached to them. I'll be providing various rule scripts that you can add (occupied / empty, contains marker, is door, has stair, is higher / lower etc). You can also script your own rules

    Apart from constraint rules, it will also have exclusion rules. Exclusion rules remove any markers from that area if the constraints are satisified. This will allow you add art assets that are greater than 1x1 tiles in your theme files. For e.g. if you want to use a door that is 3 tiles wide, with your constraint rule nodes, you can check if the nearby edges contain a wall. On those adjacent wall rule nodes, you'll also specify to remove those wall markers (so the larger door doesn't overlap with the walls)

    This can also be used to insert rounder corner floor tiles greater than 1x1 (by removing the corner walls/pillar and replacing them with a single rounded wall mesh




    I've also fixed the theme override issue that was not picking up the custom markers inserted by the user. I'll have more updates soon
     
    spryx, Sehee26, rubble1 and 1 other person like this.
  2. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    Hi Ali,
    I have several questions:
    1. How to make assets spawn not in a certain grid distance from corridor, but right in the center of "holes"/empty areas in the level (I need this for enviro assets).
    2. I've noticed two patterns for level creation: sometimes relatively long corridors are created, and sometimes a bunch of really short (too short, and that's the problem) - all with same settings. How to force certain minimal corridor length?
    3. I have DA 1.4.0 and would like to avoid upgrading - I've read you fixed a rare bug where no doors were created between rooms (happens like 1/20 times for me, making level unplayable). What is the code I need to change?

    Thank you in advance,
     
  3. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240

    This looks good!

    About the fix you mention here - I have a critical problem - DA keeps spawning wrong asset (doors) - it spawns those belonging to "standard" theme, ignoring theme overrides. Is this related? I am not sure, but maybe the great number of markers and prefabs in theme (I have plenty) is causing some serialization issue here? (DA 1.4.0). I've tried recreating IDs, but that did not help.

    Best!
     
  4. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Do you have this available to try now? I'd like to have a go at it.
     
  5. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I've recently finalized spatial constraints and created samples to get you all started.
    There's also a new comment node that you can place in the theme files

     
    hopeful, wolfen231 and Arganth like this.
  6. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    I have had an opportunity to play with this. The ability to hook into markers directly is just great. Even ones you make. This is something that should be clear to people. It's very beneficial. And as the video shows, the constraints window makes so much more sense now.

    Great work Ali!
     
  7. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Thanks for trying it out @wolfen231

    I've added a new feature to the spatial constraints that allows you to add larger tiles (greater than 1x1) into your themes. You can remove nearby markers from the scene if a spatial constraint selection is done.
    This gives you a lot of flexiblity. More info here:




    The marker removal is recursive so, if you've emitted a custom marker called WallDecoration from your Wall markers and you decide to remove the wall marker from this system, the wall marker and everything that was emitted out of this marker (the entire sub-tree) will be removed, performing a clean removal (even the markers emitted from WallDecoration)
     
  8. Beatshapers

    Beatshapers

    Joined:
    Dec 22, 2016
    Posts:
    1
    Hi Ali,
    New spatial constraints looks awesome! Any chance we could get a beta? Or when do you plan to release an update?
     
  9. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I've submitted a new update for approval

    Version 1.7.0
    • Added a powerful node based Spatial Constraints system that opens up new possibilities for theming. More info here: https://goo.gl/FvUgt9
    • Performance improvements on the theme editor
    • Added samples to demonstrate spatial constraints
    • Added a new comment node in the theme graph editor and the spatial graph editor
    • Fixed a theme graph camera issue when no nodes were preset in the graph
    • Major refactoring of the graph editor framework to make it easily extensible with other types of graphs
    • Large houses in the simple city builder spawn only when they have road access
    • Added terrain support on the navigation builder. This allows navigation mesh to be built on terrains that host the dungeons
    • Added a PreDungeonBuilt and PreDungeonDestroy events to the event listener interface
    • Added a new layout algorithm for building circular cities (Circular City Builder). Added a new demo in the samples folder (DungeonArchitect_Samples\DemoBuilder_CircularCity\Scenes)
    • Added a road framework to create a road mesh around an arbitrary road network. This is used in the new CircularCityBuilder
    • Added a rasterization framework to draw dungeon layout in a bitmap to influence the layout
     
    Beatshapers, Sehee26, hopeful and 2 others like this.
  10. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Such power with the new spatial constraints. I really do love the flexibility it gives you. Great work Ali. I hope to see more improvements in the future on this thing. If I have any feedback or ideas / requests for it I will let you know.
     
  11. indie_dev85

    indie_dev85

    Joined:
    Mar 7, 2014
    Posts:
    52
    Hi Ali,

    I downloaded the latest 1.70 from the store,it's spatial constraints ,BSP and circular city additions are awesome:)

    But i am not able to find any tool related to new rasterization framework ( there's only one empty ToolRasterVisualizer class).
    Also can you please update docs/make tutorial videos regarding the BSP and rasterization framework.
     
  12. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Where I can find the experimental builder for side scroller games? I didn't find it in version 1.6.
     
    AliAkbar likes this.
  13. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I've added 5.6 support and resubmitted a new update for approval as some users are still using it
     
  14. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Thanks @wolfen231. I'd love to hear feedback and suggestions from the community
     
  15. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @indie_dev85 The rasterization framework is present in code but I'm not using it right now. I initially used it for the circular city builder but later ended up using a geometric approach for the roads since it is much faster than a raster flood fill

    I'll be using the framework in the future updates with other builders and have samples to demo the feature

    I'll add tutorials on the BSP builder. It is still a work in progress
     
    hopeful likes this.
  16. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729


    I've attached a new demo file for the mario builder. You can download it now and check it out. Let me know what you'd like to see here
     

    Attached Files:

  17. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    SecretStudio, spryx and Arganth like this.
  18. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I've attached the theme and scene file that was used in the above video. When you hit play, it creates a new random dungeon, builds the navigation mesh, then places the spawn point in a room. The theme file emits a enemy spawner prefab that spawns 3 enemies in each room. You can customize it and the other prefabs in the asset (like turrets)

    File attached. Install the following for it to work:
    Dungeon Architect: http://u3d.as/nAL
    Sci Fi Top Down Space Station: http://u3d.as/vCD
    Sci Fi Top Down Game Template : http://u3d.as/Lqu
     

    Attached Files:

    Last edited: Mar 28, 2018
    hopeful and SecretStudio like this.
  19. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    The MarioBuilder is awesome. Thank you. I will use it in one of my games side-scroller games.

    Dungeon Architect is the best level generator. Keep up with the good work.
     
    AliAkbar likes this.
  20. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    The last update with Unity 5.6 support is live
     
  21. KMonkey

    KMonkey

    Joined:
    Nov 12, 2012
    Posts:
    21
    Hey AliAkbar

    Great tool btw. I just had a question and not sure how to approach this request. I'd like to be able to spawn a single prefab just once only (lets say, the Golden Box) and it must exist in the dungeon 100%. How would I go about this?

    I played with the idea of using a Platform Volume, and put the single prefab as a child of that object which works but the location of this Platform Volume is always in the same place so not really that fun.

    I'm not sure how to approach this, maybe a selection rule?
     
    AliAkbar likes this.
  22. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Hi @AliAkbar
    About the MarioBuilder. I was planning to release a metroidvania game in the future. Is it possible to create a builder similar to MarioBuilder that can create levels vertically and horizontally? Like classic Metroid games and Castlevania Symphony Of The Night.
     
    AliAkbar likes this.
  23. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    @AliAkbar
    1. Would be nice if "removal rules" followed the copy paste of a node.
    2. If possible I would actually prefer to see the removal rules on the same page as the constraint rules. Either separated by a horizontal line or just turned into a drop down option like the other constraint rules.
    3. The sorting logic or pickup logic of when rules are applied is not entirely clear. I am assuming from Left Down to Right Down on the trees. However this doesn't take into account or tell us "which markers" are being read first or how deep down a constraint can read from another previous marker chain.

    For example is Ground read first, then walls, then fence? Or is it walls then ground, then fence? What about situations like "empty space" emitters? You can obviously use the new constraints on them, but when is it read?

    I have had situations where I just swap which one is first on the main marker and get entirely different results.
    4. Would be nice if maybe there was a "double pass" where the main dungeon layout is done THEN it takes into consideration the rules / constraints. This way I would think marker names locations in the trees wouldn't really matter. Or just a much more clear way to define which markers are more important (I know this particular one has come up with you before in email).
     
    AliAkbar likes this.
  24. gjs32

    gjs32

    Joined:
    Feb 27, 2016
    Posts:
    10
    Hi @AliAkbar and all,

    I just got Dungeon Architect and am loving it, thank you for making it! I have one question:

    In the 2D builder, how would I go about accessing markers/grid cells adjacent to a certain marker/grid cell? For example, I'd like to check all grid cells next to an object generated by a marker emitter to see if they're empty/within walkable bounds. Sorry if this is a noob question but I can't find whatever collection I should be accessing in the documentation/script files. Thanks!
     
    AliAkbar likes this.
  25. Sehlor

    Sehlor

    Joined:
    Feb 10, 2012
    Posts:
    199
    Hey @AliAkbar Thanks for circular city thingy, comes handy, can you make a theme for it with top-down city?
    And how the other theme i requested coming along any news?

    Thanks for the freat updates.!
     
  26. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    I do something similar in the Survival Shooter game demo. Have a look at this script: DungeonArchitect_Samples\Game3D_SurvivalShooter\Scripts\AI\SpecialRoomFinder

    The script gets executed after the dungeon layout is built (it has to be added to your dungeon game object). I pick two rooms (in your case only one room) and place a level goal prefab and a player spawn prefab
     
  27. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @claudiorodriguescampos I'll explore that in the future
     
  28. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    1. I'll fix this in the next update
    2. I avoided this as it would give too much info to new users. I'll be adding an additional tab for emission rules (for creating new markers if the spatial setup passes)
    3. I do an internal sorting to make sure the spatial query system can find the emitted markers. Any markers that have mesh nodes assigned to it that uses spatial constraints are executed as late as possible. These nodes when executed might emit more markers themselves but the sorting follows the same rule above. I'm probably be providing a execution priority weight on the Marker nodes so you can fine tune this
    4. It works like you mentioned. The builder emits the core markers (like ground, wall etc) in the base pass. Then the theme picks them up and might emit more markers from there depending on how you define it
     
    neoshaman, Razmot and wolfen231 like this.
  29. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Hey @GJSIII, Thank you for using DA. This should work with the new spatial constraint system. However I missed to flip the YZ when dealing with 2D. I'll test it with 2D tomorrow and submit a new patch if a fix is required
     
    gjs32 likes this.
  30. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Hey @Sehlor I don't own Top Down city. I'll pick it up later.
     
  31. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
  32. Sehlor

    Sehlor

    Joined:
    Feb 10, 2012
    Posts:
    199
    @AliAkbar Any fantasy city theme would do with circular city builder ^^ Thanks for your work man i really appriciate all things you are doing!
     
    AliAkbar likes this.
  33. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    The themes that you create for Dungeon Architect using assets from Asset Store is a incredible way of increase popularity of Dungeon Architect.
    I like so much assets from Synty Studios. I am working with Simple Apocalipse now, if is possible, create a theme or for it.

    A theme from Synty Studios Polygon City Pack assets will be awesome too.
     
    AliAkbar likes this.
  34. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    I know this pack very well. So much more you could do. Bust out a second theme using the SAME base theme here and then use your platform volume spawner and random volume spawner to make it mix and match between good and evil hehe.
     
    AliAkbar likes this.
  35. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Attached the theme file with this post. You can use it if you own the Simple Fantasy Pack by Synty Studio

    I've added another cliff on the outer side to make the dungeon look like its built on a lava pit. It will also transition well with your external world



     

    Attached Files:

  36. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Added a selector rule that uses 2D value noise to select the lava tiles.
     
  37. Sehlor

    Sehlor

    Joined:
    Feb 10, 2012
    Posts:
    199
    AliAkbar likes this.
  38. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    AliAkbar likes this.
  39. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    Hi I bought your asset awhile ago and have been trying to use it for awhile. I get most of the core concepts but I can't for the life of me figure out the most basic thing. Setting up custom walls and floors.

    If I use a grid prefab a create a new theme. Set the grid to 4 by 1 by 4. Create a 4 by .25 by 4 ground box with probuilder and a 4 by 4 by .25 wall and add them to my Dungeon theme they are all offset and wrong when I build my Dungeon. Just a basic 4 by 2 by 4 dungeon.

    I've tried with some Synty products (the Heist pack and the Dungeon pack with similar results. All the walls and floors are offset and not connected correctly. I know I can offset each section in the inspector but that doesn't fix it.

    I honestly can't see what I'm doing wrong.
     
    AliAkbar likes this.
  40. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @somosky make sure the ground tiles first align. Turn on debug draw, you'll probably need to add offsets to the ground tiles (as the offsets in Synty's ground tiles are in the corner instead of center)
     
  41. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    If you are using PB might I suggest you select the bottom vertices of your walls or floors and set the pivot (alt j if I recall). Ensuring the pivot is centered and at bottom.

    If still having issues or just instant results as Ali said you need to adjust the offsets of the object in the theme editor. Click on your wall and look into the inspector and change its position / rotation / etc.

    He has some basic tutorial videos covering this on Youtube.
     
    AliAkbar likes this.
  42. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Selectively override only the markers you need and have DA fallback to the base theme for the missing markers. This saves you from re implementing the base theme details in the overridden theme

     
    wolfen231 likes this.
  43. KMonkey

    KMonkey

    Joined:
    Nov 12, 2012
    Posts:
    21
    Thanks for the response. I actually started to come up with another script before i read your reply and is working but decided to give your example a go. Is there any way I can do this before RoomCenter is executed? right now because it is done after the dungeon is built, I get my level goal prefab spawned over the RoomCenter prefabs which isnt ideal :)
     
  44. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    @AliAkbar I was curious if you could whip up something like this for the unity version of DA? Would be great.
    Fills in the lower walls for the empty space emitter so when you have multiple floors you don't have a giant gap.

     
  45. DarkArts-Studios

    DarkArts-Studios

    Joined:
    May 2, 2013
    Posts:
    389
    Hi,

    I'm using Dungeon Architect with Map Magic to create enemy bases and small friendly towns in an infinite procedural open world. ( https://darkartsstudios.itch.io/operation-dragonfly )

    The only issue I'm having is that I need the terrain "under" the Dungeon Architect generated "cities" flattened and lifted/lowered as done in other DA terrain demos.

    Is it possible to hook DA up to MapMagic terrains in this manner? Have you ever done so? I've attempted shoe-horning the existing terrain examples in, but can't get it to actually adjust the terrains. I fear I'm missing something.

    Do you have any experience with MapMagic and Dungeon Architect? Is it possible you could point me in the correct direction?

    Many Thanks
     
  46. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    It should be possible. If the terrain sample point is far away from a nearest dungeon cell, I'll lerp it to the original terrain height. It could be configured through a curve and a lerping distance

    I'll provide a sample for it
     
    DarkArts-Studios likes this.
  47. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    My vote for next feature is flow control.
     
    AliAkbar and Sehee26 like this.
  48. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    190
    i want to know something before i buy this asset. is it possible to make simple mazes with this asset?
    mazes like this, without rooms, only simple walls.
    and is it possible to make this in a area (Square, Rectangle) to get an 10x10 labyrinth or an 20x20 labyrinth ?
     
  49. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    @Diego_Graphics The algorithm is simple. I can add that in the next update
     
  50. AliAkbar

    AliAkbar

    Joined:
    Jun 30, 2014
    Posts:
    729
    Added mesh merging feature to reduce the draw calls for your mobile games

    A large dungeon with ~12,500 meshes (using the same material) rendered in just 35 draw calls. It supports merging of the level objects in patches so it works nicely with your camera's frustum culling. You can control the patch size. It also takes care of the 64K vertex limit per mesh. So if the combined patch mesh contains more than 64k vertices, it would split it into multiple meshes as needed within the patch

    With Merging [35 batches]:


    Without Merging [948 batches]: (using unity's internal static and dynamic batching)
     
    Arkade, ivanmotta and wolfen231 like this.