Been working with the PCG plugin for generating random dungeon layouts. Finally got to a decent generator for blocking out rooms and hallways.
I'm following a common strategy:
- start with a set of points that represent rooms
- perform a Delaunay triangulation to get edges between rooms
- reduce the edges to a minimum spanning tree, I'm using Kruskal's algorithm here
- randomly select a small set of pruned edges to add back in
- generate hallways to connect rooms along the edges
I had to learn to make c++ nodes for the pcg graph to implement the triangulation and mst operations, as well as generating parameter data to represent the graph edges between the pcg point data.
Unreal has a Delaunay implementation I was able to use but I had to implement Kruskal myself.