2

I am designing a game in pygame at the moment and i was thinking how low my framerate was (an average of 7 fps). I investigated further and did convert_alpha() for all my images and I wondered if there was a simple way to make it so that if nothing in the window had changed the frames would not update, therefore this may result in a higher framerate.

As I said earlier, I did convert_alpha() to all of my images yet my framerate did not increase whatsoever. I have google other ways and I thought what I really needed was a program controlling whether or not I needed to update all the frames.

I just need some sort of program that can do this for me. Any sort of help would be greatly apprieciated!

martineau
  • 119,623
  • 25
  • 170
  • 301
Guydangerous99
  • 147
  • 1
  • 12
  • 4
    If the display hasn't changed, simply don't call `display.update()` or `display.flip()` that iteration of the main loop. – martineau Jan 30 '19 at 20:36
  • I suspect that `display.update()` is not the operation that is taking lots of time in your main loop. Perhaps [this answer](https://stackoverflow.com/a/582337/7675174) on profiling will help you investigate the problem. – import random Jan 30 '19 at 21:16
  • Perhaps using PyGame's "Dirty" (rendering) functions may help - please see a tutorial: http://n0nick.github.io/blog/2012/06/03/quick-dirty-using-pygames-dirtysprite-layered/ – Kingsley Jan 30 '19 at 22:11
  • These don't work, I just added another map into the equation and now it's even worse, something like just over 3 fps!?! – Guydangerous99 Jan 31 '19 at 19:42

0 Answers0