[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame slow on linux (ubuntu)



There is a tutorial on using RenderUpdates here (scroll down to the
RenderUpdates part):
http://kai.vm.bytemark.co.uk/~piman/writing/sprite-tutorial.shtml

Yes, you use the RenderUpdates as a group.


Also... instead of calling pygame.display.flip() call pygame.display.update(list_of_dirty_rects)



On 6/13/06, spotter . <talonspotter@xxxxxxxxx> wrote:
I have to try and profile the code in the coming days, thanks for the
link. The images are converted (i just added that part). As for
rendering the sprites, I am a little cofused..
my code looks like this :
enemies = pygame.sprite.Group()
then ..enemies.update(salt,pixels)

for RenderUpdates, would i use enemies = pygame.sprite.RenderUpdates() ?
and to update it I would use enemies.draw(salt,pixels) ? Also, if that
is correct, would I have to change the update method to be called
draw() ?

Kamilche, is your game now written in pygame? If so, 400 fps is pretty
good...lots of optimization, i guess..

Thanks..s.



On 6/13/06, Kamilche <klachemin@xxxxxxxxxxx> wrote:
> Rene Dudfield wrote:
> > Try profiling your game to see where/if it can be sped up.
> > http://www.pygame.org/wiki/Profiling
> >
> > Do you use dirty rects using sprite.RenderUpdates?  Do you convert()
> > your images?
> >
> >
>
> Yeah, you can't get away without doing optimizations, even in C. I know,
> I wrote a C engine before I switched to Python!
>
> I'm doing full screen, 32-bit color in a 1024x768 window with an alpha
> channel on every graphic... and I'm sitting at about 14,000 fps. That
> number is misleading because if the screen were fully loaded with
> something moving every frame, it would drop to 400 fps or so... but the
> trick is to not fully load it. You HAVE to put a throttle on your
> graphics, to get any kind of speed out of it.
>
> --Kamilche
>