Wednesday, July 15, 2009

The Blob

The vast majority of my time working on Time Stop was spent making the blob. There were two main challenges in creating it:

Physics:

Since Box2D only simulates rigid body physics, I had to create the elastic body using many rigid components. I first created a grid of circles to act as the main body of the blob. The circles are allowed to overlap and are connected together using many forces. The forces keep the circles at a reasonable distance apart while still allowing them to move relative to each other. This is what gives the blob its elastic properties. I then added a chain of thin rectangles around the edge of the circles to act as a membrane. The membrane helps define the shape of the blob and also acts as a barrier for colliding objects.
Graphics:

OpenGL can only render straight lines. This creates difficulties when trying to render curves (a blob). A curve can be approximated using many straight lines. The straighter parts of the curve require less lines while the rounder part of the curve requires more lines. I used NURBS to create a smooth curve using the rectangles on the membrane as control points. In order to fill in the interior of the blob I used many solid triangles all connected at a central point.
I have released a new version of Time Stop. This version has better blob physics, faster game play, and a new (challenging) level.

No comments: