API Reference › Noise
namespace

Noise

Procedural noise — the primitive that terrain, caves, biomes, textures, clouds, wind, and object placement are built on. Every generator is implemented in Q16.16 **fixed point** over an integer permutation hash seeded from an explicit seed, so a given seed reproduces the *exact* same field on every platform and every run: native, headless, and (later) wasm all agree bit-for-bit. That is a real edge over float-based engines, whose worlds can drift subtly across CPUs and break shared-seed multiplayer or replays. Coordinates are fixed values. The integer part of a coordinate selects a lattice cell and the fraction interpolates within it, so you scale feature size by sampling at a fractional *frequency* (e.g. multiply coordinates by 1/64). Outputs are fixed normalised to [-1, 1]; Noise.unit remaps that to [0, 1] when you want a height or a probability. Pick a generator by feel: value2 is cheap and blocky; perlin2 is the classic gradient noise; simplex2 is the organic default with fewer directional artifacts; fbm2 stacks octaves of simplex for natural, detailed fields; and cellular2 (Worley) gives Voronoi-cell structure for stone, cracks, and biome boundaries. Every sampler is a pure function of (x, y, seed) — no global state, no allocation — so it is safe to call across a whole worldgen pass or a per-pixel fill. Seed worldgen from its own seed (or a dedicated Random stream), kept separate from gameplay RNG, so generating the world never desyncs the simulation.

Noise.value2(x, y, seed) -> fixed2D value (lattice) noise, deterministic, in [-1, 1].Noise.perlin2(x, y, seed) -> fixed2D Perlin gradient noise, deterministic, in [-1, 1].Noise.simplex2(x, y, seed) -> fixed2D simplex noise, the organic default, in [-1, 1].Noise.fbm2(x, y, seed, octaves) -> fixedFractal Brownian motion — octaves of simplex, in [-1, 1].Noise.cellular2(x, y, seed) -> fixedWorley (cellular) F1 distance to the nearest cell point.Noise.cellular2_id(x, y, seed) -> intThe id of the nearest Worley cell — stable per cell.Noise.unit(n) -> fixedRemap a [-1,1] noise sample to [0,1].
← All symbols