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

[pygame] sprite engine



Hi

yes I know well, that we have dirty rects already and I use them in my sprite engine :-) .

In many games and applications only a few sprites change in a frame. The pygame.sprite module does not take account to that and clears and redraws all sprites, regadles if they need a update. Ok, one could do this by hand. So I decided to write a sprite module to have it simple like with the old pygame.sprite but that the dirty update should happen automatically. Because of that my sprite engine is only faster if not all sprites are dirty ( in fact, it is a little bit slower, 5 fps by 500 sprites of 32x32pixels). I want to write it in a matter that one should not have to change many things so one still can use the pygame.sprite.group for sprite handling (except clear() and draw() ). My sprite engine also supports layers (or z order) of sprites which had to be done by groups otherwise.

So if you write a game or application in there all is moving then the old pygame.sprite is better joice or perhaps event using flip(). But, as I said, many games do not need to repaint all sprite each frame and then my sprite engine is faster.

Sorry for my english and I hope you understand what I try to say.

~DR0ID

andrew baker schrieb:
No disrespect, but we already have DirtyRects. Were you aware of that? Or do your sprites do something different?

--
Andrew Ulysses Baker
"failrate"