Saving Frames

So I have a camera fly-by and I would like to save the frames from the Game Engine to make a movie.

I have this code from Mike Pans old mountain fly-by scene, but it does not seem to work in 2.65. Or maybe I am doing something wrong, but.

Should this work?

import Rasterizer
cont = GameLogic.getCurrentController()
obj = cont.getOwner()
sep = ""
num = str(obj.counter)
filename = sep.join([num,".BMP"])
Rasterizer.makeScreenshot(filename)
obj.counter += 1

Try this code:
I assumed “counter” is a property.

from bge.logic import getCurrentController
from bge.render import makeScreenshot

cont = getCurrentController()
obj = cont.owner()
num = str(obj['counter'])
filename = "{0}.BMP".format(num)
makeScreenshot(filename)
obj['counter'] += 1

well rasterizer is now bge.render and gamelogic is now bge.logic so try this maybe:

from bge import render,logic

cont = logic.getCurrentController()
obj = cont.owner


sep = ""
try: num = str(obj['counter'])
except : obj['counter'] = 0; num = str(obj['counter'])


filename = sep.join([num,".BMP"])
render.makeScreenshot(filename)
obj['counter'] += 1

I think it will save your screenshots in the folder you installed Blender

Use this code instead.

import Rasterizer
import bge

cont = bge.logic.getCurrentController()
obj = cont.owner
num = str(obj['counter'])
filename = '//' + num
Rasterizer.makeScreenshot(filename)
obj['counter'] += 1

Make sure the object running the script has a integer property named ‘counter’.

Wait this would be for 2.49 right? And how what would change for 2.65? rasterizer -> bge.render only right?

Yeah, he left the rasterizer line at the top. He was trying to take a shortcut importing bge.render as Rasterizer probably. Just use one of the other ones posted above.