Wednesday, January 7, 2009

Why I like Chaos Theory

What is chaos theory?

A very high level scientific explanation can be found here: http://en.wikipedia.org/wiki/Chaos_theory

Many years ago I went to an art exhibit where the artist had created elaborate fractal art by extrapolating mathematical functions found in chaos theory.

It fascinated me and I began thinking about how to use that concept in game design. I altered my thinking and how I was designing Legends and implemented something that when it was finished, completely surprised me.

What I had done was to create the game map, but not exactly what was ON the map, but a series of overlapping templates of what COULD be on the map taken from different perspectives. The overlays I chose were “RACE”, and “DENSITY”.

“RACE” was an overlay that gave me a geopolitical overview of a fantasy world. I could paint an area and say “This is controlled by the Elves”, or this other area was dominated by “Human Barbarian Tribes”. The racial templates referred back to a probability table that I created to determine the chance of “What” would be there. For example Elves would contain 85% High Elves, 5% Half elves, 5% Fairies, and 5% Wood Elves.

“DENSITY” was what sort of things I expected to see there in terms of structure. Was this a wilderness area, or perhaps a rural area or even the interior of a Kingdom. Each choice referred back to a probability table that I created to determine chances of certain things occurring. For example a template called “Interior” would have say a 40% chance of a village, a 40% chance of a castle or keep, and a 15% of a town, and a 5% chance of a city. Density also had a variable to determine how MANY of these “Places of Interest” would occur.

I had a handful of “Absolute” things that I needed to place in the game world, main cities, key ruins, characters etc. But those were done on another template that just connected them to the game map.

When I generated the game map based upon the “Probability Painting” I had done, the results were both very interesting and very surprising.

First, it worked perfectly. There were things in the game now that sparked my imagination and it was delightful to try to understand and create “Meaning” from looking at the game map. And to my surprise, meaning came. I knew it was random, and had no meaning, but by the places created one could surmise the relationship to other places that were nearby. An Orc Castle close to an Elven village of course meant that those Elves were at risk from raids by the Orcs. I did not plan that, but it was there in front of me. It was almost like reading a novel as you just knew that certain things were going go happen in the game based upon the proximity of the these places of interest.

I tried it again and to my amazement, it painted exactly the same thing again. At first I thought there was something wrong with my code, but then I discovered the key that makes this whole thing really exciting. What I found was that if I could seed the randomization process with any particular number, based upon the number used, I could randomize EXACTLY THE SAME PLACES.

I did some testing and to my amazement I found that at this time at least, and I qualify this statement, as it has been over 15 years since I ran these tests, the results were machine independent. If I send the routine that generated numbers to my friends in England, Austria, and Australia, and they ran the tests, we all came out with exactly the same random numbers in the same sequence based upon the same random seeds.

So, you ask why this is important? Let me tell you what this means in business terms. When we design a game it takes a great amount of effort to create content. Thousands of hours, and millions of dollars paying level designers, artists, and so on to sit at their computers and come up with interesting content to be consumed by the players.

What if rather than creating something “Explicitly”, we create the “Rules and boundaries” of what is “POSSIBLE” then let the computer generate the details?

To give you a sense of scope here, this process can be for all practical purposes, infinite. Infinite is a big number, in fact, it is not conceivable by our minds, and so we have to use abstract terms to understand it. Lets move this down to numbers we can comprehend easily.

An example is in order. Imagine that we want to create a small galaxy, only twenty thousand stars and let the players explore and colonize this micro-galaxy. Most 4th generation games that deal with space exploration cannot handle more than a few hundred worlds, much less twenty thousand. We also want this to be not a stand-alone game, but a MMORPG just to make it interesting.

I desire to create content, that gets down to the cubic yard on these planets, asteroids, and moons. How would I do this? The raw amount of data it would take using traditional design methods would make it impossible. Each world could conceivably be a terabyte in size.

If I gave you, the player, a program that contained the randomization process, all I need do is send to you one single precision number and let the randomization process fill in the rest. The only data I would need to send to you would be what has changed on the world based upon player interference.

So, in this example I just gave, it saves time, money and creates a larger range of possible things for the player to experience.

We use already lower forms of this concept for the randomized processes of “Random encounters” for the generation of NPC’s. in some the games which we play. Yet still, even in this form, the majority of the games out there use static content which is explicitly created.

The difference is that explicit content can be consumed but once. Dynamic content can be consumed over and over again and is what makes it so desirable from a design perspective.

Peace out and happy holidays…

Jim

No comments: