libpcg is a small library for procedural content generation, containing some useful algorithms that can be used to generate textures, and demos using these algorithms. Processor-specific optimization is provided by liboil.

The intention is to create a small, portable library that can be used to deterministically generate content at runtime for applications such as games. Because it's MIT-licensed, you have very minimal requirements for your use of the library. While performance should be a goal, currently effort is being spent primarily on implementing useful algorithms.

It was inspired by reading about .kkrieger, and thinking how I wish some of these bloated games I install would use these techniques. What if there was a nice, well-licensed library that game developers could use, with some examples of ways to generate pretty textures?

Perlin noise as GL_LUMINANCE texture, using different seeds:

Three Perlin noise outputs as R,G,B channels in GL_RGB texture, using different seeds:

Turing reaction-diffusion system outputs with varying input factors, as GL_LUMINANCE texture:

Two-stage Turing reaction-diffusion system outputs with varying input factors, as GL_LUMINANCE texture (Da = .125, Db = .03125)

32000@s=.003,
8000@s=.015
8000@s=.006,
3000@s=.018
4000@s=.01,
3000@s=.03

Meinhardt reaction-diffusion system outputs with same seed but varying Dg factor, as GL_LUMINANCE texture (Dr = 0.0, Ds = .08, c = .002, gamma = .01, 16000 iterations)

Dg=.020 Dg=.016 Dg=.012

From there, ideas for future work:

Requirements:

Latest release:

Feel free to drop me an email at anholt@FreeBSD.org if you're using the library (I'd love to know), would like to see a CVS repo (I'm meaning to do this soon anyway), or have links to docs on great methods for procedural content generation.

Performance notes:

Luckily, liboil lets us take advantage of processor-specific optimizations with little code on our part. This has shown to be quite effective. Some notes about current performance:

Links to information used to produce this library:

Links to information I need to read more closely:

Last updated: 2005-11-11