BGE: Make screenshot overwrites existing file


I have a python script set up

import Rasterizer


which makes and saves a screenshot every x logic ticks. In the embeded player it just works fine and gives me Pic.001, Pic.002 etc.
However, in the standalone player, it overwrites the existing file.

  • Does anyone know the solution for that?
  • How can I change the path for the screenshots to be saved in?

Thank you for the help,


Thanks that works. Still, it overwrites the existing file…? Any idea?

Hi! I thought HG1 made a patch to fix it… Maybe it’s not already in the trunk.

import bge

cont = bge.logic.getCurrentController()
own = cont.owner

if "i" not in own:
    own["i"] = 0

if cont.sensors["Mouse"].status == 1:

EDIT: Sorry It seems I have not read the question correctly.
I didn’t know the ### tip
On my computer it works in standalone. Maybe you have to precise absolute path… /home/user/Pictures

os.getcwd() returns the same directory in embedded and in standalone?

I think you need to check if the file already exist by your own. Check the Python documentation regarding file handling.

Thanks for the help, turned out that the 2.74 blender pointed to the 2.69 standalone player which was the issue.
With the 2.74 player it works fine,

Did you see a drop in GLSl textured view port and in-game speed drop with that problem?