Terrarium: Was it ever complex enough to demonstrate emergent behavior?

Abstract
What exactly is emergent behavior?  Emergent behavior can be defined by a behvior that wasn't expressly defined but appears as a result of the interaction between several simpler behaviors.  Classically flocking patterns and complex group behavior of simple creatures can be attributed to emergent behavior.  Lately this has been used a great deal in games to provide seemingly unique responses to situations by interpolating the results of several simple actions together.  What kinds of things might be considered emergent behavior?

    1. A game bot programmed to grab life when low on health, but also programmed to shoot at enemies.  This bot will appear to be running away and providing cover fire for itself when both conditions are met.  This can seem very intelligent.
    2. A set of game bots programmed to duck behind boxes and fire at the enemy spontaneously.  Two basic actions.  If seen in a game, it may appear the bots are actually creating a defensive network (working together), when in actuality they are only working for themselves.  If yet another simple behavior is to randomly rush the enemy to break them off guard, you may even see kamikaze bots come running after you and imagine the others are providing cover for that bot.

Lots of unique and interesting behavior can be mistakenly identified (a good thing) by the player given the simplest of underlying behaviors.  So how does this apply to the Terrarium?  Well, the Terrarium programming model is really simple.  Basically, you get a serious of events or callbacks to process and then get to program your response.  Your response (internally) can be very complex with lots of computation, but these then have to translate down to the simple interface actions provided by the engine.  The responses are basic like attack creature X, defend against creature Y, or eat target Z.  Movement is also important with the programmer being left to design their own path-finding algorithms.  Lets see if we can put these actions together and define some emergent behavior.

Hit and Run
The hit and run is probably the greatest of emergent behaviors.  Creatures, especially herbivores, are fairly weak, so they tend to run away from predators.  Now, since each action in the Terrarium is unlinked, it turns out you can attack/defend/move/eat and any number of things all in the same round.  This led to developers hooking up an attack whenever a creature was within range, just because they could.  With the added behavior of running away, this led to the hit and run.  Yet another emergent behavior allowed by the engine was the ability to attack first, then move out of range to avoid the incoming attack.  Thus an even more advanced hit and run that was purely coincidental.

The Tank
Most players in the Terrarium never even knew that creatures with high energy levels were capable of a healing action.  It happened automatically.  So herbivore authors were quite surprised when they sat next to a plant eating, defending against an attack, and attacking back all in the same round.  Turns out this creature was being a huge tank, dispensing nominal damage, healing a bit, and not taking much damage.  Authors quickly found that as long as they were next to a plant, it was possible to outlive some carnivores.  This behavior became more complex as creatures also ran between plants.  You see everything in Terrarium takes energy, and the only way to get energy back is to eat.  With your food running away, you were losing a lot of energy as a carnivore, but the herbivores were getting their energy back doing drive by snacking like each plant was a fast food restaurant.  I consider this another emergent behavior, but I won't talk about it separately.

The Scavenger Symbiote
The original intent was truly to be a scavenger and eat already dead creatures.  This meant low expenditures of energy for movement and attacking, and high energy from eating dead creatures.  During various revisions of the Terrarium engine, this either worked well, or not at all depending on the tuning.  In the end, the emergent behavior was that creatures appeared to co-exist.  Were they really co-existing?  I guess maybe that was the full intent, but I'm pretty sure the code for this co-existence was only located in the carnivores at first.

The Named Symbiote
This is an example of emergent behavior becoming defined behavior.  After a while, creature authors actually starting placing recognition code into their creatures so they could release a group of herbivores and carnivores that co-existed for real, as a solid behavior, and not as an emergent behavior.  The carnivores would only attack for food when they needed to, and the herbivores would basically role over for them.  This worked because the author was able to program a balance.  Even more interesting is that this behavior began to cross authors.  A carnivore author would actually have code to co-exist with a completely different herbivore author and vice-versa.

Conclusion
I think the Terrarium was a great examination of emergent behavior since we saw so many levels of emergent behavior as the game progressed from various authors.  The end result of emergent behavior though, is that once a behavior is identified it sometimes becomes apparent that it needs to be a base behavior.  For nearly every emergent behavior we saw, eventually authors had code written so the behavior manifested itself at a defined time rather than as a result of several separate more basic behaviors.

Is emergent behavior powerful?  When done right I think so.  When it is being used to find more complex behavior that is later refined down into the base algorithms it can be really cool.  When you have a time to market and can't fit all of the complex behavior you'd like it also helps spice up your game by providing some random interesting results.  In the rarest of circumstances it actually creates a simpler programming model for the game designer that is capable of providing more complex results than the designer could ever hope to actually program into the game.  Normally this takes place when additional AI routines are also involved such as neural networks, fuzzy networks, and other statistical devices that help to create a more randomized response set.

If you are interested in AI or just programming in general and you haven't gotten the chance you should check out the Terrarium.  A new version will be out sometime soon that everyone can play and the source code will be available so you can see what goes into making an environment where emergent behavior can manifest itself.  Check it out: http://www.windowsforms.net/terrarium

Published Thursday, March 04, 2004 7:09 PM by Justin Rogers

Comments

Tuesday, March 23, 2010 7:01 AM by Lucia

# re: Terrarium: Was it ever complex enough to demonstrate emergent behavior?

Hello everyone. In all affairs it's a healthy thing now and then to hang a question mark on the things you have long taken for granted. Help me! Need information about: Stock trading secret. I found only this - <a href="www.justiceplanbook.com/.../StockTrading">stock trading strategy</a>. But then's the bull: in market, you ca there use what the program will reduce, stock trading. Stock trading, entertaining to the stock stock penny requests, home stock and maintaining per float, other trader watch of potential, perspective on robot church, monitoring on fundamentals also generally as longstanding choice have additional high power. Waiting for a reply :mad:, Lucia from Vanuatu.

Leave a Comment

(required) 
(required) 
(optional)
(required)