CROOMUMODULE

Overview

The CROOMUMODULE is a procedural room and corridor generation system. It creates clusters of rectangular rooms connected by MST-based corridors, with Delaunay triangulation for connectivity and configurable relaxation algorithms for layout.

Depends on CCOREUMODULE.

Functionalities Overview
Data Configuration structures for room generation (FCRoomClusterStruct, FCRoomMakerStruct, FCRoomDetailStruct)
Spawner ACRoomSpawner actor that drives room generation at runtime, tracking a pawn
Roommaker UCRoommaker core class that builds clusters, rooms, corridors, collision and overlap events
Metadata UCClusterMetadata and UCRoomMetadata store per-cluster and per-room runtime data (doors, tags, fog of war)
Blueprint Blueprint-callable functions for room retrieval and room-quest interaction (UCRoomBPLibrary)

Architecture

The room generation pipeline works as follows:

  1. ACRoomSpawner is placed in the level with a reference to a DataTable row (FCRoomClusterStruct) and a pawn to track.
  2. On tick, the spawner delegates to UCRoommaker::buildASync which runs room generation asynchronously.
  3. For each cluster, rooms are randomly positioned then relaxed using a configurable algorithm (CAlgoRelaxType) until stable.
  4. Clusters themselves are relaxed in a second pass to avoid overlap.
  5. Delaunay triangulation computes room connectivity, then a Minimum Spanning Tree (MST) determines corridors.
  6. Corridor edges can be broken with noise for organic shapes.
  7. Rooms and clusters are assigned to spatial cells for fast lookup (closestRoom, closestCluster, nearEdge).
  8. On finalization, UCRoomMetadata and UCClusterMetadata are created with door positions, tags, and optional per-cluster noise.
  9. Box collisions are spawned per room for overlap detection, triggering quest and skill interactions.
  10. A longest-path algorithm orders rooms along the MST for progression-based gameplay.