Phaser AE

Noise and procgen

Free packv3.0.0-42D and 3DLogic

Seeded noise functions and noise textures: the maths behind terrain heights, clouds, smoke, cracked earth and swirling flow. Every function is deterministic from its seed, and a field can be sampled as numbers or painted into the atlas as a tileable texture in one call.

This is a Free pack. Every phaser.io account can use it in their games.

Released October 14, 2026 · updated October 20, 2026

Noise and procgen: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

What it does

Noise is how a game gets values that are random but smooth: a height that rises and falls across a map, a cloud's density, a current that swirls. The pack gives the standard set as plain functions on game.procgen, and exports every one from the package for code that imports rather than composes. You make a permutation table from a seed with noisePerm, keep it, and sample Perlin noise, fractal sums and curl from it at whatever frequency you scale your coordinates by.

Fractal sums stack octaves of Perlin noise: fBm for rolling terrain and clouds, ridged noise for sharp crests such as mountain ridges, lightning and veins, turbulence for billows. Worley noise gives the distance to the nearest of one random point per cell, for cells, scales and cracked earth. curl2 turns a field into a divergence-free flow, so particles or smoke that follow it swirl rather than collecting in one place. Hashes give a repeatable random value per cell with no table at all.

When you want a picture rather than numbers, noiseData samples a whole field into a square grid of values from 0 to 1, noiseCanvas paints it, and noiseFrame puts it straight into the atlas under a key. Textures tile by default, and can be greyscale or white with the field as alpha, with an optional radial mask that fades it to a soft puff for smoke and steam.

Features

  • Perlin noise in 2D and 3D — perlin2 and perlin3, about -1 to 1, with a period in whole cells that makes it tile; the third axis can be time, to animate a 2D field.
  • Value and Worley noise — value2, cheaper and blockier, and worley2, the distance to the nearest cell point.
  • Fractal sums — fbm2, fbm3, ridged2 and turbulence2, shaped by octaves, lacunarity, gain and period.
  • Curl flow — curl2, a divergence-free 2D flow from fBm, for particles, smoke and water.
  • Hashes — hash2, hash3 and hashInts for a repeatable value per cell or a seed per slot.
  • Fields as data — noiseData returns a square grid of floats for any of five kinds: fbm, ridged, turbulence, worley or value.
  • Textures in the atlas — noiseFrame paints a tileable field under a key, greyscale or white with alpha, optionally masked to a radial puff.
  • Deterministic — every function takes its seed or table, and noiseFrame uses the game's seed unless given one.

Good for

  • Terrain heightfields in 2D or 3D: fBm for hills, ridged noise for mountain ranges.
  • Smoke, steam and cloud sprites made at load time with no image files, faded to a puff by the radial mask.
  • Swirling particle motion: embers, snow or foam drifting along a curl field.
  • Dissolve and displacement masks that need a field which tiles.
  • Cell patterns: cracked earth, scales or stone from Worley noise.
  • Per-tile variation in a tile map or a block world, with a hash per cell so the same cell always gets the same answer.

Make it yours

The pack has no options; every choice is in the call. Frequency is how far you scale your coordinates, octaves, lacunarity and gain shape the detail, period makes a field tile, and a texture's kind, size, cell, octaves and seed pick the field and its scale.

Two different uses: a 3D terrain that samples fbm2 with five octaves at a low frequency for its rolling ground and ridged2 for its peaks, from one table made once; and a 2D game that paints a 256-pixel smoke puff at load with noiseFrame('smoke', { alpha: true, mask: 'radial' }) and draws its particles with that frame, then sends them along curl2 so the smoke curls as it rises.

A quick look

A table, a few fields sampled at a point, and a texture into the atlas:

const p = game.procgen;
const perm = p.noisePerm(7);                                    // one table per field, kept
const h = p.fbm2(x * 0.01, y * 0.01, perm, { octaves: 5 });     // about -1..1
const [vx, vy] = p.curl2(x * 0.01, y * 0.01, perm);             // a divergence-free flow
const cells = p.worley2(x * 0.05, y * 0.05, 3);                 // 0 at a cell's point, about 1 between
const frame = p.noiseFrame('smoke', { size: 256, cell: 56, octaves: 3, alpha: true, mask: 'radial' });

Works with

  • particles-2d — a curl field to drift particles along, and a noise puff to draw them with.
  • rpg-world — its generated overworld uses this pack's noise.
  • levelgen — mazes, roguelike dungeons and caves, when you want structure rather than smooth noise.

Good to know

  • It is Perlin, not simplex: fine for textures and fields, a little grid-aligned at high octaves.
  • A texture tiles cleanly only when period is a whole number of cells.
  • noiseData runs on the CPU in time that grows with size squared times octaves, so a 1024-pixel, five-octave field takes a moment: make it once.
  • Worley noise gives the nearest cell point only, with no second-nearest distance.
  • Headless, noiseCanvas returns null and noiseFrame makes a blank frame.

More Logic packs

Show all →