Struct MapOverlaySettings
Immutable settings for map overlay operations applied by ProceduralMapOverlay.
Inherited Members
Namespace: Scylla.Core.Util.ProceduralMapGen
Assembly: ScyllaCore.dll
Syntax
public readonly struct MapOverlaySettings
Remarks
Map overlays add secondary visual detail to an already-generated grid without rebuilding it from scratch. ProceduralMapOverlay provides three overlay operations, each controlled by a different subset of this struct's fields:
- Noise overlay
(ApplyNoiseOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource)) - samples a coherent
noise field and writes
targetValueto cells whose noise exceeds Threshold. Configurable via Noise and Threshold. - Pattern overlay (ApplyPatternOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings)) - stamps a repeating geometric pattern onto the grid. Configurable via Pattern.
- Random scatter
(ApplyRandomScatter(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource)) - randomly selects a
fraction of eligible cells to write
targetValue. Configurable via ScatterDensity.
All three operations respect OnlyAffectFloors: when true,
only cells that currently match the caller-supplied floorValue argument
are eligible for modification, leaving wall cells and any custom cell types intact.
A single MapOverlaySettings instance is shared across all three overlay methods. Unused fields are simply ignored by each method, so the same settings object may be reused across multiple overlay passes.
Constructors
MapOverlaySettings(NoiseSettings, float, MapPatternType, bool, float)
Initializes a new MapOverlaySettings with the specified parameters.
Declaration
public MapOverlaySettings(NoiseSettings noise, float threshold = 0.3, MapPatternType pattern = MapPatternType.Checker, bool onlyAffectFloors = true, float scatterDensity = 0.1)
Parameters
| Type | Name | Description |
|---|---|---|
| NoiseSettings | noise | Noise generation settings used by ApplyNoiseOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource). See NoiseSettings for available presets. |
| float | threshold | Noise value threshold for the noise overlay. Cells with noise strictly above this
value are modified. Typical useful range is approximately |
| MapPatternType | pattern | Geometric pattern type for ApplyPatternOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings). Defaults to Checker. |
| bool | onlyAffectFloors | When |
| float | scatterDensity | Fraction of eligible cells modified by ApplyRandomScatter(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource).
Range [0.0, 1.0]. Defaults to |
Fields
Default
Default preset: Default noise,
threshold 0.3, checker pattern, floors-only restriction, and 10 % scatter
density. Suitable as a general-purpose starting point for detail overlays.
Declaration
public static readonly MapOverlaySettings Default
Field Value
| Type | Description |
|---|---|
| MapOverlaySettings |
Noise
Noise generation configuration used by ApplyNoiseOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource).
Declaration
public readonly NoiseSettings Noise
Field Value
| Type | Description |
|---|---|
| NoiseSettings |
Remarks
Controls the algorithm (e.g. OpenSimplex2), fractal layering type, sampling frequency, octave count, lacunarity, and persistence of the noise field that determines which cells the noise overlay modifies. Ignored by pattern and scatter overlay operations. See NoiseSettings for available presets.
See Also
OnlyAffectFloors
Whether overlay operations are restricted to cells whose current value matches the
caller-supplied floorValue argument.
Declaration
public readonly bool OnlyAffectFloors
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
When true, all three overlay operations skip any cell that does not match
the floorValue passed to the overlay method. This prevents overlays from
overwriting wall cells, corridor cells, door cells, or any other non-floor cell
type, preserving the structural integrity of the map.
Set to false only when the overlay is intended to modify all cells
regardless of type - for example, when painting a full-grid watermark or
applying a texture-like variation that should affect both walls and floors.
Pattern
Geometric pattern applied by ApplyPatternOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings).
Declaration
public readonly MapPatternType Pattern
Field Value
| Type | Description |
|---|---|
| MapPatternType |
Remarks
Determines the repeating tile pattern stamped onto the grid. Available patterns include Checker, diagonal and axis-aligned stripes, and a perimeter Border ring. This field is ignored by noise and scatter overlay operations.
See Also
ScatterDensity
Fraction of eligible cells that receive targetValue during a
ApplyRandomScatter(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource) pass. Range is [0.0, 1.0].
Declaration
public readonly float ScatterDensity
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Each eligible cell (filtered by OnlyAffectFloors) is independently
tested against this value using a uniform random roll. A value of 0.0
scatters nothing; a value of 1.0 marks every eligible cell. Typical values
for sparse decoration are in the range 0.05-0.2. This field is
ignored by noise and pattern overlay operations.
Threshold
Noise value above which a cell is modified by ApplyNoiseOverlay(ScyllaSquareGrid<int>, int, int, MapOverlaySettings, IRandomSource).
Declaration
public readonly float Threshold
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Coherent noise algorithms return values in approximately [-1, 1]. Cells with a
sampled noise value strictly greater than this threshold receive targetValue.
Raising the threshold reduces the number of affected cells; lowering it increases
coverage. A value of 0.3 affects roughly the top 35 % of noise values for
most algorithms. This field is ignored by pattern and scatter overlay operations.
Methods
Lerp(MapOverlaySettings, MapOverlaySettings, float)
Linearly interpolates between two MapOverlaySettings instances and returns a new blended settings struct.
Declaration
public static MapOverlaySettings Lerp(MapOverlaySettings a, MapOverlaySettings b, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| MapOverlaySettings | a | Start settings returned when |
| MapOverlaySettings | b | End settings returned when |
| float | t | Interpolation factor. Values outside [0, 1] are clamped before use. |
Returns
| Type | Description |
|---|---|
| MapOverlaySettings | A new MapOverlaySettings with Threshold and
ScatterDensity linearly blended and all other fields switching at
|
Remarks
Threshold and ScatterDensity are interpolated as floats without rounding.
Noise, Pattern, and OnlyAffectFloors
cannot be meaningfully interpolated (noise contains enums; pattern is an enum;
onlyAffectFloors is a boolean). All three take the value from
a when t < 0.5 and from b
when t >= 0.5.