red42 / HTML5_Genetic_Cars

A genetic algorithm car evolver in HTML5 canvas.
zlib License
1.19k stars 294 forks source link

A car suddenly got launched into the air from the beginning of the race, flying way over the end of the track #11

Open pointyointment opened 9 years ago

pointyointment commented 9 years ago

I had just let the simulation run after opening the page—all default settings. On Generation 26, one of the cars flew into the air from the start of the race and got to 2494.9, -7587.8/243.23 by the end of the generation. The viewport was not able to track it and just showed white the whole time. Obviously it got the top score by a huge margin (about 15× the second highest score), and I guess it wasn't a very well-adapted car, because the next gen started with a lot of bad cars, and they had previously been improving significantly.

The seed seems to be »9=Ž)ŽÞPï\õÙ>ø¼¬KµRa™L ֚ðaH+J¹½FÓIsnónüA¨¿zÏüƟF†ÂÌ#Þfļ®…GS$‚íᎪʛ^3]5üó¾(§¬[¢+ÁµþR~=ë&UO1ŒAÖÓª\ìÌþÍ·4…ŽbLBç¸1S J®ÚT‚Ò€OUEWj6ŸùÛ}ÇäN͹¸G9öþØlG_‚}p[&½ýBŽª×#՟Æ×&½#¼]um¨×q:”ºèþöXᙃpQ¾CQôplüs~^]ú˜EÎlÀ§©î yºb–ãÂöá6ÉuÈdÒ.

scores and track

floorseed

Top replay shows that the car looked like this: flying car

red42 commented 9 years ago

I've seen this happen a couple of times, but I was not able to track the origin of the issue so far. Thanks for the detailed info, I'll look into it some more!

pointyointment commented 9 years ago

More thoughts: I've seen very similar-looking cars several times since, and they all seem to get their bodies permanently stuck through the track, sometimes shaking a bit, as soon as they're dropped. Maybe the launching was the result of the physics engine trying to resolve the car's body penetrating the track.

I still have the same simulation running (gen 825 now!), though I've adjusted the settings countless times since the flying car happened.

pointyointment commented 9 years ago

Update: Now that I'm watching more closely, I'm seeing a car like that at the beginning of every generation, just about as far left as it can be. It shakes for a bit and then goes still right before going out of view (tracking the leader). None has gone flying yet. I have mutation rate set to 50% and mutation size set to 40% currently.* Because it's always the first car to die, it's easy to see what its number is. As expected, it seems to be random, which might help rule something out, or might not. (I've seen it be 10, 13 14, 15, and 19 (with elite clones set to 10).)

Edit: changed them to 75% and 50%, respectively, and the car still appears every time.