Behavioral Evolution

“FYI, the first third of this post consists of Qu just typing randomly with no coherent subject as he tries to come up with a subject for todays post. I have no idea why he decided to include it. Padding, probably. Feel free to skip to the stuff actually worth reading further down (assuming any of this dreck is “actually worth reading”).” -i

Welp. I have no idea what to write. I generally just write these posts by typing out whatever bullpoppy pops into myhead, and then going back and inserting some rediculous analogies, a bit of hyperbole, replacing the swear words with crap like “bullpoppy”, then clicking submit. And then re-opening the post and editing out all the spelling mistakes and adding in the links and images I meant to include in the original. Proofreading and preview buttons are for wimps!

But at this very moment my brain is giving me no prompts whatsoever, hense the above pointless and time-wasting sentence. What on earth am I going to write about?

Well, at this point in the saga, I have a working (albeit basic and rather buggy), simulation. Ummm…

Dammit writers block.

Dammit I just called myself a writer because I blog. Next thing you know I’ll be printing out business cards with this URL on them and adding “blogger” to my resume.

Okay, okay, let’s get serious. The first thing to do from this point in the games development was to expand and balance the selection pressures. But since this process is extensive, (so extensive it’s still ongoing, and shows no sign of letting up), and since I did a fairly pretentious post on it last time, let’s move on. I’ll be coming back to that topic sooner or later, there’s pretty much no way to avoid it, so no point in rushing it. Let’s talk about something else.


Hmm… I could do a post on performance and optimisation, but it’d come out all technical and I doubt too many people are interested. We’ll save it for later too.

Redundancy? I’ve touched upon the things that changed from the original design in other posts… but that’s pretty broad subject, maybe something more specific…

Oh, I know! Behavioral evolution.


“Stuff possibly worth reading starts here.” -i

The original design called for an unbelievably complex and mutable behavioral system, that could theoretically evolve to handle any situation. I’ll try to give a summary of it, but when I say “complex” I don’t mean “Pythagoras’ Theorum” complex, I mean “7th dimensional trigonomcalculus in a rotating reference-frame” complex, and I’m pretty sure that doesn’t even make sense.

The basic idea was that every creature could have a list of Perception Categories, based on visable data like “size” and “number of teeth”, so they could distinguish between predators and prey. Each perception category would also include an action (flee, approach, attack, mate), which based on the theory would, over time, evolve to become appropriate to it’s category.

Using this system, any action could be combined with any object. So Attack!Creature and Eat!Vegetation were possible, but so was Flee!Vegetation and Eat!Creature. (Note: creatures can only be eaten after they’re killed, so this did nothing except maybe annoying the creature being chewed on).

I actually implemented a placeholder version of this system, and discovered it’s flaw: it made creatures stupid. The earliest creatures picked actions at random, and would spend a good 90% of their time doing nonsensical things. The ones that survived were the lucky but random few who managed to realise they were supposed to eat their food, not copulate with it (not that there’s anything wrong with that (sorry, couldn’t help myself)).

At first I thought this was okay: creatures would naturally evolve to be smarter. But it quickly became apparent that the randomness cause by their own stupidity was the only selection pressure worth talking about in the game: it was overwhelming all the visible effects.

In addition, it was impossible to monitor. Getting statistics out of this system was like milking a tiger snake: not as hard as it sounds, but all you’ll get is poison. And there’s also the possiblity of being bitten by a pissed-off, venemous reptile, though I’m not certain the analogy streches that far. But it was very, very hard to tell the difference between “intelligent” and “brain-damaged algae” simply by looking at the perception categories. It was definately impossible to glean any useful information at a glance, which was the way I wanted to set the statistical elements of the game up.

And if that wasn’t enough, it evolved slowly. Increasing the behavioural mutation rate didn’t make it evolve faster, it just meant that the immediate descendants of an intelligent creature might well be back to running away from the scary food and trying to mate with the giant toothy predator twice it’s size. And decreasing it meant you could wait for hours before seeing anything.

And yet… if the only thing I was going for was accuracy, I might well have hung onto this system. It’s not too bad at replicating the way behavioural evolution in reality works: we recognise patterns and have instinctual reactions to those patterns. But evolution in real life doesn’t happen over the course of minutes, like in Species. It takes era’s. So this system, which is actually quite fast compared to real-world physiological evolution, is extremely inefficient compared with the simplified version found in Species.

What I had unrealisingly done was put a real-world system into a simplified simulation.

But I’m not “only” going for accuracy: the dual design goals for the simulation in Species are accuracy and intuitive… err… ness? Okay that word sounds ridiculous and probably isn’t an actual word, but you know what I mean. I want to be able to see evolution happening in Species, which is difficult to do with complex behaviors.

So that lead to the current, much-simplified system. It’s not quite as versatile as the ridiculously complex system detailed above, but it’s versatile enough to allow mutable behaviour while still allowing the user to see at a glance how the creature’s instincts govern it’s decisions. It makes the creatures understandable and (relatively) predictable, which is a good thing…

