Procedural Assets

Assets vs. Stories

For purposes of this discussion, I will use the word content to refer to the non-code components of a game project (which, for many years now, represents by far the greatest effort), and then divide this into stories (i.e. the experiences a player is intended to have while playing the game) and assets (the props used to create the sensory experience — generally comprising images, 3d models, animations, sound clips, "level" maps, complex custom data structures, etc.).

Stories and assets are not clearly delineated, e.g. a "story" might comprise both a written script, images of the text of the dialog in that script, voice acting of that dialog, and animations of 3D models acting scenes in the script — where does "story" end and "asset" start? (It should be noted that data and code are — almost by definition -- not clearly delineated either!)

Why Procedural Assets?

The focus of my project is on dynamic (or procedural) story generation not procedural asset creation, but my game engine uses procedural asset generation as well for several reasons.

  1. It allows a reasonable amount of content to be generated at relatively low cost/effort
  2. A procedurally generated universe provides specific challenges to procedurally generated story (i.e. it exposes "hard-coded" assumptions, e.g. where things are in relation to each other).
  3. Solving the problem of binding procedural narrative to procedural content seems especially apropos given the resurgence of games with procedural content that are notably lacking in narrative content (e.g. Spore, No Man's Sky).

Key Algorithms and Techniques

The heart of the procedural content system is a good pseudo-random number generator often abbreviated to PRNG. For this, I am using the Mersenne Twister, based on an implementation originally by Makoto Matsumoto and Takuji Nishimura, and ported to C# by someone called mitil.

Another useful tool for procedural content generation is random pattern generation. Pattern generators with different useful characteristics are the heart of most 3D material systems today, and pretty much all procedural landscape generation (e.g. creation of landforms and distribution of vegetation). Many of these in turn rely on PRNGs to provide predictable and repeatable results (e.g. imagine an animation using procedural materials where the wood pattern varied every frame).

Of all the many random pattern generators around, perhaps the most popular with game developers is the Perlin noise generator and variations thereof (interactive demo). The algorithm used has many desirable attributes, being extensible to any number of dimensions and inexpensive to compute (O(2^n) to compute a point value in n-dimensional space; i.e. constant for any fixed value of n).

Other popular options are Voronoi partitioning based on a perturbed grid of points and various fractal algorithms, such as the Julia Set and various forms of fractal clouds (e.g. Photoshop's "Render Clouds" function; also see Synthetic Cloud Generators and Generating Random Fractal Terrain.

The Project Weasel Galaxy is procedurally generated using some back-of-envelope astrophysics. You can play with it here.

I've been experimenting with maze generation as a means of constructing maps. I can't say I'm terribly happy with my results thus far, but you can see my prototype here.

Random Notes

Here's a pretty neat random spaceship generator — very 1970's SF Book Cover.

main markdown 06/18/2016 10:56:43

Powered by FolderMark