Evolution Simulator

A Slide Rule, a Sundial, and a Physicist walk into a bar
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Evolution Simulator

Post by A Random Player » Fri Jun 21, 2013 9:52 am

robly18 wrote:This is pretty better than the old one! However, a slight issue I appear to run into EVERY SINGLE TIME I try to make them any sort of maze:
http://i.imgur.com/ZyzhyLm.png?1?4126

EDIT: Okay, I appear to have it *kind of* figured out. If I block them from going to the end, they spaz out like this. However, the issue is that they keep spazzing out even after I pressed R. I had to refresh the page to have it work.
Yeah, that seems to be the most annoying problem right now. Overall, it's evolving a lot faster.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!

User avatar
testtubegames
Site Admin
Posts: 1071
Joined: Mon Nov 19, 2012 7:54 pm

Re: Evolution Simulator

Post by testtubegames » Fri Jun 21, 2013 12:01 pm

Ah, I see what that was. As far as the fitness function was concerned, the 'reset' wasn't deleting the towers. So once the goal was blocked, it was always blocked. That's fixed now.

I also improved the mutations to speed things up. First, mutations now happen with a bit more likelihood where the need to happen -- which is nearby where the old creature died. So in a long maze, fewer creatures will mutate in ways that mess them up at the beginning, and more will mutate further along. Also, I put in a 'get there fastest' reward -- which helped to eliminate many of the loop-de-loops that creatures were doing.

So, for instance - around this maze in merely 20 generations!
evolutionShot2.png
evolutionShot2.png (56.4 KiB) Viewed 13486 times

A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Evolution Simulator

Post by A Random Player » Fri Jun 21, 2013 12:27 pm

testtubegames wrote:Ah, I see what that was. As far as the fitness function was concerned, the 'reset' wasn't deleting the towers. So once the goal was blocked, it was always blocked. That's fixed now.

I also improved the mutations to speed things up. First, mutations now happen with a bit more likelihood where the need to happen -- which is nearby where the old creature died. So in a long maze, fewer creatures will mutate in ways that mess them up at the beginning, and more will mutate further along. Also, I put in a 'get there fastest' reward -- which helped to eliminate many of the loop-de-loops that creatures were doing.

So, for instance - around this maze in merely 20 generations!
evolutionShot2.png
Interesting... Though with "mutations now happen with a bit more likelihood where the need to happen", I'm not sure it's "purely" evolution now :P I think it should still count as it.

It took 53 rounds to solve this one though:
Image
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!

User avatar
testtubegames
Site Admin
Posts: 1071
Joined: Mon Nov 19, 2012 7:54 pm

Re: Evolution Simulator

Post by testtubegames » Sat Jun 22, 2013 12:42 am

A Random Player wrote:Interesting... Though with "mutations now happen with a bit more likelihood where the need to happen", I'm not sure it's "purely" evolution now :P I think it should still count as it.
Yeah, that's a good point, and a question I've had to ask myself more than once. What is acceptable in this kind of simulation? Right now, of course, I'm really just focused on getting it to work, and fast, as a proof-of-concept. But beyond that, I'm still trying to figure out exactly what this is modelling in, say, biology. Creatures don't generally have an ingrained, naturally selected instinct to walk five paces forward, two to the left, one down, then a whole bunch of paces in a circle.

When I think about basic creatures, like single celled organisms swimming around, they often move around based on the presence of certain chemicals. They're attracted to some, repelled by others. (I guess? I'm a physics guy over here, so I as always, reserve the right to be dead wrong, especially in matters of biology). In any case, 'sensing chemicals' isn't exactly how this path-finding sim works.

So is there a good biology analogue for the current creatures? Or should the sim change to reflect 'true' single celled organisms, or some such thing?

Or does that question not even matter -- I mean nothing says these squares need to represent actual creatures. Evolution is just mutation and selection, after all. Doesn't need cells, or meat, or even biology when you get right down to it. Stuff to think about.

By the by, they completed that in under 60 generations? Rad! Those clever creatures...

A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Evolution Simulator

Post by A Random Player » Sat Jun 22, 2013 9:55 am

testtubegames wrote:
A Random Player wrote:Interesting... Though with "mutations now happen with a bit more likelihood where the need to happen", I'm not sure it's "purely" evolution now :P I think it should still count as it.
Yeah, that's a good point, and a question I've had to ask myself more than once. What is acceptable in this kind of simulation? Right now, of course, I'm really just focused on getting it to work, and fast, as a proof-of-concept. But beyond that, I'm still trying to figure out exactly what this is modelling in, say, biology. Creatures don't generally have an ingrained, naturally selected instinct to walk five paces forward, two to the left, one down, then a whole bunch of paces in a circle.

When I think about basic creatures, like single celled organisms swimming around, they often move around based on the presence of certain chemicals. They're attracted to some, repelled by others. (I guess? I'm a physics guy over here, so I as always, reserve the right to be dead wrong, especially in matters of biology). In any case, 'sensing chemicals' isn't exactly how this path-finding sim works.

So is there a good biology analogue for the current creatures? Or should the sim change to reflect 'true' single celled organisms, or some such thing?

Or does that question not even matter -- I mean nothing says these squares need to represent actual creatures. Evolution is just mutation and selection, after all. Doesn't need cells, or meat, or even biology when you get right down to it. Stuff to think about.

