Author Topic: coexistence  (Read 9290 times)

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
coexistence
« on: January 09, 2022, 08:50:37 PM »
so i was running an evolution sim with animal minimalis, i made it huge, with hundreds of bots. i just fed them some really basic algae that doesn't make slime because i was hoping for the bots to take advantage of it (and also so the simulation runs faster ;)) at one point i noticed one particular patch of algae that didn't go away, and had survived for 20 generations, i was super interested because most plants are just there to feed but this one was really spaced out and smaller than normal. i saw that instead of making tons of chloroplasts and trying to grow as fast as possible which would make them really big and easy to eat they just made 1 chloroplast per cycle which slowed their growth but kept them small and hard to eat. the bots seemed to be feeding off of the plants but not killing them off completely, circling around almost like gardeners.

it looked like first the bots were sloppy eaters used to feeding on huge plants with full chloroplasts, then some plant had a mutation that caused them to only make 1 chloroplast per cycle, which made them small and hard to eat, but not impossible, some bots moved in, ate all the big plants, and started circling around the small plants getting a shot here and there, enough to reproduce once in a while, while the plants very slowly grew outward. i believe the bots have to have crappy shooting in order to coexist with the plants and have a reliable food source

i have a photo of it from yesterday, and a new photo from today. there was a small crisis where the area was temporarily infested with max body plants that somehow figured out how to shoot and they would kill everything that intersected their shots but thankfully they died because of waste. of course there's other places in the simulation, where the non-gardener bots are happy to eat huge accumulated stacks of normal plants, and then hope to find more food before they die

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: coexistence
« Reply #1 on: January 12, 2022, 01:30:32 PM »
I had a sim once where the plants learned to "vibrate" by storing small random values in .dx and .sx which made them hard enough to eat that they were able to coexist with the animals for the same reason: the feeding animals ended up being quite sloppy because they had a hard time aiming their shots to always hit.  I think it's a viable strategy to get a coexistance going: you need the animals to struggle to feed enough that the plants have an opportunity to survive.  But it can also tip too far in the plants' favor and it can be so hard to feed that the animals die off.

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #2 on: January 12, 2022, 07:57:43 PM »
yeah, it's all about sustainability, i'm hoping that this little plant will spread to the whole map and i won't even have to repopulate with normal plants, because it is kinda slowly creeping outwards... here is how it's going right now, surprisingly a wholly separate clump of plants have appeared to the left of the main clump, they work by only producing chloroplast when their chloroplast is less than refypos? ill just put it here
Code: [Select]

 cond
 *.chlr *.refypos <
 start
 160 .mkchlr store
 stop
''''''''''''''''''''''''  Gene:  1 Ends at position  9  '''''''''''''''''''''''

''''''''''''''''''''''''  Gene:  2 Begins at position  10  '''''''''''''''''''''''
 cond
 *.nrg 6000 >
 start
 50 .repro store
 15 .aimright store
 inc
 & sqr stop
''''''''''''''''''''''''  Gene:  2 Ends at position  24  '''''''''''''''''''''''


and this is a size 14 map too

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #3 on: January 17, 2022, 02:01:25 PM »
yo guys one of the plant colonies split into 2

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #4 on: January 23, 2022, 11:02:54 PM »
ok guys bad news the original 2 colonies of coexisting plants and bots are dead D:

but good news is that another has taken its place! unlike the previous ones which were dreadfully slow these new ones just limit their max chloroplasts to stay small, i didn't even think of that :D

Code: [Select]
cond
 *.chlr 16281 <
 start
 160 .mkchlr store
 stop
''''''''''''''''''''''''  Gene:  1 Ends at position  9  '''''''''''''''''''''''

