Super simple ai prototype

So I threw together a super simple ai prototype. It’s really really basic but I think it has some nice results.

The redder a cell is the stronger it is (strength could be calculated as 3 x number of pilli + 5 x number of toxin glands, for example). When it senses a cell if that cell is less than half its strength and it is not scared then it will try and follow it and eat it. If that cell is greater than half it’s strength then it will get scared and turn away.

I am super happy if anyone wants to make a different / better system. The reason I made this is it’s super easy to implement and I think it looks really nice. You can follow the very red cells as they chase the green ones around and you can follow the greens as they try to flee from everything they see. It’s adaptive to changes in the cells too, so any cell can have it’s strength computed and fit into this system.

All feedback welcome :slight_smile: Code in the repo.


The initial results look good, from a gameplay standpoint it seems pretty conservative to be scared by something half your strength but an aggressiveness variable that alters the fraction that scares a cell seems pretty easy to add.


I was thinking the same thing. There should be some sort of aggressiveness variable that scales when a cell will decide to attack. For example, some cells may take an “elephant” approach where their strength is very high but they aren’t an aggressive species and will not often attack. Perhaps because they haven’t evolved the ability to engulf and favor a less carnivorous means of feeding. The strategy being: find a glucose cloud, rely on your strength to scare off competition while you peacefully absorb the compounds.


It looks like the brown cells are actually much more effective predators judging by kills. Is the green cell running from the red cell faster?

ATM they all move at the same speed. I guess they are just lucky in this clip :slight_smile:

I gave them a variable “aggression” which influences how weak a cell has to be for them to attack it. This is the number printed in each circle. I also gave them variable speeds and sight radii (shown as the circle around each cell)

A cell with 100 aggression will attack any cell weaker than itself. A cell with 0 aggression will not attack anything.