[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] aargh, performance

Rob wrote:

> But I have something to ask you pygame wizards. I'm working on a
> platform game it runs ok now on my dual pentium2 350mhz, on 640x480,
> I didn't attach it, because it' already quite big with graphics. But
> anyway I fear when the game is developping, the performance is going
> to be awful and it will take up way to much memory.
> I was thinking about using a 320x200 resolution, but my windows
> machine doesn't allow pygame to run 320x200 fullscreen. I thought it
> might be a good idea to blit everything on a 320x200 surface, and
> then scaling that one up to the 640x480 display. My question is, will
> I see a performance when I do this ? or will the scaling slow the
> process down so it will not make a big difference ?

instead of going all the way down to 320x200, you could run the game at 
640x480, but keep a status bar or something at the bottom. chopping 100 
pixels off the screen will definitely run a few fps quicker. although at 
this point if it runs good on your 350mhz, that might be reasonable 
enough for all users? scaling the image up will probably be slower than 
just running natively at 640x480. your game is being limited by SDLs 
speed of drawing to the screen. if you scale or not, it still has to 
fill the whole screen with an image.

> also I would like to ask, if anyone has any tips on building some
> kind of timer to see what is the actual framerate of the game
> running. Right now it's kinda hard to see any performance changes
> when i change something in the game.

the pygame.time module has a "Clock" object you can use. create a new 
clock object, then every frame of your game call "myclock.tick()". when 
the game is running you can call "myclock.get_fps()" and you will get 
the running framerate. the clock can also track the number of 
milliseconds between the current tick() and the previous one. it can 
also do "framerate limiting" to keep your game from running too fast on 
quick hardware.

pygame mailing list