Saturday, May 16, 2009

Procedural Content Generation: The Future of Virtual Worlds?

Late last year, shortly before the openspace shangri-lala started, me and a friend of mine were talking of ways to implement an alternative to SecondLife. We spoke about using a few engines as a base, such as Sauerbraten and Irrlicht. The thoughts were eventually dropped. However, one idea that I came up with during the discussion was the use of procedural content generation.

What is it? It's a system of algorithms designed for dynamically generating content for a game on the fly, either by random number generation or specific algorithms. For example, it could be used to generate random levels. Elder Scrolls II, Diablo I & II, Dark Cloud I & II (and III, but that's vaporware) all use it. Angband, ADOM, Lost Labyrinth, and virtually every roguelike game ever made use procedural generation to create levels.

In addition, procedural synthesis can be used to generate textures, animations, sounds, objects, etc. Games such as Spore and .kkrieger both use it extensively. The game .kkrieger can be considered "overkill" with procedural generation: everything in the game is generated dynamically. Because of this, the game takes up only 96 kilobytes, while a conventional game equivalent to .kkrieger would use upwards of two or three hundred megabytes. On a 2.6ghz dual core, all of the game content is generated in the space of 10-20 seconds. This screenshot from .kkrieger demonstrates the results. As well, the image itself is more than half the size of the game at 58 kilobytes.

As you can see, the use of procedural generation can be invaluable with saving disk space in a game. With the increasing demand for higher-quality textures in modern games, procedural generation is seeing greatly increased usage. As well, there are a number of tools that have been created to allow game developers to take advantage of procedural generation such as SpeedTree, Terragen, Genetica, and GML. As well, the open source 3d modeller Art of Illusion contains a built-in node-based texture generator (yes Wayfinder, it is GPL ;-).

Use In Virtual Worlds
So, what if Virtual Worlds were to take advantage of procedural generation? The most immediate benefits are the obvious ones: massive reduction in bandwidth and far less data to store. There are other benefits too. A user that doesn't have the know-how to use photoshop or gimp could use tools built in to the viewer (or external to it) in order to generate their own procedural textures.

Different tools could be used to generate different kinds of specialty textures, such as skins, clothing, hairs, eyes, etc. Art of Illusion and Genetica both use a node-based system to generate textures. As well, this approach could be used to generate both sounds and animations. As well, sounds and animations could be generated in a similar manner.

As well, sculpties / meshes could be generated by a set of tools, such as a "pottery wheel" system where you create a line that generates a symetrical sculpt/mesh much like a pot or vase, converting linked objects into a sculpt/mesh, or manually editing the vertices of a mesh (perhaps an undesireable method for some).

Another possibility is generating textures from scripts. An example of this would be signs that can change the texture, or perhaps it could be used to dynamically generate an interface for HUDs.

I'll try to simplify this for the non-techie SL users. Procedural generation is a kind of computer program that can produce images, sounds, animations, and objects by following a set of rules, set both by the developer of the program and the program's user. For example, by choosing a brick pattern, colors, and a noise filter, you could create a brick texture.

As for the space savings, the data for generating the texture would be stored on the asset servers as "bytecode", or a script which has been reduced from something human-readable (text file) to something computer-readable. Each one of these files will take up less than 1 kilobyte (1024 bytes), while a typical 512x512 texture will be 20-30 kilobytes. That is, of course, if the image is a jpeg. Other formats such as png, tga, and bmp will use far more memory.

In any case, the use of procedural texture generation would not eliminate the need for storing traditional textures, as in the case of snapshots or textures produced by other means.

I would personally like to see this technology implemented in virtual worlds such as OpenSimulator, LiteSim, or Sirikata. OpenSimulator already has a very basic level of this started with some OSSL functions that can edit textures.

No comments:

Post a Comment