''''''''''''''''''''''''  Gene:  2 Begins at position  10  '''''''''''''''''''''''
 cond
 *.nrg 6000 >
 start
 50 .repro store
 15 .aimright store
 stop
''''''''''''''''''''''''  Gene:  2 Ends at position  21  '''''''''''''''''''''''


Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: coexistence
« Reply #5 on: January 26, 2022, 01:36:12 AM »
Interestingly the first DNA you posted had some junk at the end the second one doesn't.  Otherwise they are remarkably similar.  I'm guessing the mutation rate is pretty low?

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #6 on: February 01, 2022, 01:38:44 AM »
Interestingly the first DNA you posted had some junk at the end the second one doesn't.  Otherwise they are remarkably similar.  I'm guessing the mutation rate is pretty low?
Yeah it was 1/16x at first but it was too slow so i increased it to 1/2x. Also the plant dna is only 22 long so it has a super low mutation rate compared to the actual bots which have dna of 150-200 length. Remember the first strain died, then the second strain came from one that was spawned in randomly and mutated.

Ok speaking about the bots, this is the best performing bot with 22 descendants. I noticed when zooming out that a lot of the bots seem to be drifting upwards, probably because of this part: "*.sun .up store"
Code: [Select]
11833 *-860 194 314 *.fixed 302
 start
 800 angle dropbool
 *.sun .up store
 534 *.refaimsx .readtie store
 store
 25450 *.nrg 28396 >=
 .repro store
 .tout10 store
 *.maxvel *.trefaimdx 453 *582 cos *.numties drop *.in5 store
 >
 *.shell *.mkslime *.refypos 14337 *.ypos *.waste 1 *.refmulti *.mass *.trefvelscalar store
 340 31707 store
 *240 store
 410 *.poisoned
''''''''''''''''''''''''  Gene:  1 Ends at position  54  '''''''''''''''''''''''

''''''''''''''''''''''''  Gene:  2 Begins at position  55  '''''''''''''''''''''''
 cond
 *.tin5 522 *.poisoned *224 *.tin7 30817 store
 *.tin1 *.chlr store
 469 *.totalbots 822 419 *.refnrg store
 store
 .sharewaste store
 >
 *.refypos .eye9width store
 18510 19696 .memloc store
 start
 -6 7 *.chlr inc
 store
 16402 sub store
 *.shdx 28689 over *641 *.body *.eye1width 25811 *.memval *.refdn 526 *.trefsx ~ ceilstore
 divstore
 -5 2 *.veldn .tieang2 store
 ceilstore
 511 *.tin7 add !=
 -143 104 dupbool
 * *.in5 .tielen2 store
 ~ xor
 19485
''''''''''''''''''''''''  Gene:  2 Ends at position  125  '''''''''''''''''''''''
''''''''''''''''''''''''  Gene:  3 Begins at position  126  '''''''''''''''''''''''
 start
 .aimleft store
''''''''''''''''''''''''  Gene:  3 Ends at position  128  '''''''''''''''''''''''

These are the dark plants near the top/bottom edges of the screen. They have survived for 951 generations (wow), I guess being at the edge helps a lot because it reduces the bots' feeding efficiency allowing the plants to survive.

Code: [Select]

 cond
 *.chlr 16281 <
 start
 .mkchlr addstore
 160 .mkchlr addstore
 add .tout4 store
 store
 28335 *.tin5 ceil 14674
''''''''''''''''''''''''  Gene:  1 Ends at position  18  '''''''''''''''''''''''
''''''''''''''''''''''''  Gene:  2 Begins at position  19  '''''''''''''''''''''''
 start
 *.nrg 8199 >

''''''''''''''''''''''''  Gene:  2 Ends at position  22  '''''''''''''''''''''''
''''''''''''''''''''''''  Gene:  3 Begins at position  23  '''''''''''''''''''''''
 start
 50 .repro store
 *.refvelup 15728''''''''''''''''''''''''  Gene:  3 Ends at position  28  '''''''''''''''''''''''


