Genetic Algorithms for Parameter Tuning
9 years ago
Recently the Tech Toolbox at GDC had a call for submissions, I saw it last year and thought it was a great session, with some great ideas. So I have been thinking, is there any useful stuff I have made for Yucatan which other people might find useful?
After 30 failed attempts I have a car that can drive up a hill. Solution? Stick a rocket on the back. pic.twitter.com/CJfUrvE0Pl
— Joe Bain (@oh_cripes) December 17, 2015
I have shown a few people my hill climbing test and my handling tests. I used these to tune the parameters on the car in Yucatan. It's quite fun to watch all the little cars run around and fall over, but also I found the approach I worked quite well and, based on the reactions I got, seemed quite novel. What I had been doing was very similar to a genetic algorithm - only I had been doing it manually, but what if I could automate the process? I spent yesterday and today putting together a proof-of-concept, and as you can see in the video below, it works! I plan to tidy this up now and when that's done I'll offer it as an open source asset.
To give a basic overview of how the plugin works here is what I did to create the video. I first created a copy of my car control code which has most of the same parameters, but it drives itself - in this case, just straight forward. Then I added the car to a simple scene which is just a flat plane - with the car's default parameters, it slides backwards. Then I added the GA controller, set the original car as the control, and entered the names of the properties I wanted the GA to tune. I also wrote a simple fitness function for the test, it just uses the Y coordinate, i.e. the height traveled up the hill, to score the cars. What you can see in the video is the algorithm running - each generation, the best performing car is chosen, cloned, and randomly mutated. And we end up with a bunch of cars racing up the hill!
Check back here in the coming weeks for the source code, or follow me on GitHub.
Lazer Lips
9 years ago
I wanted to make a game which would challenge traditional input styles whilst still remaining accessible to players at home. I decided to try to make use of some fairly ubiquitous hardware, the microphone and camera on most laptops. Whilst these input mechanisms may seem old and dull, they are rarely used in games, and can still produce novel and exciting experiences.
The game draws on mechanics used in Singstar, experimental games like Pew Pew, and of course traditional games from the sidescrolling shmup genre.
Tower 10,000
10 years ago
I have been working on a new puzzle game called Tower 10,000. It's inspired by Threes and has a sort of Rymdkapsel aesthetic. It is now "out"! Play it at towertenthousand.com or get it on Android. iPhone will be out very soon, once I am back from GDC.
Handling Large Collections in Backbone.js
11 years ago
I gave a talk yesterday at the Backbone.js London meetup on handling large collections with Backbone. It mainly draws on my experience writing the Autographer desktop application.
The slides are online at joeba.in/backbone-show.
Javascript Copy Hijack
11 years ago
I found an interesting feature in the Digital Spy website today: text copy hijacking.
If you select some text on the site, hit Ctrl-C or right click and copy, you don't get exactly what you asked for. I copied this text from the site (I am looking out for Glastonbury tickets):
Ticket + Coach packages will go on sale on Thursday, April 2. at 7pm.
And when I pasted it I got the following:
Ticket + Coach packages will go on sale on Thursday, April 2. at 7pm.
Read more: http://www.digitalspy.co.uk/music/news/a561396/glastonbury-festival-2014-ticket-resale-announced.html#~oAboMkgLeXyhqY#ixzz2xdI6jiXf
Follow us: @digitalspy on Twitter | digitalspyuk on Facebook
A link back has been added on the end as well as Twitter and Facebook links for the site. Apart from being a bit shady, how do they do this?
At first I thought there must be a flash shim, to modify the system clipboard, since Javascript provides no way to modify this. Looking through the requests the site makes though there is no trace of anything like Jeffery Larson's _clipboard.swf
.
Grepping the source for the site for the phrase "Read more:" reveals a javascript file from tynt.com, who promote their ability to "Leverage On-Site Copy & Paste Activity". Culprits identified!
My next guess was that on mouse up TYNT are adding a hidden element to the page within your selection. Checking window.getSelection(), the anchorNode and extentNode match what I selected and don't seem to have been modified.
Looking through the included ti.js I found an event listener being attached to the copy event, which it turns out is quite widely supported. When this fires the selection is grabbed using Window.getSelection(), a new temporary element is created on the page using document.createElement(). Then the selection is modified using selectAllChildren() and the temporary element is removed.
Here's a demo of the effect.