Experiment: LÖVE-olution (an evolution simulator)

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Experiment: LÖVE-olution (an evolution simulator)

Post by Wojak »

Basically this is a bunch of virtual entities that are doing “it” to solve a path finding problem, It is far from being efficient, but is kind of interesting.

Before You start have simulation you can add some obstacles using the left mouse button.
There is absolutely no guaranty that even a million generations will find the best path (this are random processes after all – no AI), but you can compere the A* solution with the current best path.
And of course this may be sometimes interesting to watch – after 10-20 generations the population has a tendency co create a coordinated colony :)

Here's how the current algorithm works:

1) Natural selection:
The task is very simple – go from point A to point B using a random path, the catch is – if You are not fast enough – You are dead. Only 10% of the population can survive, so only the best from the best will create offspring. Competing with the offspring is also the reword for surviving.
2) This is how they “do it” - recombination:
There are currently 3 active gens, the life span gen ant the mutation factor gen are nothing more than binary numbers, but the most important is the “patch gen” that tells witch direction to go in the current tick. In this simulation recombination works as fallows: You take the gens responsible for the same thing from two parents, You make sure that they have the same size, if not you cut off the end of the longest, than you copy the gens while tossing a coin on every node – if its head the child A gets a node from parent A and B from B, else child B gets the node from parent A and A from B.
3) Mutating is essential:
Mutation is simply swamping a node in a gen for something random. In this simulation there are 3 reasons for mutating: No genetic instruction – generation 0 starts with an empty path gens, and because the way recombination work first few generations can simply run out, so they need to write they own instruction; Invalid instruction – since the gen stores a instruction witch way to go, it will often tell to go in the wall – this kind of thing needs to be rewritten; Random mutation – Most of this kind of mutations will be deadly, but every once in a while a good one may happen injecting a fresh genetic material to the population. The first version of the simulation had no random mutations witch resulted in the inability to solve even the simplest problem, than I given all specimens the ability to mutate at random witch resulted with a 3 steps forward, two steps back pattern... than I decided that only the young can mutate witch was the most efficient (the part of the population that can mutate can be changed at any point)
4) Immortality is bad...
Well the combination of the ability of the parents to compete witch children and the inability of parents to mutate created a problem – parents dominated completely destroying the positive effect of mutations, so I've added a “dying from old age” mechanism...
Attachments
LÖVE-olution.love
0.9.0
(5.24 KiB) Downloaded 262 times
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:46 am, edited 2 times in total.
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

Re: Experiment: LÖVE-olution (an evolution simulator)

Post by ArchAngel075 »

Pretty fun to watch them flander around my mazes.

As a request :

Competition :

2 start points, 2 end points;
Each "species" simulates independantly of the other.
But if two organisms of opposite species meet, then the weekest of the two is killed.

This makes for fun in my head seeing how you can influence it using the mazes, like chocking one side and not chocking the other until the massive meeting "room".
Plus it adds a flare of lets bet on side A :P

Overall its interesting to watch the things slowly get around!
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:45 am, edited 3 times in total.
User avatar
DaedalusYoung
Party member
Posts: 407
Joined: Sun Jul 14, 2013 8:04 pm

Re: Experiment: LÖVE-olution (an evolution simulator)

Post by DaedalusYoung »

Sounds interesting, but it doesn't run for me. When I try to run it with LÖVE 0.9.0, it just immediately closes, without any errors or crash reports. When I try to run it with 0.8.0, it just shows an empty window (grey, not black), nothing ever happens, I can only close it by force-quitting.

[edit] It works when I delete conf.lua.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Experiment: LÖVE-olution (an evolution simulator)

Post by Germanunkol »

Cool project! Pretty hard to get them to go through those very narrow passages...
Is the optimal path (yellow) simply the path the fastest entity took? Looks like it....
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Experiment: LÖVE-olution (an evolution simulator)

Post by Wojak »

Germanunkol wrote: Is the optimal path (yellow) simply the path the fastest entity took? Looks like it....
Yes, the blue one is optimal and the yellow is the best thing evolution has come up with...
bekey wrote:That said, it's quite a pain to draw the level right now, how about some sort of "generate maze" function, or a few preset ones to cycle through?
I may try to implement a maze generator
ArchAngel075 wrote:2 start points, 2 end points;
Each "species" simulates independantly of the other.
But if two organisms of opposite species meet, then the weekest of the two is killed.

This makes for fun in my head seeing how you can influence it using the mazes, like chocking one side and not chocking the other until the massive meeting "room".
Plus it adds a flare of lets bet on side A :P
This sounds interesting, but it will be a pain to implement to this mess of a code...
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 60 guests