On 2/5/2012 6:23 AM, Luis Morcillo wrote: > I finished the tiled background engine, and I've noticed a > 15 fps drop in 1920x1080. And when I added a 5 planes parallax scroll, > fps are going down to 10-20. I doubt it's the machine, as I play games > like Starcraft in Ultra settings on it. Also, I'm noticing most games > developed with Pygame are 640x480 or 800x600. So the question would > be: is Pygame suitable for doing a full HD side-scrolling platformer? > > My current approach is to render all scrolls planes and the tiled > background to a single surface (the ".image" of my Stage class), > instead of rendering each one in different planes. I haven't tried > separating yet, but I doubt it will improve performance, as the > blitting will be the same. Am I wrong? > If you don't blit it directly to a HWSURFACE, then it will still be software blitting and probably wont make much of a difference. Try initiating your .image with the HWSURFACE flag, and see if it improves speed.
I think you are blitting everything to a .image, then the .image to the screen once, right? > I've read the Surface.blit() function is somehow slow and shouldn't be > overused, but I don't know another way of rendering images to the > screen. I tried using flags "HWSURFACE | DOUBLEBUF | FULLSCREEN" and > it increased 2-3 fps. Am I missing some other optimization or am I > just using the wrong engine for an HD platformer? Say, are you using per-pixel transparency? I know for a fact that it slows pygame down a lot, so if you don't need intermediate tranlucency (eg, fading) you could use colorkeys. I know that per-pixel alphas are slow, because I ran a test at 1920x1080 and adding a fifth surface with per-pixel alpha dropped frames from ~ 30 to ~8 per second. Using colorkeys gave me 200 fps w/ pygame.RLEACCEL. Adding one surface w/ transparency dropped it to 60fps. I can send the code if you wish. I do have a higher-end system, so opengl will probably be a good idea. I'd suggest looking into PyGL3Display, which works for me although I have just started to try it out. I hope I have been helpful to your efforts.
