Move over blind watchmaker, the car maker is here! (in Off-topic)


Sickone January 25 2011 12:20 AM EST

http://megaswf.com/serve/102223

It's a small SWF implementation of "pseudolife" evolution simulation.
In this case, the "life" that's being simulated is two-wheeled 2D vehicles attempting to drive over a bumpy 2D landscape, and the "evolutionary pressure" is exerted by how far away from the start point they make it.

You don't have absolutely any control about any of the individual "life" forms, their virtual 8-triangle bodies are (at least initially) randomly filled, the location and size of the wheels is also random... and you get 20 such "individuals" in each generation.
Each of the 20 little potential cars gets a real-time physical simulation if its attempt to drive over the hills in front, and they get scored for distance traveled.
Then, the next generation of wannabe cars gets generated by "sexual reproduction" (meaning the cars get some "genetic material" from two parents), with the likelyhood of one "car" being a parent for the next generation depending on how well it scored just before... and there's some small chance of a "mutation" in one of the "genes" (body shape, wheel position, shock direction, wheel size) then everything starts again.

Seems like there are two separate "end score" criteria - one is stalling, the other is a time limit, and the time limit is very short for the first few generations, but it gets quite long for later generations.
The time limit is still needed even in much later generations, because I have occasionally seen some vehicles getting to a hill, flipping over, falling back on their wheels before the hill then doing it again, and again, and again, until the time limit hits.


Remember to ever so slightly manipulate the mutation bar every now and a while... since it's your only control.

When you're getting mostly cars you like which also perform well, tone down the mutation rate to something very low (1% or even 0%) and let the "nice car genes" (lol) spread.
When you get a lot of lookalike cars but there seems to be very little or no progress towards something you'd like to see from generation to generation, ramp up the mutation rate a bit (10%, maybe even 15%) for a generation or two, then turn it back down, then wait another couple of generations to see if any of the mutations that survived (if any) has a chance to become quite useful or not.


There's a small graph in the middle upper area, the red line graphs the best score in the generation, and the black line I think (not quite sure) it graphs the average score of a generation.

Sickone January 25 2011 12:22 AM EST

Basically, just click and watch.
Because there's not much you can actually do except watch :D

It's MUCH more entertaining than it sounds like.
Especially watching the "runts" of the litter perform much better than you'd expect by just looking at them when they first show up.

Admiralkiller [Cult of the Valaraukar] January 25 2011 1:09 AM EST

Kind of cool. Like a previous user commented. Needs to be a screen saver.

AdminShade January 25 2011 1:29 AM EST

I find it amusing to see it try something we all know will not work (i.e. car with wheels at the top) and then come up with something different or similar. :)

Demigod January 25 2011 1:36 AM EST

This is pretty cool. I'm hesitate to jack up the mutations, though. 5% seems safe...

Demigod January 25 2011 1:46 AM EST

The colors show the crossover and mutation for each member of the population

Pink means what? Teal means what? Purple means what?

ScrObot January 25 2011 2:11 AM EST

Dug up the following from the author on Reddit ( http://www.reddit.com/r/programming/comments/f6g98?sort=confidence )

---

It has 22 variables that represent 8 points of the car, the wheel size, and axle angles. The spring tension and torque are set according to the mass of the car.

--

EDIT: black line = average fitness, red line = maximum fitness The number in parenthesis is the target score. Once it reaches that score it moves to the next car.

--

The colors dont actually represent different specs on the components, they just indicate the origin of the trate. Each car starts as a color and as they crossover traits the colors go with them. Newly mutated in traits have random colors too. The colors arent treated as variables for the GA, they just accompany the actual variables.

Sickone January 25 2011 2:28 AM EST

Hehe, one comment from an EVE player really cracked me up...

"Every time I watch one of these ridiculous looking-cars drive further than seems possible I feel like Morgan Freeman should be there saying : AND LIFE WILL FIND A WAY"

:)

