Concept Sketch

Make a landscape and populate it with random "animals".

Give them values, from 0 to 1 (float), for different attributes:

  • Hue (colour, just for beauty and genetic compatability, value * 255)
  • Senses - range of detection
  • Movement Speed - how fast it moves
  • Fighting Strength - how dangerous it is
  • Memory - how many reactions to other animals it can store (value times a globally defined value, currently 10, min 1)
  • Fear - how likely it is to run away from unknown animals
  • Aggressiveness - how likely it is to attack unknown animals
  • Flocking Behaviour - how much it wants to stay with like animals
  • Mating Drive - how likely it will want to mate with compatible animals
  • Curiosity - how likely it is to investigate other animals and the environment
  • Empathy - how well it can judge other animals reactions

There's some kind of penalty for high values, or a max combined total, something to prevent that all values go to max.

The basic idea is that these motivations stand in conflict. Curiosity and fear will determine if the animal ever gets close enough to any other creature to find a mate, if it is too fearful, it will die out. Too much aggressiveness, and it will kill potential mates, too. Too much mating drive and it may try to mate with animals that try to kill it.

Rough flow:

  • Check senses if you find any new (unknown) animals around
  • If so, determine your reaction to them (see below)
  • Then follow up on your reactions

determining reactions

When an unknown animal is detected, four drives stand in competition, the end result will be determined by simply rolling them off against each other, i.e. add them up, make a roll, look where in the range the roll ends up. This is the initial reaction.

Since Mating Drive, Flocking, Aggressiveness and Curiosity all make the animal approach, while only Fear makes it move away, most animals will move closer to investigate at this point. Since there are very likely other animals around as well, with reactions set, this is stored as a vector with the magnitude being the strength of the reaction that is triggered, maybe modified by the strongest opposite desire?

The final movement of an animal is the product of all its vectors.

When the distance goes below half the senses range, the animal will make a guess at the current (initial or final) reaction of the other creature. That's basically an empathy roll. Success == correct guess, failure == no idea, massive failure == wrong guess.

It will then check:

  • If the other animal is (guessed as) aggressive, check Aggressiveness * Your Combat Strength vs. Fear * Its Combat Strength to determine if you'll counterattack or flee.
  • If the other animal wants to mate, check your Mating Drive * Compatability Rating on whether you share that desire. If not, set reaction to neutral.
  • If the other animal is curious or you don't know, check Aggressiveness vs. Mating Drive * Compatability Rating and something else to find out if you want to hit it, fuck it, or couldn't care less.
  • Don't yet know how to fit Flocking in there, that'll find itself.

On one quarter senses range, the final reaction is verified one final time, roll Empathy, and if the other animal is aggressive and you are neither fleeing nor attacking, check if you'd not rather change to one of those. If the other wants to mate with you, and you are neither in aggressive nor in mating mood, check one final time if you'd rather

Compatability

The more genes are identical, the higher the compatability, though there should be a penalty for too much. Maybe >90% counts down double, so that a 100% match is actually a 80% match and thus worse than the 90%.

This also determines if the mating is a success.

If it is, make a genetic crossover of the genes and generate a new animal.

Death

For simplicity, animals die only if eaten by another. If an aggressive animal meets another animal, both roll Combat Strength and the winner kills the loser. Simple as that.

Implementation

Starting simple...

0.1

random animals with random movement

0.2

add fear and curiosity, memory and reactions

New Random Idea

Make the colour mean something. Translate to RGB and let the colours stand for:

  • red - aggressiveness and fighting strength
  • green - curiosity and mating drive
  • blue - senses and memory

or something like that. This way, we can go all by the Hue when it comes to genetics, etc. (random spawn must take that into consideration, maybe generate one random value and then spawn max(2,total/10) variants of that).