LD 24: Creating procedural critters

Posted by
September 12th, 2012 9:00 am

How do you create theses insect/plant like critters


from these basic shapes?


That was the question I posed myself for the Ludum Dare 24 compo. The theme was evolution and I wanted to create some little critters which could change there appearance smoothly.

The basic shapes you see above can be easily described using polar coordinates.

Polar coordinates express a 2D curve in the form r(t). For each angle t the function r(t) gives the radius at this angle. Here are the definitions of the simple shapes above:

  • Sphere: r(t) = 1 (a circle has constant radius)
  • Star: r(t) = r0 + (1-r0)*(1-abs((n*t mod 2 pi)/pi-1))^p. This is a bit complicated – I could not find an easier definition. n is the number of star corners and r0 and p are additinal parameters.
  • Rose: r(t) = cos(n*t), where n is the number of rose petals.
  • Cardioid: r(t) = 1 + cos(t + pi). This is a funny mathematical object.

Now how do we get the complex shapes? Easy: they are formed buy just using a linear combination of the simple shapes.

For example we use the two simple shape functions r_star(t) and r_cardioid(t) and form the linear combination r(t) = a*r_star(t) + b*r_cardioid(t). Using a and b equal to 0.5 yields the third shape you can see above.

You can use my critter generator to create your own critters.

Also, play and rate my compo entry!

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]