Demigod January 25 2011 2:34 AM EST

Halfway through the 12th generation and I finally got two cars past 200. Now it's time for me to go to bed.

Sickone January 25 2011 2:35 AM EST

...and let the simulation running ? :)

renamedname [The Forgehood] January 25 2011 7:05 AM EST

...and let the simulation running ? :)

And wake up to SkyNet. No thanks. ;)

Sickone January 25 2011 7:30 AM EST

Hey, Skynet didn't harm anyone !
...yet >:)

AdminNightStrike January 25 2011 7:52 AM EST

I thought it was Jeff Goldblum in Jurassic Park that said "Life will find a way" while banging his fist on the table. It was during their dinner conversation where the old dude then responded "The only one that supports me is the [darn] lawyer!"

Jeff preceded that line, as I recall, with "You're too busy trying to figure out whether or not you could, you never stopped to think whether or not you could."

Sickone January 25 2011 10:19 AM EST

Yeah, it was pointed out to him by somebody else that the quote was not his, but I copied it as it was posted.
Besides, Morgan Freeman does some nice voiceover work in science shows and I'd totally pick his voice instead anyway ;)

Admindudemus [jabberwocky] January 25 2011 11:25 AM EST

after watching for days mine evolved into a hummer.

Demigod January 25 2011 2:04 PM EST

I hate you for posting this. I'm evolving my fourth car right now. At work.

A Lesser AR of 15 [Red Permanent Assurance] January 25 2011 2:43 PM EST

bloodsucking lawyer* & or not you should*

AdminNightStrike January 25 2011 10:36 PM EST

Ah, jeez... the should was in my head :)

iBananco [Blue Army] January 25 2011 10:46 PM EST

Impassable hills are really ruining it.

Sickone January 26 2011 9:50 AM EST

Impassable hills are really ruining it.

There's no such thing as an impassable hill, only difficult hills and cars not suited for tackling any particular one hill :P
If you give it enough time, they'll "find" (as in, randomly stumble) upon a design that can clear it, and if you're lucky, in a few generations it will stabilize enough that most cars from that moment on manage to pass it.
Nobody said evolution works lightning-fast, and this is the best way to gauge the timespans involved (just look at the graphs you get - they go near-flat but not quite flat very fast, with the occasional spike).

Demigod January 26 2011 10:19 AM EST

The disappointing part is that the cars don't really evolve beyond the first few generations. It seems that the variables controlling the polygons are large enough that they negate the ability for the cars to maintain any feeling of evolution.

It's fun to watch the cars evolve from a heap of shapes into something that clears 100 score, but even after 15 generations, it's obvious that the cars aren't advancing. I wish the programmer would enhance the programming of which traits continue on, or at least give us the ability to reset the terrain (let's face it, the cars aren't evolving to a specific one anyway).

It's still lots of fun to watch.

Sickone January 26 2011 11:22 AM EST

