Making Animations in BZFlag (September 10th, 2008)

I've had a few thoughts on how to make animations for a long time. I tried making long rows of passable boxes that were textured with the right frame of a movie and driving through them at a constant speed. That didn't work too well, because each frame would magnify as I got closer. Then as I drove through, the next frame would be at a smaller magnification. It ended up being quite headache inducing.

I also tried using a Texture Matrix to move images past a small slit, much like a movie projector. That didn't work too well at all because the images couldn't stop at the slit. I then thought about a black band with clear gaps that would run in the opposite direction to cancel out the.... ya, things just got too complicated and I gave up on the idea.

Finally, I found out how Planet Mofo's billboard works. It uses Dynamic Color to make individual images go clear. After that it's just a simple matter of putting your images on a mesh face, stacking them all together, and figuring out out which images should go clear when and for how long. I did a 5 frame test by hand at first, and decided there must be an easier way. I then made a Perl script that asks a few questions and spits out a map with an animation all ready to go.

Eadweard Muybridge's The Horse in Motion
Eadweard Muybridge's "The Horse in Motion"

First you need to get a series of images that are in a <name><number>.png format. There shouldn't be any spaces and each frame should be numbered chronologically. There are a number of ways to do this, and I use QuickTime to export to image sequence. It works ok, although it sometimes puts in preceding 0's in the number part of the file name.

Then, get bzwmoviemaker.txt and change the path on line 7 to where you want the map file to end up. Run bzwmoviemaker.txt in a Terminal, and answer these questions:

How Many Frames?
How many images are in the image sequence.

Speed (Use 0.1 For Most Videos)
Changes the speed of the animation. Use higher decimals to slow the movie down.

Horizontal Pixel Size and Vertical Pixel Size
I make the mesh fit the image, so there's no need to worry about distorted images.

Path To Textures
This can be a folder on your computer, or the path to some image album on the web.

Texture Prefix
What you saved the image sequence as.

Final Group Name
The script groups your animation together so it's easier to move around.


It doesn't eliminate all handcoding yet, but it automates an awful lot of stuff.