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

Re: [pygame] How much blit costs?



Hi. If you have 14996 sprites that are not visible, and do not need to be processed every frame, the greatest performance improvement you will get is by using a spatial hash instead of a flat container such as a sprite group, list, or dict.

Even if off-screen sprites need some processing near the edges of the screen a spatial hash will give you a big boost.


On 6/14/2017 4:39 PM, babaliaris wrote:
Hello.

I'm trying to create a game engine with the maximum possible game objects per scene.
These days, i'm trying to understand how much the blit method costs, so for this purpose i created a mini
game engine and impremented it to create a game which all it does is blitting 15000 images
on the screen (Actually six, because as you will see below, the other 14996 are off the screen).

So this is how my engine works:
Download the source code: Github Repository
Engine Structure
Game Result

As you can see, the game runs in 50-60 fps.
My processor is: AMD FX™ - 6350 Six Core 3.90 GHz. Can i do better?

View this message in context: How much blit costs?
Sent from the pygame-users mailing list archive at Nabble.com.