14 ms·
HTML5 Genetic Cars
- loupeabody 13y agoThis is awesome! When a handful of cars actually make for a good race it's especially mesmerizing. I feel like it's only a matter of time before some startup implements a genetic driven visualization of the data from their app. If the effect is as compelling, I'd be staring at their marketing page for a long time.
- agilebyte 13y agoHow would you determine the fitness of a "visualization" programatically?
- Groxx 13y agorecord time-on-page maybe?
- terabytest 13y agoGenetic A/B Testing!
- randomsearch 13y agoHa, you laugh, but human-in-the-loop evolutionary algorithms are well established. And the research communities involved are now looking at applications to cloud computing. So it's just a matter of time before this... recombination.
- evv 13y agoMechanical Turk?
- loupeabody 13y agoForgive my wording, but I mean that whatever data is visualized is what would be subjected to fitness test, not the visualization itself. Just like the shapes of the chassis and the size of the wheels in this demo are essentially numeric data visualized into a series of canvases, some hypothetical startup's data could be visualized in a potentially compelling manner. That's presuming, ofc, that the original data is already suitable for genetic manipulation. What that data/startup would be? I don't know, just casting an idea.
- balanceiskey15 13y agoOh what I would give to pit my genetically-superior boxcar against a challenger.
- MDCore 13y agoBoxcar2d let you save the genome of the car. I spent months running multiple instances, trying to develop a car to beat those tracks (and the others on the forum). This one has some amazing features. Hopefully Rafael will give us some way to compete!
- alan_cx 13y agoIt says at the bottom: "Create new world with seed: The same seed always creates the same track, so you can agree on a seed with your friends and compete. :) " Sadly, that is pretty much the only bit I understood, ish...
- chrisrickard 13y agoFantastic!
- IvyMike 13y agoMaybe someone more versed in the state-of-the-art can help me: has the concept of "speciation" ever been applied to genetic algorithms? In my instance, there are two predominant "types" of cars that are doing approximately equally well--the "rhinoboat" and the "assdragger". But when these two solutions are combined in the crossover, I think they make an offspring that is terrible. If the algorithm would mate only the rhinoboats with rhinoboats and assdraggers with assdraggers, I'm convinced we'd end up with some superrhinoboats and superassdraggers, but instead I just get an unhappy compromise. Maybe make "similarity to self" one of the genotype parameters. A high rating here would mean the phenotype would have a bias against being combined with dissimilar creatures. This allows the propensity towards speciation to develop evolutionarily, too.
- grinich 13y agoActually, the thing genetic algorithms try to do is break out of this local maximum, mutating past a trait correlated with poor performance in hopes of finding a more fit solution.
- IvyMike 13y agoIn my hypothetcial algorithm, of course mutation would still take place. But my current instace of the web page is at a point where it's wasting a lot of time on unfit 'mutts' and it seems like I could get to a "best rhinoboat" and "best assdragger" solution faster if it would stop wasting time exploring the mediocre blend.
- grinich 13y agoYeah, most effective genetic algorithms take a hybrid approach where they only do more dramatic mutations for some of the population, and then optimize the rest with a regular fitness function and small variations. The goal with these systems is to have several different but effective breeds emerge. I didn't dig into this implementation, but it seems like it doesn't carry many (more than one?) individuals between cycles.
- icambron 13y ago
- 89vision 13y agoThis looks very similar to something that was posted on reddit a couple of years ago. http://boxcar2d.com/ http://boxcar2d.com/
- jld 13y agoThe author mentions it's based on that, but totally rewritten. "The program uses a simple genetic algorithm to evolve random two-wheeled shapes into cars over generations. Loosely based on BoxCar2D, but written from scratch, only using the same physics engine (box2d). seedrandom.js written by David Bau. (thanks!)"
- lmm 13y agoboxcar2d is much more fun as it lets the number of wheels evolve.
- SeanDav 13y agoIs there a way to save the current world seed? I have a layout that is defeating all cars even after 50 generations and counting. Would love to keep on testing against this world.
- zellyn 13y agoThe world seed is the string in the text input.
- Glyptodon 13y agoHave people actually had the course completed? I've been using 'genghisKhan' as my track seed and they always stop around 2/3 to 3/4 of the way it seems.
- dpcx 13y agoThe "course" always gets longer. No matter how long it currently is.
- lessnonymous 13y agodeep man.
- dreen 13y agoNo, it stops at around ~220 after which the car just falls into the void. I got to around 200 without hacking after about 300 generations but then the terrain just gets too much for any of the little guys. So if you want to beef them up a little, type this in javascript console: motorSpeed = 50; wheelMaxRadius = 2.0; chassisMaxAxis = 2.5; and hit New Population
- obituary_latte 13y agoOh man...some hilarious iterations there. Especially funny after playing with the normal version for a while. All of a sudden: "PARDON ME HUGE WHEELS HAULIN' ASS COMIN' THROUGH"
- tonetheman 13y agoholy batmobile.... awesome
- dreen 13y agoThis is great, desperately needs sounds! VROOOOOOM
- harrylove 13y agoI am not ashamed to say I was adding dragster sounds, squealing tires, grinding metal, crash sounds, and little driver sounds in my head. Those guys were striving soooo hard to get up that hill. "Ooh ooh ooh, I can make it, I can make it!" There really is something to this that needs exploration as a multiplayer game. The aleatoric quality makes it infinitely watchable for me. GenetExcitebike.
- alxndr 13y ago+1 for the word "aleatoric"
- saraid216 13y ago> There really is something to this that needs exploration as a multiplayer game. The aleatoric quality makes it infinitely watchable for me. This quality? http://darthsanddroids.net/episodes/0038.html http://darthsanddroids.net/episodes/0038.html
- harrylove 13y agoYes, and specifically Roger Caillois's use of the term in Man, Play and Games[1]. And I suppose if you want to be technical about it, this simulation appears to have a little piece of each of his four categories of games, to include agon, mimicry, and ilinx with the aforementioned alea. http://en.wikipedia.org/wiki/Man,_Play_and_Games http://en.wikipedia.org/wiki/Man,_Play_and_Games
- saraid216 13y agoI was a little confused that you feel that chance isn't a strong enough factor in multiplayer games. It's so widespread and pervasive that I'm willing to "omnipresent" is only a minor exaggeration.
- bsimpson 13y agoI just spent half an hour of my life rooting for imaginary cars that ceased to exist as soon as I closed the tab.
- jackmaney 13y agoDidn't Voltaire say something like that?
- stephengillie 13y agoVirtualized NASCAR?
- saraid216 13y agohttp://schwitzsplinters.blogspot.com/2013/04/adam-and-eve-in-happiness-pod.html http://schwitzsplinters.blogspot.com/2013/04/adam-and-eve-in...
- grinich 13y agoOn the cosmic scale, rooting for any sports team isn't much different... ;P
- BHSPitMonkey 13y agoEven from practical frames of reference, it has about the same effect on most of the spectators.
- ISL 13y agoSeveral hours here, twiddling parameters. Lordy do I love enhanced stochastic optimization problems.
- sgdnogb2n 13y agohttp://www.penny-arcade.com/comic/2009/9/25/ http://www.penny-arcade.com/comic/2009/9/25/
- therealunreal 13y agoI just replied to someone that ceased to exist as soon as I closed the tab.
- ronaldx 13y agoObservation: The cars tend to optimize to get over a challenging hurdle (while it's being worked on, the cars converge to a single solution: which works well), but then are no longer general enough to get over later hurdles.
- acallaghan 13y agoI found my life to be strikingly similar
- Trezoid 13y agoThat somewhat depends on the mutation rate. I have it set to 20% and the cars are optimizing down to big wheels connected by what can only be described as a bar, which means they can drive in any orientation and are clearing later and later challenges quite effectively.
- MattiasE 13y agoAwesome!
- phaedryx 13y agoIf this were a screensaver, I'd never get anything done.
- MWil 13y agoI watched this shit for like 30 minutes
- cfontes 13y agoit's the 10th time this one pops up in HN.
- mck- 13y agoWe need a high-scores page with levels :) Level: marc - 172.68
- pilom 13y ago178.43 at generation 16. That stupid wall at 171 is ridiculous! 199.47 @ gen 22. Now it is just a matter of luck whether or not they get a good jump in.
- sambeau 13y ago#1: 166.15 d:161.48 h:-4.4/4.12m (gen 195) It was a very tough track...
- davidjohnstone 13y agoI have a 200.24 d:196.51 h:-17.24/3.29m (gen 55). At the 190 mark the world goes all glitchy and half the track disappears. It's a shame it's not as deterministic as it could be (according to the blurb at the bottom of the page), since this [probably] means the genetic algorithm can't exploit quirks and things being "just right" optimally. Rather, it has to build something that is a bit more generalised.
- crisnoble 13y agoscore: 512.85 d:507.31 h:-5432.59/1.7m (gen 5) level: 71044092 The car made it thru the whole level and just kept falling forever. I think it was a very lucky fluke. screenshot https://www.dropbox.com/s/8777mtx2g6maf96/Screen%20Shot%202013-06-26%20at%201.07.00%20PM.png https://www.dropbox.com/s/8777mtx2g6maf96/Screen%20Shot%2020...
- kayge 13y agoLevel: HN - 2667.94 Believe it or not, my cars evolved into "Flying Cars" (They start with one wheel stuck in the terrain, moving slowly forward, then it releases and goes flying over the track) http://imgur.com/n6g8VRH http://imgur.com/n6g8VRH
- kayge 13y agoThis is ridiculously entertaining, and bringing back some fond college lecture memories. Feature request: Ability to hover over the "Top Scores" and see a snapshot of what the Car looked like.
- hvs 13y agoThat system is too complex not to have an intelligent designer.
- deleted 13y ago[deleted]
- unimpressive 13y agoEven if it is, who designed the designer?
- nsomaru 13y agoAnd thus we (I) infer the existence of the big G in the infinity of intelligent designers required to keep going down that rabbit hole.
- super_satan 13y agoTime is cyclic, don't you know?
- hcarvalhoalves 13y agoComplex? You can't get simpler than brute forcing a problem.
- rtkwe 13y agoGAs are a good bit above brute forcing. Brute forcing this would be enumerating ever possible car and testing them all.
- hcarvalhoalves 13y agoBrute force doesn't necessarily mean testing in a dumb way (testing all options). If you try to crack a password with a wordlist, would you do it randomly, or would you order by word frequency? The later is smarter, but it's still brute forcing (resource/time intensive).
- Systemic33 13y agoLet's compare results/stats on the map "Hacker News"
- Fuzzwah 13y agoThat seed has an amazingly difficult part at around 156
- Fuzzwah 13y agoI switched to "Hacker News Cars" and my master race of fishmobiles are now at: #1: 183.44 d:178.09 h:-5.26/2.87m (gen 22) There is an epic hill at 180..... Will give it another 10 generations and see what they can do.
- ajays 13y agoThat was a tough one. Finally, at gen 669, one of the cars managed to jump it. #1: 200.72 d:195.95 h:-5.38/6.55m (gen 669)
- shmageggy 13y ago156 is tough but doable. A couple of my populations have cleared it. 175, however, looks fairly impossible :) http://imgur.com/iIIcGnJ http://imgur.com/iIIcGnJ Edit: 175 has been cleared by one of my populations at generation 155! 187 is definitely impassable, though. http://imgur.com/GwO4j4W http://imgur.com/GwO4j4W
- jamesjporter 13y agoAwesome! A really cool version of this would let the user write their own algorithm and then have users compete against each other for whose algorithm can evolve the best car.
- bcoates 13y agoWorld seed "schnoo" has a particularly tough hill from 125-145 that several different models can almost but not quite overcome. Anyone able to get over it?
- ISL 13y agoYes. Small body car, low density but large wheels. #1: 192.22 d:187.68 h:-0.61/17.32m (gen 4694) #2: 192.09 d:187.42 h:-0.75/17.78m (gen 7914) #3: 191.32 d:187.34 h:-0.75/18.05m (gen 7430) #4: 191.16 d:186.26 h:-0.75/16.91m (gen 7822)
- boneheadmed 13y agoIt took only about 9 generations to the evolve the Tron lightcycle. Way too cool. This is like the marble races down hotwheels tracks we used to do as kids while recording the times, only way less work.
- ancarda 13y agoThe seed "HN" produces a fairly stable world (1 car makes it quite far). Eventually crashes.
- brianpgordon 13y agoCan we standardize on a seed to compare scores? HN sounds good to me.
- deleted 13y ago[deleted]
- quote 13y agoHighscore 188.23, that wall at the end just proves too high..
- frakkingcylons 13y agoMy cars were able to jump over it at the 342nd generation. Although later in the range of 1100 generations they were still having trouble.
- brianpgordon 13y agoI got past that wall, but the track goes completely crazy after that and it's impossible to proceed. http://i.imgur.com/KPfKdab.png http://i.imgur.com/KPfKdab.png
- ChuckMcM 13y agoThis was a lot of fun. A suggestion for improvement might be to weight where the changes can come (so more or less likely to change wheelbase, or more or less likely to change height, etc) But overall very nicely done.
- deleted 13y ago[deleted]
- hcarvalhoalves 13y agoCool. Now make a version with legs and you'll freak some people out.
- sirsar 13y agoI'd like to also have an "intelligent design" button. You'd set the vertices and radii and compete against the evolved cars.
- emehrkay 13y agoThis seed: "Enter sdfsdfs string" has an almost impossible hill at the end. I've been watching for 20 mins Edit: This app is very well put together. The "winner"(one that got the furthest) of the previous round is up front for the next and I believes becomes the zero car
- vitomd 13y agoThe road will be harder and harder in the end. The code said so: for(var k = 0; k < maxFloorTiles; k++) { last_tile = cw_createFloorTile(tile_position, (Math.random()3 - 1.5) 1.5*k/maxFloorTiles); Last parameter is the angle
- shmageggy 13y agoBy design, every world has an almost impossible hill at the "end". The world keeps extending in a procedurally generated manner (based on the seed) as long as any car keeps moving. And what other than a tough hill will stop a car.
- deleted 13y ago[deleted]
- Houshalter 13y agoThis is very fun, I love playing around with genetic algorithms and watching them evolve. How exactly does the simulation work? Does it stop after a certain amount of time, or do they burn fuel or something? Are they selected for distance, or how long they survive, or what?
- pests 13y agoI can't answer all the questions but it seems that the current generation is tested until it can no longer make progress for a certain amount of time (displayed as the bar next to its number decreasing, only to be refilled when exceeding its current maximum distance.)
- MWil 13y agovbbvyubeuyfvefeojfeiojf at 200, there's a bloody wall!!!
- lettergram 13y agoHmmm mine just grew into giant two wheels essentially. Started with high mutation, then when I saw one reach about 160 put it to 3% mutations with 5 clones and slowly increasing every time
- MichaelGG 13y agoThis is fantastic. There should be a place to enter your own inputs though. The point of genetic algorithms is to find solutions that you can't engineer yourself, right? I'd like to try my hand against evolution.
- vitomd 13y agoThat's my favourite genetic algorithm page , also worth check is this http://boxcar2d.com/index.html http://boxcar2d.com/index.html where you can create your car and see the best created.
- seestheday 13y agoThat worked surprisingly well on my blackberry z10.
- deleted 13y ago[deleted]
- MWil 13y agois there always a wall around 200?
- tokipin 13y agothis is well done
- thrownaway2424 13y agoPlease stay on topic, by implementing a genetic Edward Snowden who runs as far as possible from the NSA. This is HN, after all.
- deleted 13y ago[deleted]
- anymane 13y agoThis is a lot of fun to watch, great idea
- RoryH 13y agoThis put a smile on my face. There's something nice and simple about it.
- DanBC 13y agoI freaking love this. There didn't appear to be anyway to send a small donation to the creators. People competing against each other on a variety of pre-made tracks would be amazing.
- styts 13y agoCould you add a genome for "weight"? Some cars seem so light that they overturn easily.
- styts 13y agoA _gene_ for weight.
- jeremyarussell 13y agoAs mentioned already you mean gene, but yes you can and he does already with the wheel density, giving the darker ones more mass than the lighter ones.
- whouweling 13y agoI've also experimented a bit with this type of simulation quite some time ago, you can find the result here http://lifesoup.sourceforge.net/ http://lifesoup.sourceforge.net/ This tries to simulate simple "swimmers" where the fastest survives and spawn new entities with slight variations. (Note: this is not my best code :-))
- davidw 13y agoIt sort of reminds me of Dukes of Hazard. It seemed that they would always go off a jump in the car chase scenes.
- Kiro 13y agoI'm using 5% mutation rate and have 1 elite clone. I thought that meant that the whole population would be based on the winner with a 5% mutation chance (so all 19 are children of the winner). However, I have a track with an "impossible" hill and every round there's one car that almost makes it over but it's never that one which is blue next round. How does this work exactly? EDIT: It seems the one that almost made it was a replay ghost or something and not part of the population. Still wondering if I understood it correct though.
- meandthebean 13y agoI recommend a smaller mutation rate. You see the inheritance of the previous winner a lot better.
- MrBra 13y agobeautiful
- Kiro 13y agoShouldn't 0% mutation rate and 1 elite clone mean that all cars in the next generation will look the same?
- bvdbijl 13y agoNo, because it combines cars to generate new ones. Better performing cars have a larger chance to become a 'parent'. You should check out the source, it's suprisingly readable
- benjoffe 13y agoI've been iterating over sequential seeds looking for one that contains the most downhill terrain, so far the best is: 24427169 - it descends very rapidly in the later part of the track. I'll keep this running over night and post results. Edit: 71044092 beats that (declines 47 units in the distance of the track, which is 220 units long).
- fimoreth 13y agoI used your seed and my cars have fallen off the track...
- benjoffe 13y agoYeah after 220 platforms the terrain on all seeds ends, which is a shame.
- jchrisa 13y agothanks, I'll try your level. I saw a really cool looking car on the world "sail" after 1219 generations https://dl.dropboxusercontent.com/u/14074521/genetic-cars.png https://dl.dropboxusercontent.com/u/14074521/genetic-cars.pn...
- pavel_lishin 13y agoThe problem is that once your car makes it to "the end", it keeps falling forever, not losing any forward momentum, so the level never ends.
- lsjroberts 13y agoFor anyone who is interested it is probably worth checking out this - http://www.rockpapershotgun.com/2013/06/24/darwinning-species-artificial-life-real-evolution/ http://www.rockpapershotgun.com/2013/06/24/darwinning-specie...
- Gravityloss 13y agoSpeedup improvement should be possible by not actually evaluating the clones as we already know their results - or maybe just show one as a placeholder. At the moment, if you add "elite clones", the camera follows the stack (but all are exactly on top of each other) and it's a bit slow.
- c-oreills 13y agoJust burned a couple of hours of developer time as everyone crowded around my monitor rooting for imaginary cars. Oops.
- dorkrawk 13y agoFor those of you interested in GAs, I built a small Ruby gem to make building genetic algorithms a little easier: https://github.com/dorkrawk/darwinning https://github.com/dorkrawk/darwinning
- guiambros 13y agoWhat is equally amazing is that the author is a world yo-yo champion, and truly a yo-yo ninja: http://www.youtube.com/watch?v=Y5DeyIScwzg http://www.youtube.com/watch?v=Y5DeyIScwzg That seems his past time, when not coding genetic algorithms...