I figured out an easy way to save animated GIFs from the Siftulator! Here are some nice ones of Squaresville, the puzzle platforming game I’m developing. More technical info about how my method works after the jump.
‘
This method will save an image for each frame of your game, so it works best with a fixed time step. Add this simple code after your System::paint() call and it will cause lua to save out an screenshot of a cube every frame while incrementing the count each time. In this case it’s saving out images from cube 0 into a folder called temp.
static int count = 100000; SCRIPT_FMT(LUA, "Cube(0):saveScreenshot('temp/%i.png')", ++count);
You can experiment by changing the cube number, folder, filename, etc. The inline LUA interpreter is a very powerful feature, this is a good intro to how it works. So, after you’ve got the code working and run your game, and it will start dumping images to that folder. Let it capture a short segment of gameplay and follow these simple steps to convert it to an animated GIF…
- Open up GIMP, select File / New and set the size to 128×128
- Select File / Open as Layers
- Select all those images and click open. (it may take a while to open)
- Select Filters / Animation / Optimize (for GIF)
- To make it larger select Image / Scale Image, choose an even multiple of 100 percent and set interpolation to none.
- Select File / Export, and type a name for the GIF.
- Choose to save “As animation”. For “Delay between frames” enter your timestep and choose “Use delay entered above for all frames.”
It’s a pretty simple process that is good to know because it can be used to create animated GIFs from any sequential image source. If you make any cool GIFs using this technique go ahead and post them in the comments section!
Leave A Comment