When I first embarked on the journey to power my snails' actions with a simple snail brain I threw together this diagram in the middle of the night:
Now it looks a little more like this:
Many things need to be refined and added on to. For example, right now a snail's stress increases if it is claustrophobic. However, all snails tend to react aggressively to stress - I need to implement a fight or flight response. Snails either attack other snails or try to run away from the crowding. I alraedy have attributes like fear and aggression (based on stress), but so far aggression is the only one that actually affects the snail's action.
I'm also starting to learn that I should trust the simulation a little bit more. In the past when something weird happend I knew it was most likely a bug of some sort. But now I've been running into more and more behaviours that, while odd, are in-line with what should actually be happening. I'll use this breeding as an example.
Two of my snails - Baloo and Lemur - mated. Baloo ate all of the eggs except for one because he was feeling claustrophobic. Here's what the remaining baby snail's family tree looks like:
However, as the baby grew and its shell color and pattern became more distinguishable I couldn't help but wonder...how did a snail baby coming from two very colorful looking snails end up so...prune-colored. Remember that the snails are hermaphrodites. The gender symbols below only display the role each snail took on in _that_ mating. Their orientation ticks back to neutral post-mating. A snail that mated as a female in one session could mate as a male in another (based on a few factors).
So I took a look at the parents. In this breeding Lemur bred as a male and Baloo bred as the female. Here are four of the visual traits (I'd say the major ones, although pattern radius also plays a big role) and how they came to be (the bolded pairs are the ones that actually got chosen for Lemur's Bagheera as it was being conceived and the values on the right are the final color values and pattern shape chosen for the baby):
And actually...it all kind of makes sense. I mean obviously I'm not going into the actual color-picking here (ie how you get a certain color value based on parents after a dominant allele is picked), but the general gist looks correct at first glance. I guess an ugly prune colored snail _can_ legitimately come from colorful parents.
So out of curiosity I took a look at the dead babies. You can't really see what they'd look like by eye since they died as eggs. _But_ due to a bug that I've since fixed, they continued to hatch after death and just stayed at a scale of ~0.00001 (so almost invisible to the naked eye). I used Chrome dev tools to increase their scale to 0.5 and check out what they would've looked like:
So...all pretty ugly. Either this is as it should be or the actual color value calculations make the colors more and more muddy each generation. I wish it was that pretty green one that survived. But that is not a mess I want to wade into at 11:51 at night.