And here is a picture of the map, some bots feeding, and the cool dank vine color of the 951 generation survivor plants
« Last Edit: February 01, 2022, 01:40:24 AM by hdggDalton »

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #7 on: February 10, 2022, 12:36:19 AM »
aw man bad news all of the lingering plants died, i guess the bots got way better at eating them until there were no more left :(

but i saw some bots chasing each other coherently which is amazing

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #8 on: February 13, 2022, 01:27:59 PM »
ah crap my last simulation got screwed up... somehow the bots evolved to do absolutely nothing until they died if they're near the top of the map, like absolutely nothing, they were just chilling surrounded by plants on all sides, and they all collected up there... so i started a new one, this time with gravity :o despite running into each other these bots surprisingly don't attack each other, i guess they're just using each other to build speed so they can find food

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #9 on: February 26, 2022, 01:16:44 AM »
aha! you thought i was gone, but nah, i got some more pictures for you. it's just been boring because these guys wouldn't mutate at all even tho it's been 17 million cycles, so they're just boring point and shooters. amazing they manage to retain the ability to eat accurately though, i guess the gravity makes it a huge advantage cause otherwise you lose your food D:

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: coexistence
« Reply #10 on: February 26, 2022, 06:51:31 PM »
long term stability is interesting in its own right, but as long as there's some mutations I imagine something will change sooner or later.

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #11 on: March 01, 2022, 11:05:40 PM »
long term stability is interesting in its own right, but as long as there's some mutations I imagine something will change sooner or later.

true i nevver thought of it that way, it is hard to get bots to evolve interesting adaptations since, the way it looks to me, if the bots are already doing well in their environment, they will just stagnate or add junk code because if they're doing well enough, i tried to come up with an explanation i call "beneficial mutation usefulness" to explain it

the possibility of a beneficial mutation = a
the positive effect of a potential beneficial mutation on a creatures ability to survive and reproduce = b
the creature's current ability to survive and reproduce = c
ideally, c+(a*b) should be quite higher than c in order for beneficial mutations to occur sufficiently often and sufficiently increase fitness so that natural selection favors them and they become more widespread in the population.

a is generally very low as neutral mutations that do nothing and harmful mutations like mutations that remove a creature's ability to reproduce or cause it to move uncontrollably are far more likely, to increase beneficial mutation usefulness, we can increase mutation rate which is a bit dodgy since it increases neutral and harmful mutations which may drown out the beneficial mutations (genetic drift)

b is random, a lot of the time it's extremely low like a small numerical change like going from needing 20000 energy to reproduce to 20348, but very rarely b becomes very high due to introducing completely new behavior like adding the ability to produce shell that wasn't there before, but i think on average b is very low. b is not manipulable because the nature of mutations make them completely random and out of control

c is determined by the environment, which includes environmental conditions like gravity and friction, amount of food (algae), potential prey, predators, even members of the creature's own species can fall in either category if they're cannibalistic (which happens sometimes). to increase beneficial mutation usefulness, we can decrease the survivability of the current environment, some ways to decrease c might be decrease amount of food, decrease light energy, increase energy cost for living and doing stuff, introduce predators, etc.

if c is relatively high, and they're prospering and thriving, the difference between c+(a*b) and c, which is a*b, is miniscule compared to c and the beneficial mutations are lost to randomness and genetic drift
but if c is too low everyone dies before beneficial mutations can even be introduced

so i feel there is this very small goldilocks zone where beneficial mutations are needed enough that they can take over, but the environment is not so dangerous that everyone dies, i think it's just really interesting how it works when YOU'RE the one trying to manipulate the environment so that they evolve cool stuff for our own amusement :D do you have any tips how to reach this goldilocks zone? my sim almost died once because i gave them too little food D:

edit: it has recovered since though, here is the current best bot with 25 descendants:
Code: [Select]

 cond
 *.eye5 *.trefvelyourdn >
 *.tin3 .eye4width store
 start
 *.refveldx .dx store
 822 .up addstore
 ceil 7805 mult *348
''''''''''''''''''''''''  Gene:  1 Ends at position  18  '''''''''''''''''''''''

''''''''''''''''''''''''  Gene:  2 Begins at position  19  '''''''''''''''''''''''
 cond
 inc
 *.eye5 281 >=
 *.refeye *.maxvel inc
 start
 -6 .shoot store
 *317 *.trefnrg 822 .up substore
 .memloc store

''''''''''''''''''''''''  Gene:  2 Ends at position  37  '''''''''''''''''''''''
''''''''''''''''''''''''  Gene:  3 Begins at position  38  '''''''''''''''''''''''
 start
 %=
 <
 rndstore
 24835 17302 sqr .aimright floorstore
 *.refaim .mkchlr store
 *.trefshoot *.venom *131 *.memval sqr 542 300 *.nrg 24591 >
 *.in5 addstore
 addstore
''''''''''''''''''''''''  Gene:  3 Ends at position  62  '''''''''''''''''''''''

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: coexistence
« Reply #12 on: March 03, 2022, 12:10:58 AM »
This gets in to areas of actual biology research so smart people have had different opinions on the matter over the centuries, but personally I ascribe to a kind of haystack model.  That's often discussed in terms of the problem of altruism but I think it works for the evolution of complex behavior generally.

The idea goes that an isolated population tends to become genetically homogenous over time.  Sometimes beneficial mutations develop, sometimes harmful ones, sometimes lots of neutral mutations, but generally things have a tendency to spread out and either become universal or extinct.  It's possible for such a population to even drive itself to extinction by accidentally getting into evolutionary dead ends.

Now imagine having dozens or hundreds of such populations, all from a common ancestor, and having them isolated long enough that they're all a bit different.  Now suddenly mix them together into a single population.  Each line has to fight for survival and a line with a beneficial mutation has an edge.  Wait for the larger population to become homegenous again, then split the population back up into the original enclaves.  Now repeat this on different time and size scales with different groups in a chaotic soup of isolating and recombining populations.  You end up with a red queen's race of competing genetic lines fighting against each other.  The lines that do this well survive, the ones that don't, don't.  In sexual and horizontal gene transfer organisms the different lines can even create hybrids during the mixing process so you can have mutations that are neutral or even slighytly negative independently find each other and produce a beneficial result.

That's the theory.  If you wanted to mimic something like this in Darwinbots you would run a simulation for a while until there are some number of mutations in the population and things seem to have stagnated.  Then find an examplar bot and create a new simulation with clones of that bot and the original line.  Run that for a while, find an examplar bot, then create a new simulation with the original, the 1st round examplar and this new examplar.  Repeat ad nauseum, choosing which examplars go together in a sim arbitrarily/randomly.  You end up with strong selective pressure without the possibility of a mutation meltdown.  This is an awful lot like what DeepMind did for their Starcraft2 research: they built a ladder and pitted new versions of the AI against old version of the AI periodically to protect against "catastrophic forgetting".  The ones that did well had to do well against not just their peers but previous iterations of themselves.  The difference in biology is that there's no external fitness function outside of keeping your line represented in the future somehow.

It's worth noting as a human you can put your thumb on the scale and select for things you find interesting, but you don't have to and it'd be perfectly fine to choose your examplars randomly.

Also worth noting, in Darwinbots it's hard for DNA to get longer.  There's some mutations set up for it but practically speaking it doesn't happen very often.  You can help things along a bit if you add a bunch of 0s to your bots' DNA to give it a bit more room to develop mutations in.

Offline hdggDalton

  • Bot Neophyte
  • *
  • Posts: 43
    • View Profile
Re: coexistence
« Reply #13 on: March 11, 2022, 12:45:13 AM »
The idea goes that an isolated population tends to become genetically homogenous over time.  Sometimes beneficial mutations develop, sometimes harmful ones, sometimes lots of neutral mutations, but generally things have a tendency to spread out and either become universal or extinct.  It's possible for such a population to even drive itself to extinction by accidentally getting into evolutionary dead ends.
yes that's it, over a long enough period of time there's very little space in between death and domination

i wonder if you can just put down a ton of shapes to block off the map into several different areas, with small gaps so bots can pass through sometimes, and that will do the trick of regularly isolating and recombining populations as you say

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: coexistence
« Reply #14 on: March 11, 2022, 02:42:10 AM »
Yeah that might work.  Only one way to find out :)