DunGen is a Unity editor extension that lets you generate procedural dungeon-style layouts at runtime quickly and easily, with no programming required.
The extension uses a room-based approach that allows you to design and create segments of a level as you usually would inside unity. Simply create a prefab that represents a “room” in your dungeon, specify doorway positions, and let DunGen generate your procedural dungeons.
DunGen also provides several options for randomizing props that appear in your dungeon, all fully customizable with user-defined weights and limits. DunGen is designed to satisfy as many requirements as possible without encroaching in “game-specific” territory. The full source-code is also available if you need additional, specific, features or adjustments.
The latest version of DunGen can always be found here. Beta builds and builds that are pending Asset Store approval are posted here first.
Yes. DunGen works just as well with 2D games as it does with 3D. There’s even a (very) simple 2D demo scene included.
DunGen can generate dungeon layouts entirely in the editor if you’d like. Just use the window located on the main menu under “Window > DunGen > Generate Dungeon”.
The random number generator used by DunGen is seeded. If you need your players to be able to revisit a previous floor, for example, you would store the seed used to generate that floor; DunGen could then take that seed and generate an identical layout (including props). Of course, you’d need to also save any changes that were made to the dungeon (such as chests being opened) and re-apply them once DunGen has finished generating the layout.
While DunGen wasn’t made with outdoor scenes in mind, it doesn’t care what is contained within a tile. These are a few things you’ll have to consider when using DunGen in an outdoor setting:
- DunGen was made for interior scenes, so in order to avoid your scene looking like a corridor, each tile will need to be fairly large.
- You’ll need a way to cover any tile edges that aren’t connected. The best way to do this is to have a cliff mesh (or some other large, natural structure) that blocks the edge of the tile. You’d then use a doorways “Add when NOT in use” list to make this mesh vanish when the tile is connected along that edge.
- Standard portal culling won’t provide much benefit (if any) when your doorways stretch the length of your tile. You’ll need to make use of some other culling solution.
There are no strict requirements when it comes to the assets you use with DunGen. Any modular art pack should work without issue (although if you’re mixing packs, it’s best if all of the art uses the same grid size).