Wednesday, April 22, 2009

Nothing Up My Sleeve...

As I'm sure is the case with a lot of you, the idea of procedural generation of content has also fascinated me ever since the release of Spore last year, which allowed players to design truly bizarre creatures and then puzzled out precisely how they moved just on the basis of the creature's form (among other things).  While I have yet to actually play Spore (as I have a relatively low-end computer), I am still duly impressed by reports of how it manages this sort of thing.

For those of you who have never heard of Spore and consider the Wikipedia article I linked to about procedural generation a tl;dr situation, let me see if I can sum it up for you: procedural generation is the creation, by way of an algorithm in a computer program (in this case, a game), of content that did not exist at the moment the program was run.  In the Spore example, the procedurally-generated content is your creature's walking animation.  There's no way that the programmers could account for all possible permutations of the various bits and pieces of the game's creatures, so they wrote a chunk of code that allows the game to create the animation on the fly.

The most impressive example of procedurally-generated content I have found thus far is a game called .kkrieger.  Here is the gameplay screenshot that is featured in its Wikipedia article.  Click on it for a larger size.


A traditionally-created game--one that has independent files for models, textures, and animations that are referenced by a core program--that looks like this one would probably occupy a few hundred megabytes of disk space at least.  Plenty of games out there run into multi-gigabyte territory (Halo and World of Warcraft are just a couple that spring to mind--my gaming is a bit dated, admittedly).  But .kkrieger occupies only 96k.  That's it.  I've seen Word files that are bigger!  All those pretty things in that screenshot?  The models, textures, animations, and even music are all generated during the game's hella long loading time.  None of it is hard-coded or included in separate files.  It builds itself from the ground up every time it's run.

Given, it takes a PC with some pretty hefty processing power to play the thing, but the fact that it works at all is fascinating to me.

Other examples of games that use procedural generation can be found in the Wikipedia article about it.  Right off the top of my head, I know that Dwarf Fortress uses it to create entire worlds, including their histories and legends (pretty spiffy), and a lot of the games over at Java4k use it to keep their file sizes down at the 4k maximum size for the competition.

I'll warn you, though, those games at Java4k can be damned addictive.  Enter at your own risk.

Anyway, this was just something that I thought was awesome and consequently wanted to share.  You may all go about your lives now.

----
"The Tao did not wish for him to pass."

No comments: