21
May 10
My latest game has just gone live! It’s a fast paced platform puzzler created for Cartoon Network’s Ben 10 Series. Kerb produced all of the graphics and animations and they got me in to do the programming.

You can play the game here. Enjoy!
29
Mar 10
Metaballs are organic looking blobs and are often used to model fluid drops as they join together and pull apart. Usually a metaball is described as a source point with a field around it. As the field moves away from the point, the energy of the field diminishes. When you have several metaballs together, the energy at any given point is simply the sum of all the energies of the metaballs in the system at that point.
The edge of a metaball is linking together areas of the same energy, much like the contours on a map. It is these contours that give the metaball its distinctive blobbiness.
Here’s a quick example of what I’m talking about. Click on the image to watch the metaballs in action.
Click on the image to watch some metaballs in action
There are lots of methods for modelling metaballs in two dimensions. One of the best I’ve come across is this one which uses a very efficient method for determining the edge of the metaball and then tracing around that edge to define the shape.
An even faster method for displaying metaballs can be achieved by using BlendMode.ADD which does all the adding up of the energy fields for us. If you represent the energy field as a circular gradient starting with blue in the centre (0xFF) and going out to black at the perimeter (0×00) any pixel’s value in that circle will describe the energy of the field at that point. By overlaying these gradient circles with BlendMode.ADD, the blend mode sums the values of each pixel and displays the sum of energies at that point. All that’s let to do is apply a palette map to convert the blue energy field to something prettier.
The source code for the example is after the click. There are two classes, one controlling the simulation and the other describing each ball.
More…