By the by, they completed that in under 60 generations? Rad! Those clever creatures...
I learned from this game demo/video that bacteria "tumble", with lower frequency as they approach food, and a quick search suggests they also swim faster in the presence of food.

I'm not really sure the current version is analogous to anything in biology, but it's probably a genetic algorithm in computer science/programming.

I think one good model would be to make each tower and the goal emit some sort of "chemical", and evolve tumbling frequency instead of path. (Or maybe evolving more flagella/cilia as well?)

Also this is another page that demonstrates tumbling, with an actual animation.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!

User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: Evolution Simulator

Post by robly18 » Sat Jun 22, 2013 1:13 pm

I appear to have beat evolution.
Image
I left this on for an entire afternoon.

EDIT:Image
1000 rounds isn't enough.
Convincing people that 0.9999... = 1 since 2012

A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Evolution Simulator

Post by A Random Player » Fri Jul 19, 2013 4:49 pm

This is a bit old, but I had an idea earlier that I didn't get to try, so I might as well put it here.
Instead of evolving a path, the enemies might evolve an Artificial Neural Network. They work quite well (in simulations, at least :P), so I though about using ANNs as the base of an evolution game.

Code: Select all

|              <  E   |
|    >   >    >       |
| P        <         E|
|                     |
|           <    < E  |
|                     |
|                     |
Like the player and enemies are flying over... Something. And they shoot you, don't lose all your HP, etc.
The input neurons to the enemies' ANN would basically be everything about the game state: height above ground, horizontal distance to (left/right) wall, X and Y velocities, relative (absolute?) X and Y distance to player, relative (absolute?) X and Y distances to bullets, and probably some other stuff I haven't thought of. The output would be acceleration (X and Y), probably capped, and whether or not to fire (firing should knock back the enemy/player a bit, so they don't fire continuously).
Each level, 10 or 20 enemies come, and you have to shoot them all before they kill you. After every level, the enemy that survived the longest would create the next generation (with mutations), the weights in the ANN changing.
There could be a lot more features (walls/floor may kill the enemies so they don't hide there, upgrading weapons, increase enemy HP after every round, etc), but this is just a general idea. It's quite similar to what actually happens in biology (usually, the weights adjust themselves), and should be very realistic. Only problem is it might be hard to implement.

Thoughts?
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!

User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: Evolution Simulator

Post by robly18 » Sat Jul 20, 2013 12:31 pm

Sounds f--king awesome.

If I ever learn to code, I'll surely world on things like these! Things like the game of life, among other programs simulating life and evolution, have always fascinated me.
Note to self: Get off your f--king lazy arse and go learn to code.
Convincing people that 0.9999... = 1 since 2012

User avatar
testtubegames
Site Admin
Posts: 1071
Joined: Mon Nov 19, 2012 7:54 pm

Re: Evolution Simulator

Post by testtubegames » Mon Aug 05, 2013 9:49 am

A Random Player wrote:Thoughts?
That's great. Yeah, any game that's fun where you have to kill a lot of enemies (side-scrolling shooter, tower defense, zombie-attack, etc) might be a good fit for evolution. I like the idea of ANN's especially -- and that video of soccer players was amazing.

It reminds me a bit of a virtual fish tank I prototyped way-back-when. The fish would take in the location of nearby food, predators, and non-threatening fish, then based on some weightings it had inherited from its parents (amount of fear, tendancies to flock, etc), it would move in a certain direction. It was kind of interesting. You would see a single fish turn into (after many generations) separate species, one of which would eventually start eating the others. But I haven't taken it much further than that.

One concern I would have is how many generations it takes. In the YouTube video you posted, it took them about 500 generations to become okay at soccer. Which would be too many rounds for anyone to be expected to play. I'm not sure how many inputs they had in the simulation, but the fewer we added in our game, the faster evolution should go.

A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Evolution Simulator

Post by A Random Player » Mon Aug 05, 2013 10:41 am

testtubegames wrote:
A Random Player wrote:Thoughts?
That's great. Yeah, any game that's fun where you have to kill a lot of enemies (side-scrolling shooter, tower defense, zombie-attack, etc) might be a good fit for evolution. I like the idea of ANN's especially -- and that video of soccer players was amazing.

It reminds me a bit of a virtual fish tank I prototyped way-back-when. The fish would take in the location of nearby food, predators, and non-threatening fish, then based on some weightings it had inherited from its parents (amount of fear, tendancies to flock, etc), it would move in a certain direction. It was kind of interesting. You would see a single fish turn into (after many generations) separate species, one of which would eventually start eating the others. But I haven't taken it much further than that.

One concern I would have is how many generations it takes. In the YouTube video you posted, it took them about 500 generations to become okay at soccer. Which would be too many rounds for anyone to be expected to play. I'm not sure how many inputs they had in the simulation, but the fewer we added in our game, the faster evolution should go.
:D

Speaking of evolving fish, you kinda read my mind; I was just thinking about fish, and how a neural network for it would (realistically) work - Would it be like two or three input neurons that sense concentration, or "eyes" that see distance. I was just going to search for it too :P

In the video, they had 16 input neurons, a NSEW for each object. I think this may be too many. An object west could just be represented by a negative east direction, and same for N/S.
In the simplest version, we'd have:
2 for enemy position
2 for player
2 for velocity
2 for nearest bullet
Or 8 input neurons. Adding more might not be that good, but we could try it to see.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!

Post Reply