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 :)

Pseudorandom number generators (PRNGs)

Noise functions

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.

 

This article was updated on

Related posts

Organization
Illustration: a chicken sitting on a bunch of books

Sheet management

An article on function sheets, action sheets, value sheets, top level sheets... oh, and event sheets of course. And emojis.