
Blueprints
Blueprints are the backbone of the algorithm. They must exist in order for any rooms to generate. Blueprints are simply single-celled marks on a grid that tell the algorithm "a room can eventually spawn here". When the blueprints are done generating, a second pass parses the blueprints and generates rooms based on a set of rules. Think of how Rule Tiles work in game engines.
public class Blueprint
{
public readonly string CellID;
public readonly Vector3Int Position; // Position of blueprint coords on grid
public bool Available { get; set; } // Prevents/allows parsing algorithm to use blueprint
public bool[] EntryPointFlags { get; set; }
// Constructor
public Blueprint(Vector3Int position, string cellID = "Blueprint")
{
Available = true;
CellID = cellID;
Position = position;
EntryPointFlags = new bool[6]; // A flag to mark which entrances should be open for a room
}
}
To prevent blueprints from spawning on top of other blueprints, a Dictionary is used. A C# dictionary has O(1) lookup time, cannot contain duplicates, and can allocate space dynamically. To prevent rooms from spawning on top of each other, blueprints house a flag called Available that tells the room parser whether or not to include the blueprint in its check. Finally, EntryPointFlags tell the room which doorways it needs to open. These flags are determined during the blueprint pass of the algorithm.
Blueprint Operations are individual instruction-set style units of execution that can generate Blueprints in a specific pattern. This not only fosters a more organically catered dungeon but also makes the generation easy to debug by stepping through each operation individually one-by-one.


