Struct NoiseThresholdSettings
Immutable settings for the Noise-Threshold map generation algorithm.
Inherited Members
Namespace: Scylla.Core.Util.ProceduralMapGen
Assembly: ScyllaCore.dll
Syntax
public readonly struct NoiseThresholdSettings
Remarks
The Noise-Threshold algorithm samples a coherent noise field across every cell of
the grid and compares the sampled value against Threshold to decide
whether each cell becomes a wall or a floor. By default, noise values
above the threshold are carved to floor and values at or below it remain
as walls. Setting Invert to true reverses this comparison
so that low-noise areas become floor instead.
The noise field itself is configured via the Noise field, which controls the algorithm (e.g. OpenSimplex2), fractal layering method, sampling frequency, octave count, lacunarity, and persistence. See NoiseSettings for available presets. Caves is the recommended starting preset for cave-like levels.
This algorithm supports square, hex, and triangle grids. Pass the completed settings struct to the appropriate ProceduralMapGenerator overload.
Constructors
NoiseThresholdSettings(NoiseSettings, float, bool)
Initializes a new NoiseThresholdSettings with the specified parameters.
Declaration
public NoiseThresholdSettings(NoiseSettings noise, float threshold = 0, bool invert = false)
Parameters
| Type | Name | Description |
|---|---|---|
| NoiseSettings | noise | Noise generation settings controlling the algorithm, fractal type, frequency, and octave parameters. See NoiseSettings for available presets. |
| float | threshold | Noise value boundary separating floor from wall. Typical useful range is
approximately |
| bool | invert | When |
Fields
Default
Default preset: Caves noise,
threshold 0.0, no inversion. Produces balanced cave networks with
approximately 50 % floor coverage.
Declaration
public static readonly NoiseThresholdSettings Default
Field Value
| Type | Description |
|---|---|
| NoiseThresholdSettings |
Dense
Dense preset: Caves noise,
threshold -0.15, no inversion. Lowers the cutoff to include more
cells as floor, producing larger, more open cave networks with fewer walls.
Declaration
public static readonly NoiseThresholdSettings Dense
Field Value
| Type | Description |
|---|---|
| NoiseThresholdSettings |
Invert
Whether to invert the threshold comparison so that cells with noise values at or below the threshold become floor instead of those above it.
Declaration
public readonly bool Invert
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
When false (default): cells where noise > Threshold
become floor. This favors high-noise areas as walkable space, suitable for
cave interiors that emerge in the high-value peaks of the noise field.
When true: cells where noise <= Threshold become
floor. This favors low-noise areas, producing isolated island-like floor
patches surrounded by walls - suitable for archipelago or scattered-room
layouts. Combine with a higher Threshold (e.g. 0.2) to
limit the number of islands.
Islands
Islands preset: Caves noise,
threshold 0.2, inverted. Produces scattered isolated floor patches in a
sea of walls - suitable for archipelago or stepping-stone map styles.
Declaration
public static readonly NoiseThresholdSettings Islands
Field Value
| Type | Description |
|---|---|
| NoiseThresholdSettings |
Remarks
Because the comparison is inverted, only cells with noise <= 0.2 become floor. Pairing this preset with a MapGenSettings that has EnsureConnectivity enabled will carve corridors to link the islands if connected navigation is required.
Noise
Noise generation configuration: algorithm, fractal type, frequency, octave count, lacunarity, and persistence.
Declaration
public readonly NoiseSettings Noise
Field Value
| Type | Description |
|---|---|
| NoiseSettings |
Remarks
The noise algorithm determines the character of the generated map. Caves (4-octave FBM OpenSimplex2 at frequency 0.05) is recommended for cave systems. Terrain produces smoother height-map-like output suitable for outdoor terrain. See NoiseSettings for the full list of presets.
See Also
Threshold
The noise value boundary that separates floor cells from wall cells.
Declaration
public readonly float Threshold
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Coherent noise algorithms typically return values in the approximate range [-1, 1] for single-octave evaluation and a similar range for fractal variants (depending on fractal type, octave count, and persistence).
By default (Invert = false):
A threshold of 0.0 produces roughly 50 % floor coverage (depending on
the noise distribution). Raising the threshold reduces floor coverage; lowering
it increases floor coverage.
When Invert is true, the comparison is reversed:
low-noise cells become floor and high-noise cells become wall.
Methods
Lerp(NoiseThresholdSettings, NoiseThresholdSettings, float)
Linearly interpolates between two NoiseThresholdSettings instances and returns a new blended settings struct.
Declaration
public static NoiseThresholdSettings Lerp(NoiseThresholdSettings a, NoiseThresholdSettings b, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| NoiseThresholdSettings | a | Start settings returned when |
| NoiseThresholdSettings | b | End settings returned when |
| float | t | Interpolation factor. Values outside [0, 1] are clamped before use. |
Returns
| Type | Description |
|---|---|
| NoiseThresholdSettings | A new NoiseThresholdSettings with Threshold linearly
blended and Noise / Invert switching at |
Remarks
Threshold is interpolated as a float without rounding.
Noise and Invert cannot be meaningfully
interpolated (noise settings contain enums; invert is a boolean). Both take
the value from a when t < 0.5 and from
b when t >= 0.5.