unfurl

Dungeons

Cyclic lock-and-key dungeon generation on a grid for Unreal Engine.

Cyclic lock-and-key dungeon generation on a grid for Unreal Engine.

๐Ÿ‘€ Summary

NsDungeons makes dungeon floors with a lock-and-key structure, after the cyclic method of Unexplored. It gives an abstract graph on a fixed grid (rooms, doors, locks, keys, one-way doors, and hidden doors) and a cell layout of that graph. An editor tab shows each step of a generation.

NsDungeons does not build game floors, move characters, or find paths. Your game builds its floor from the layout. The demo actor builds a plain greybox floor only to show the plugin.

NsDungeons Preview

๐Ÿ“ฆ Features

โš™๏ธ Requirements

๐Ÿ› ๏ธ Installation

  1. Clone or download this repository.
  2. Copy the NsDungeons folder into the Plugins folder of your project.
  3. Add "NsDungeons" to the dependencies of the game module that calls the generator.
  4. Generate the project files and enable the plugin.

๐Ÿš€ Getting Started

  1. In the Content Browser, make a Data Asset of the class NsDungeonRuleSet.
  2. Call the generator with the rule set and a seed:
#include "NsDungeonGenerator.h"

const FNsDungeonResult Result = FNsDungeonGenerator::Generate(RuleSet->Settings, Seed);
if (Result.bValid)
{
    for (const FNsDungeonNode& Node : Result.Graph.Nodes)
    {
        // Node.Role, Node.Coord, Node.Tags: one room for each used node
    }

    // Result.Layout: Cells, Rooms, and Doors for the floor builder
}

In Blueprint, Generate Dungeon (rule set, seed) returns the result with its graph and its layout. Get Layout Cell, Cell To Local, and Local To Cell read the cells.

To see the plugin work, open the map /NsDungeons/Demo/L_NsDungeonsDemo and click Play. Push N or P to change the seed, and R for a random seed. Push 1 to 8 to show the graph of a step, and 0 to hide it.

NsDungeons Demo

๐ŸŒ€ Major Cycle Types

Type Shape
Simple Two routes to the goal, no lock
LockAndKey The goal is behind a lock. Its key is at the end of the other route, which a one-way door closes off from the goal
TwoKeys As LockAndKey, with a second key halfway along the locked route
OneWayValve One route to the goal. The other route is a one-way way back from the goal

๐Ÿ”ง API

Data

Main Functions

๐Ÿšง Limits

๐Ÿงพ Acknowledgement

The generation follows the cyclic dungeon method of Unexplored, as Boris the Brave describes it (2021).

๐Ÿ“š Documentation


Contact