Monthly Archives: October 2013

Color Sort game

colorsort1We were sorting around some little colored tokens from a boardgame the other day and it gave me the idea for a a game of making piles of identical colored objects.

Here‘s the result in the HTML5 canvas.

I found it to be smooth in Chrome but sluggish in Firefox. The collision detection could be optimized quite a bit.

Find the code on github.

 

WebGL planet

planet1

Here is a little webGL demo I have started working on, based on something I did in 1997. Back then I had to precalculate images to make an animation though.

This planet is made of about 200 thousand triangles. The triangles are generated along layers. Compared to subdividing an icosahedron and projecting on a sphere this method generates triangles that are more uniform in size, though they are less equilateral.

The terrain is generated by displacing vertices along the normal to the sphere using a sum of sine functions of x, y and z. Colors are simply function of the altitude.

If your device can handle it, check out the nicer looking high polygon count version (over one million triangles).

You can find the source on github.

Acknowledgments to http://learningwebgl.com/blog/ for much of the code.