Struct MapGenResult<TCoord>
Contains the full metadata produced by a ProceduralMapGenerator algorithm after it
has finished carving and post-processing a map grid. Every public ProceduralMapGenerator
method returns one of these alongside the in-place modified grid.
The metadata is stratified by the post-processing flags set in MapGenSettings:
-
Rooms is populated only when
DetectRooms is
true; otherwise it is an empty list. - Corridors is populated only for algorithms that carve explicit corridors (BSP and Room-and-Corridor); cave or noise-based algorithms return an empty list.
-
SpawnPoints is populated only when
FindSpawns is
true; otherwise it is an empty list. - ConnectedComponentCount is always computed after generation and reflects the state of the grid after any connectivity-repair post-processing (see EnsureConnectivity).
Inherited Members
Namespace: Scylla.Core.Util.ProceduralMapGen
Assembly: ScyllaCore.dll
Syntax
public readonly struct MapGenResult<TCoord> where TCoord : struct, IEquatable<TCoord>
Type Parameters
| Name | Description |
|---|---|
| TCoord | The grid coordinate type used by the map. Must be a value type implementing
IEquatable<T>. Common choices are |
Constructors
MapGenResult(List<MapRoom<TCoord>>, List<MapCorridor<TCoord>>, int, List<TCoord>)
Initializes a new MapGenResult<TCoord> with the specified metadata collections. This constructor is called internally by ProceduralMapGenerator algorithms and is generally not needed in consumer code.
Declaration
public MapGenResult(List<MapRoom<TCoord>> rooms, List<MapCorridor<TCoord>> corridors, int connectedComponentCount, List<TCoord> spawnPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| List<MapRoom<TCoord>> | rooms | All detected rooms. Pass an empty (non-null) list when room detection is disabled. |
| List<MapCorridor<TCoord>> | corridors | All carved corridors. Pass an empty (non-null) list for algorithms that do not carve explicit corridors. |
| int | connectedComponentCount | The number of connected floor components in the final grid. Should be |
| List<TCoord> | spawnPoints | Suggested spawn point coordinates. Pass an empty (non-null) list when spawn detection is disabled. |
Fields
ConnectedComponentCount
The number of distinct connected floor components found in the grid after all
post-processing steps have been applied. A value of 1 indicates a fully
connected map where every floor cell is reachable from every other floor cell.
Values greater than 1 indicate isolated floor islands that are not mutually
reachable - this should only occur when EnsureConnectivity
is false.
This count is always computed regardless of other post-processing flags and represents the definitive connectivity state of the grid at the moment the result is returned.
Declaration
public readonly int ConnectedComponentCount
Field Value
| Type | Description |
|---|---|
| int |
Corridors
All corridor segments carved between rooms during generation, in the order they were produced. Each element identifies the two connected rooms by their ID and lists every grid coordinate that forms the corridor path.
This list is only populated by algorithms that explicitly carve corridors - currently BSP (ProceduralMapGenerator BSP method) and Room-and-Corridor (ProceduralMapGenerator RoomCorridor method). All other algorithms (Drunkard's Walk, Cellular Automata, Noise Threshold, Maze, Voronoi) return a non-null but empty list.
Declaration
public readonly List<MapCorridor<TCoord>> Corridors
Field Value
| Type | Description |
|---|---|
| List<MapCorridor<TCoord>> |
Rooms
All rooms detected in the generated map via flood-fill analysis. Each element
describes one contiguous floor region with its bounding box, approximate center, and
cell list. The list is in discovery order - room IDs correspond to list indices, so
Rooms[n].ID == n always holds for results produced by ProceduralMapGenerator.
This list is only populated when DetectRooms is
true. When detection is disabled, the list is non-null but empty.
For BSP and Room-and-Corridor algorithms the rooms correspond directly to the rectangular areas carved by the algorithm. For cave or walk-based algorithms the rooms represent the organic connected components found by the flood-fill pass.
Declaration
public readonly List<MapRoom<TCoord>> Rooms
Field Value
| Type | Description |
|---|---|
| List<MapRoom<TCoord>> |
SpawnPoints
Suggested spawn point coordinates selected by the post-processing spawn-detection pass. The number of points is controlled by SpawnCount, and the algorithm attempts to place them as far apart as possible from each other within the generated floor area to maximize spatial separation.
The cells at these coordinates have been written to the grid with the FloorValue value (they remain passable floor cells) unless the caller explicitly overwrites them with a Spawn value after generation.
This list is only populated when FindSpawns is
true. When spawn detection is disabled, the list is non-null but empty.
Declaration
public readonly List<TCoord> SpawnPoints
Field Value
| Type | Description |
|---|---|
| List<TCoord> |
Methods
ToString()
Returns a human-readable string representation of this generation result for debugging purposes, including room count, corridor count, connected component count, and spawn point count.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string of the form
|