
Procedural generation cheat sheet
PRNGs, noise functions, chunk based generation, pathfinding, wave function collapse, shape packing and all that good stuff.
If you're looking to use procedural generation in your game, you'll probably want to look into seeded PRNGs, noise functions, predefined chunk based generation, labyrinths, pathfinding, wave function collapse, shape packing, hexagonal maps, to just name a few.
Here are some of my favourite resources on the topic. Most of them are not specific for Construct developers, but all of them can be implemented in, or integrated into Construct (via JavaScript / TypeScript / WebAssembly).
Construct 3's toolset
If you're not a Construct dev, feel free to skip this section :)
- The Advanced Random plugin is a great start, it includes a seeded random number generator, a number of 2D & 3D noise functions, permutation and probability tables, gradients and other useful utilities. There's an official example for noise generation on a Drawing Canvas, and I have a template project that has a basic UI and displays the output on a Tilemap object.
You can also set Advanced Random as your "default" seeded random number generator, so it's used for therandomandchooseexpressions and for shuffling arrays. - If you're looking to generate smooth curves (eg. for a side-view 2D terrain), check out the Timeline controller object and it's Ease expression. I have a basic demo using multiple easing curves for smooth terrain generation.
- Construct's Tilemap object type has auto tiling & patch brush support which can be handy for generating terrains with good looking transitions.
Pseudorandom number generators (PRNGs)
- If you're interested in the inner workings, read up on pseudorandom number generators in general, and don't stop at linear congruential generators :). Certain cases might need cryptographically secure PRNGs. Thankfully, one is built into JavaScript.
- Here are some JavaScript implementations of seeded PRNGs and hashing functions, all under public domain license. I usually use
xmur3as the seed function andmulberry32as the PRNG.
Noise functions
- If you're new to noise functions, learn the basics of gradient noise and value noise.
- Wanna know how Perlin noise is generated? Check out these videos.
- Check out fall-off maps for generating noise based landmass surrounded by water.
Wave function collapse
- This GitHub repo is a great starting point, it has a detailed explanation on how WFC works and links to lots of implementations, including a JavaScript one.
- My favourite videos on WFC are this and this.
Other algorithms / libraries
- The open-source rot.js library has a lot of features aimed to help roguelike development, including map generation and pathfinding, with hexagonal maps too. It has an excellent interactive manual.
- Rectangle or other shape packing algorithms can be useful for room layouts, puzzle generation, placing pre-made or generated chunks on a larger level, etc. For a very neat JavaScript implementation of rectangle packing, check out the Max Rects Packer library.
- Spelunky has a very cool chunk-based level generator using solution paths and room templates. This article sheds some light on how it works and also has a nice interactive demo.
- Cellular automaton algorithms can also be utilised to generate mazes, caves and other structures. Notable libraries include cellauto.js and the previously mentioned rot.js.



