This is a minimal example of using Perlin noise to generate a map. The basic idea is that you sample the noise function for each pixel and it becomes the “elevation” of that point. In this sketch I use that value to color the pixel according to a color ramp, which generates something like a terrain map.

You can take this idea much, much further. Red Blob Games has a great post if you want to dig deeper.

Refresh for a new map.

<< go back • open the code in the p5.js editor