Using pygame, would it be more efficient to:
Is there any performance differences between the two? Would it take more draw calls to use the first method, versus individual Surfaces at startup (i.e. does doing this at startup store copies of those pixels in ram/vram)?
Thanks
It would be faster to blit the images into a surface, then blit those surfaces.
However it would consume more memory, since you'll need to keep those surfaces somewhere in memory.
Why?
When you go to blit the image from your spritesheet, you'll end up subsurfing/clipping the spritesheet surface, which will mean you'll need to generate another surface on the spot. However, this process won't take long.
The performance benefit most likely isn't worth it, so I'd recommend just go with whichever method you're most comfortable with. If you're concerned about performance, check out the builtin CProfile python module.
VRAM never comes into this equation. pygame.Surface is derived from SDL_Surface from the SDL library for the C programming language. SDL_Surface is primarily targeted toward software rendering, which means the surface pixels are stored in standard RAM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With