As an elective course taken in order to fulfill requirements to complete my B.Sc., I took the course Introduction to Computational Physics, taught by Professor Karliner at Tel Aviv University. The course was a mash-up of many interesting computational techniques, most of which are used to perform approximations of physical systems.
The course included a short practical project chosen by the student. I decided to use a genetic algorithm to “breed” a kind of simulated life-form. The plan was elaborate, and I considered many complex ideas, but eventually stayed with the simplest creature I could come up with. It took form as a 3D box with four boxy “paddle” appendages. I used the Bullet physics engine, and I made the rest with C++ in Visual Studio.
Videos of the wild creatures in action after the jump.
Here is Generation Zero of a random batch:
After many unsuccessful attempts at tweaking the breeding algorithm, damping was added to the simulation, and the populations began to converge after only a few generations…
Afterwards, to up the ante, I changed the plane to accept different inclines. This demanded that the creatures climb up, instead of just in any arbitrary direction.
Finally, here is a video of the creatures reacting and adapting to an erroneous fitness function. This function mistakenly demands that the creatures go as far as possible to their right (roughly in the direction of the camera). This leads to some strange and lopsided behavior.
All the code and some binaries are available for download. You can also find a more formal writeup in .PDF format.
]]>This is an ambitious project, one that I started years ago, with still very little progress achieved. However, by opening up the discussion and exposing the material I have gathered, I believe this deeply-founded subconscious realm can be expressed. Especially since now I am committed to blogging about it.
I’d like to begin by mentioning a few words about autogenerative-content, especially in how it differs from pre-generated and randomly-generated schemes.
Pre-generation implies that the objects or scenery was crafted and designed by a human artist, perhaps even down to the last detail. This method gives the artist quite a lot of freedom, but can hamper the potential world-size, because everything must be hand-made. Pre-generation is ideal for large companies with huge artistic and creative budgets.
On the other end of the spectrum, random-generation provides a surprising variety of content, as it relies on random numbers to generate events, characters, and even landscapes and scenery. However, depending on purely random occurences can be difficult to control and tune correctly. This method is widely used across the board, but rarely in creation of environments.
Procedural content bridges these two gaps by defining systems of random values that affect a pre-built framework. There is extensive work in this field, some of which has been aggregated here, at the Procedural Content Generation wiki. These higher-level functions can bring seemingly-natural content into a simulated world, while freeing artists from having to define every little detail.
Another benefit of using procedural methods is the repeatability factor. Given a certain seed, the random functions (actually pseudo-random) will generate the same values every time. If care is taken, an entire world may be predictably autogenerated, like a fractal that always is drawn the same way despite the countless layers of chaos within.
I believe that the Megastructure can be modeled, at least in parts, by using different blends of these techniques. Furthermore, an experience can be built that may span time and space, and link multiple users inside the endless corridors.
]]>