Class ProceduralMapOverlay
Overlay utilities for adding secondary visual detail to already-generated maps. Provides three overlay categories: noise-based, geometric pattern, and random scatter. Overlays modify cells in an existing grid - they do not generate levels from scratch and should always be applied after a ProceduralMapGenerator algorithm has run.
Inherited Members
Namespace: Scylla.Core.Util.ProceduralMapGen
Assembly: ScyllaCore.dll
Syntax
public static class ProceduralMapOverlay
Remarks
Each overlay category has three overloads:
- Single-grid: reads and writes the same ScyllaSquareGrid<TCell> or ScyllaHexGrid<TCell> in-place.
-
Dual-grid (square only): reads eligibility from a
sourceGridand writes results to a separateoverlayGrid. The effective region is clamped to the smaller of the two grids' dimensions in each axis. - Hex: evaluates noise or patterns in world-space at each hex cell's center.
When OnlyAffectFloors is true, only cells
matching floorValue are eligible for modification. Wall cells and corridor cells
are left untouched. Set this to false to apply the overlay unconditionally.
Methods
ApplyNoiseOverlay(ScyllaHexGrid<int>, int, int, MapOverlaySettings, IRandomSource)
Applies a noise-based overlay to a hex grid.
Evaluates noise in world-space at each hex cell's center position using
Fractal2D(float, float, NoiseSettings) when a fractal type is configured,
or Evaluate2D(float, float, NoiseAlgorithm) scaled by
Frequency otherwise.
Cells where the noise value exceeds Threshold
are set to targetValue.
Declaration
public static void ApplyNoiseOverlay(ScyllaHexGrid<int> grid, int targetValue, int floorValue, MapOverlaySettings settings, IRandomSource rng)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaHexGrid<int> | grid | The hex grid to modify in-place. |
| int | targetValue | The cell value to write where the overlay applies. |
| int | floorValue | The cell value that represents floor (used when OnlyAffectFloors is |
| MapOverlaySettings | settings | Overlay settings (noise configuration, threshold, and floor-only flag). |
| IRandomSource | rng | Random source for noise seed derivation. |
ApplyNoiseOverlay(ScyllaSquareGrid<int>, ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource)
Applies a noise-based overlay to a separate overlay grid, reading floor eligibility
from a source grid without modifying it. The effective area is the intersection of
both grids (minimum width and height). Values are written only to overlayGrid.
Declaration
public static void ApplyNoiseOverlay(ScyllaSquareGrid<int> sourceGrid, ScyllaSquareGrid<int> overlayGrid, int targetValue, int floorValue, MapOverlaySettings settings, IRandomSource rng)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<int> | sourceGrid | The source grid used to check floor eligibility (not modified). |
| ScyllaSquareGrid<int> | overlayGrid | The overlay grid to write |
| int | targetValue | The cell value to write where the overlay applies. |
| int | floorValue | The cell value that represents floor in |
| MapOverlaySettings | settings | Overlay settings (noise configuration, threshold, and floor-only flag). |
| IRandomSource | rng | Random source for noise seed derivation. |
ApplyNoiseOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource)
Applies a noise-based overlay to a square grid in-place.
Fills a noise buffer via Fill2D(float[], int, int, NoiseSettings, float, float), then sets each cell to
targetValue where the noise value exceeds
Threshold.
When OnlyAffectFloors is true, only cells
matching floorValue are eligible for modification.
Declaration
public static void ApplyNoiseOverlay(ScyllaSquareGrid<int> grid, int targetValue, int floorValue, MapOverlaySettings settings, IRandomSource rng)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<int> | grid | The square grid to modify in-place. |
| int | targetValue | The cell value to write where the overlay applies. |
| int | floorValue | The cell value that represents floor (only used when OnlyAffectFloors is |
| MapOverlaySettings | settings | Overlay settings (noise configuration, threshold, and floor-only flag). |
| IRandomSource | rng | Random source for noise seed derivation. |
ApplyPatternOverlay(ScyllaHexGrid<int>, int, int, MapOverlaySettings)
Applies a geometric pattern overlay to a hex grid.
Pattern matching uses the local zero-based (col, row) position derived by subtracting
QMin and RMin from each cell's axial coordinates, so patterns are
aligned to the grid's own origin regardless of its world-space offset.
Declaration
public static void ApplyPatternOverlay(ScyllaHexGrid<int> grid, int targetValue, int floorValue, MapOverlaySettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaHexGrid<int> | grid | The hex grid to modify in-place. |
| int | targetValue | The cell value to write where the pattern applies. |
| int | floorValue | The cell value that represents floor (used when OnlyAffectFloors is |
| MapOverlaySettings | settings | Overlay settings (pattern type and floor-only flag). |
ApplyPatternOverlay(ScyllaSquareGrid<int>, ScyllaSquareGrid<int>, int, int, MapOverlaySettings)
Applies a geometric pattern overlay to a separate overlay grid, reading floor eligibility
from a source grid without modifying it. The effective area is the intersection of
both grids (minimum width and height). Values are written only to overlayGrid.
Declaration
public static void ApplyPatternOverlay(ScyllaSquareGrid<int> sourceGrid, ScyllaSquareGrid<int> overlayGrid, int targetValue, int floorValue, MapOverlaySettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<int> | sourceGrid | The source grid used to check floor eligibility (not modified). |
| ScyllaSquareGrid<int> | overlayGrid | The overlay grid to write |
| int | targetValue | The cell value to write where the pattern matches. |
| int | floorValue | The cell value that represents floor in |
| MapOverlaySettings | settings | Overlay settings (pattern type and floor-only flag). |
ApplyPatternOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings)
Applies a geometric pattern overlay to a square grid in-place.
Each eligible cell is tested against the pattern defined by
Pattern; matching cells are set to
targetValue.
Declaration
public static void ApplyPatternOverlay(ScyllaSquareGrid<int> grid, int targetValue, int floorValue, MapOverlaySettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<int> | grid | The square grid to modify in-place. |
| int | targetValue | The cell value to write where the pattern matches. |
| int | floorValue | The cell value that represents floor (only used when OnlyAffectFloors is |
| MapOverlaySettings | settings | Overlay settings (pattern type and floor-only flag). |
ApplyRandomScatter(ScyllaHexGrid<int>, int, int, MapOverlaySettings, IRandomSource)
Randomly sets a fraction of eligible hex cells to the specified value. Each eligible cell is independently tested with a uniform roll against ScatterDensity to determine whether it is scattered. Useful for placing decorative or special tiles sparsely across a hex map.
Declaration
public static void ApplyRandomScatter(ScyllaHexGrid<int> grid, int targetValue, int floorValue, MapOverlaySettings settings, IRandomSource rng)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaHexGrid<int> | grid | The hex grid to modify in-place. |
| int | targetValue | The cell value to write for scattered cells. |
| int | floorValue | The cell value that represents floor (used when OnlyAffectFloors is |
| MapOverlaySettings | settings | Overlay settings (ScatterDensity and floor-only flag). |
| IRandomSource | rng | Random source for deterministic output. |
ApplyRandomScatter(ScyllaSquareGrid<int>, ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource)
Randomly sets a fraction of eligible cells to the specified value, writing to a
separate overlay grid while reading floor eligibility from a source grid.
The effective area is the intersection of both grids (minimum width and height).
Values are written only to overlayGrid.
Declaration
public static void ApplyRandomScatter(ScyllaSquareGrid<int> sourceGrid, ScyllaSquareGrid<int> overlayGrid, int targetValue, int floorValue, MapOverlaySettings settings, IRandomSource rng)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<int> | sourceGrid | The source grid used to check floor eligibility (not modified). |
| ScyllaSquareGrid<int> | overlayGrid | The overlay grid to write |
| int | targetValue | The cell value to write for scattered cells. |
| int | floorValue | The cell value that represents floor in |
| MapOverlaySettings | settings | Overlay settings (ScatterDensity and floor-only flag). |
| IRandomSource | rng | Random source for deterministic output. |
ApplyRandomScatter(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource)
Randomly sets a fraction of eligible cells to the specified value on a square grid in-place. Each eligible cell is independently tested with a uniform roll against ScatterDensity to determine whether it is scattered. Useful for placing decorations, special tiles, or other sparse detail.
Declaration
public static void ApplyRandomScatter(ScyllaSquareGrid<int> grid, int targetValue, int floorValue, MapOverlaySettings settings, IRandomSource rng)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<int> | grid | The square grid to modify in-place. |
| int | targetValue | The cell value to write for scattered cells. |
| int | floorValue | The cell value that represents floor (only checked when OnlyAffectFloors is |
| MapOverlaySettings | settings | Overlay settings (ScatterDensity and floor-only flag). |
| IRandomSource | rng | Random source for deterministic output. |