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:
ACRoomSpawneris placed in the level with a reference to aDataTablerow (FCRoomClusterStruct) and a pawn to track.- On tick, the spawner delegates to
UCRoommaker::buildASyncwhich runs room generation asynchronously. - For each cluster, rooms are randomly positioned then relaxed using a configurable algorithm (
CAlgoRelaxType) until stable. - Clusters themselves are relaxed in a second pass to avoid overlap.
- Delaunay triangulation computes room connectivity, then a Minimum Spanning Tree (MST) determines corridors.
- Corridor edges can be broken with noise for organic shapes.
- Rooms and clusters are assigned to spatial cells for fast lookup (
closestRoom,closestCluster,nearEdge). - On finalization,
UCRoomMetadataandUCClusterMetadataare created with door positions, tags, and optional per-cluster noise. - Box collisions are spawned per room for overlap detection, triggering quest and skill interactions.
- A longest-path algorithm orders rooms along the MST for progression-based gameplay.