Since the population is so low (in the real-world, if a species only has 20 individuals, it's extremely likely to become extinct), it depends a lot on how high you set the mutation rate and when you do it.

If you set it too high even for a single generation, that causes most useful changes to be swamped by not so useful ones, and if you set it very high for a couple of generations, it's basically as good as a restart (but you keep the same landscape, a restart would create a new random landscape).

Too low for too long (like, say, 0% for 20+ generations), and you might get a convergence that wipes out most of the differences between the individuals, so that even if you ramp up the mutation rate again, most mutations are actually doing more bad than good and are eliminated (thanks to the very low population count), making actual beneficial adaptation extremely difficult.

And of course, there's also quite a bit of luck involved, again, especially thanks to such a low population (but be honest, would you have the patience to sit through something along the lines of 1000 runs per generation?)

Demigod January 26 2011 12:06 PM EST

I find the safe spot to be around 5%, which is also the default. I just think it needs more variables to make it work beyond the first handful of generations. Two fluke runs can undo a needed trait, effectively knocking you back to the fourth generation from any point.

Admindudemus [jabberwocky] January 26 2011 12:12 PM EST

aww mine restarted! i had it going for like 24 hours and i just now went to see how it was doing and it is on generation 1 again. ; (

iBananco [Blue Army] January 26 2011 1:29 PM EST

No, it's actually impassable. It's so steep that the wheels don't have enough power to get up the slope.

Admindudemus [jabberwocky] January 26 2011 4:06 PM EST

since mine restarted i can see what bananco means but here is what happened at least on my end. the larger wheels do not turn with as much power as the smaller diameter ones. if your vehicles evolve with two of the larger wheels then you can get into an evolutionary dead end it appears.

i moved my mutations up to seven and that seems to have sped up the rate of evolution and allowed for some interesting developments.

Demigod January 26 2011 5:01 PM EST

I seem to have better luck clearing those large hills with larger front wheels than back ones, but that opens up an issue if the chassis scrapes the peak of the hill. If it hits, it registers as a crash, ending the simulation -- even if it's clear that the car will still clear the peak if given another second or two.

AdminNemesia [Demonic Serenity] January 26 2011 6:21 PM EST

Yeah, from what i've seen the cars that do the best have big front wheels, mid sized back wheels, a chassis that is arched but still medium to small sized. Arched to clear the ridges.

Sickone February 7 2011 10:29 AM EST

They got a newer, better version (actually, several)...

http://megaswf.com/serve/1003760
This is version 2.1 ;)

Demigod February 7 2011 11:48 AM EST

Yay! Now explain Up, Down, Next, Copy Current, and Copy Best...

Demigod February 7 2011 12:20 PM EST

Copy Current makes the next spawn the same as the current, and Copy Best does similarly. Still not sure of Up and Down.

Sickone February 7 2011 12:53 PM EST

"Up" means you artificially increase the "fitness" of the current individual (and keeps it running until it would naturally stop), making it more likely to become a "parent" of more individuals of the next generation.
"Next" skips to the next individual leaving the current one's results so far "as is".
"Down" does what "next" does but also artificially decreases the fitness of the current individual to make it even less likely to be a parent of any of the individuals in the next generation.

"Copy current" and "copy best" will place in your clipboard a long sequence of numbers corresponding to the "genetic code" of a car (the coordinates for the polygons, presence and position of wheels, shock alignment), which can be pasted into the "input seed car" in the "Input Seed / Choose Terrain" menu so that you can start off a new landscape run with similar "cars", for instance.
You can also manually modify it if you wish, it's plaintext... or you could paste the code in here to have everybody else import it if they want to (it's only the seed car, whether the exact model will be used at all in the first generation depends on other factors, like, say, the max number of wheels and frequency selected plus mutation rate).

Demigod February 7 2011 2:05 PM EST

Switching the terrain to "hang ten," increasing max wheels to 5, and increasing wheel rotation power make for a fun experiment.

Sickone February 7 2011 5:00 PM EST

"Wheel freq" is actually the chance that any of the wheels in "max wheel number" will be present or not.

So a max 8 wheel, 25% wheel frequency reboot will have the first generation comprised of roughly 10% no-wheel, 27% one-wheel, 31% two-wheel, 20% three-wheel, 8% four-wheel, down to usually almost no eight-wheel vehicles.
The default setting (3 wheel, 50% frequency) means 37.5% each with 1 or 2 wheels and 12.5% with no or three wheels.

Admindudemus [jabberwocky] February 7 2011 5:03 PM EST

speedway terrain is pretty fun.

Demigod February 7 2011 8:03 PM EST

I maxed out at Sisyphus with 223.1. I hit that mark probably ten times consistently.
This thread is closed to new posts. However, you are welcome to reference it from a new thread; link this with the html <a href="/bboard/q-and-a-fetch-msg.tcl?msg_id=0039nQ">Move over blind watchmaker, the car maker is here!</a>