The system consists of four main genetic variables:

Curiosity/Cowardice: Determines a creatures reaction to other creatures in its line of sight. A high curiosity will cause this creature to approach, while a low one will cause this creature to flee.

Aggression/Sociability: Determines a creatures reaction to reaching another creature. An Aggressive creature will attack: a Social creature will either “Play” (an action which still has no real effect, but I’m planning on adding one. Sooner or later. When I can think of an effect it should have) or Mate. Which of those it does is determined by…

Amorosity/Asexuality: Amorous creatures will attempt to *ahem* “share genetic material” when approached by other creatures of the same species, while asexual creatures don’t. Since creatures are perfectly capable of reproducing by Parthenogenesis (cloning), it will be interesting to see whether sexual or asexual behaviour is the most viable within Species, or even if it changes depending on environment.

Interest In Tree’s/Lack Thereof: a behavioural variable that I may end up simply combining with the “diet” variable, because a) it’s redundant (Carnivores have no reason to approach trees), and b) it sounds silly. Interest In Tree’s causes creatures to prioritise vegetation over creatures (or vice versa for low values).

A few other variables, like “Scariness” and “Decoration”, provide modifiers to these: (scariness makes other creatures less curious, decoration makes them more amorous, etc).

And that’s it. This behavioural system theoretically provides support for predator and prey relationships, herding behaviour, and sexual selection, while being simple enough to understand at a glance and to not overwhelm the more interesting (debatably), visible selection pressures.

It’s not perfect though, and I’m always open to suggestions. E-mail me, or drop a line in the comments section below, if you’ve got an idea for this or any other system in the game. 🙂


Yeah, I’ve totally given up on making the random screenshots at all relevant.


, , , , , ,

  1. #1 by Adam Benton on February 7, 2012 - 5:58 pm

    Given how it’s thought sexual selection rose to prominence in many species because it may have offered an additional way of increasing genetic diversity (or something else I haven’t been bothered to research) are you planning on giving reproducing via sexual selection any such “perks”?

  2. #2 by ququasar on February 7, 2012 - 7:25 pm

    Well in theory, it should naturally do that. Mating takes every genetic statistic in both creatures and combines them, with the amount of each statistic being chosen at random. So if a large blue creature mates with a small red one, the result might be large and red or small and blue or any combination thereof, including “Medium and Purple”. I’m not going to add any artificial benefits, but aside from the time spent mating there’s no energy cost to it either.

    I’m only hypothesising here, but I’d guess that whether it propogates or fails in the short term will depend on whether or not to benefit of being able to put your genes into other creatures outweighs the cost of having offspring with only half of your genes in them, on average.

    Still only hypothesising, but I’d also guess that sexual species will have greater homogenity then asexual species, because every genetic line in asexual creatures is free to go wherever it will, while the main population of sexual species will bring the more extreme mutations back into the population and ‘share’ them amongst the entire population.

    But these are all just guesses, since even sexual creatures in the current simulation are still using Parthinogenesis to reproduce (there’s a minor bug in the reproduction code that I never bothered dealing with, so I just told them to clone themselves). I’ll fix it before release of course, and then I guess we’ll find out whether or not I was right by direct observation!

    PS: How many times did I say “sexual” in this comment? I may have just inadvertantly increased my google traffic… 😛

  3. #3 by Adam Benton on February 8, 2012 - 12:18 am

    It would be interesting to see if it naturally emerges, given that.

  4. #4 by Adam Benton on February 8, 2012 - 3:20 am

    Also, do you have any plans for implementing sexual dimorphism?

  5. #5 by ququasar on February 8, 2012 - 1:03 pm

    I’m afraid not. There are no genders in Species: all creatures are capable of birthing and of impregnating other creatures. This is the case for several reasons: it gives them a better chance at finding a mate (because of their short lifespans, this is important), it’s easier to code (always a bonus), and it makes it easier to distinguish between different species by sight alone.

    In addition, I saw sexual reproduction and dimorphism attempted in Primordial Life. It had a similar problem to the behavioral system I talked about above: it was an accurate simulation, but what works well on a macroscopic scale with millions of creatures to work with doesn’t always translate to a petrie-dish simulation of a few hundred creatures.

    In short, I’m trying to learn from their example and set up a form of sexual reproduction which has a chance at being competitive in the in-game universe.

  6. #6 by Adam Benton on February 8, 2012 - 7:19 pm

    Fair enough, I was just learning about how dimorphism could’ve arise the other day and was curious as to whether it would if you put the mechanism in place but didn’t make the genders any different originally. That said, the number of variables involved in the development of anisogomy is probably far too large to simulate in an already complex game. Maybe a mini-game. Maybe in the far future.

  7. #7 by Gravel on February 14, 2012 - 4:31 am

    I can’t believe no one commented on the picture. It’s like an unholy cross between K9 and a praying mantis.

  8. #8 by White parrot on September 14, 2012 - 2:20 am

    “Carnivores have no reason to approach trees” ? I disagree ! This could move them to ambush frugivorous.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: