I'm working on a 2d sidescroller in PyGame. For each map we use one texture (this is the actual size of the texture):
Then we load the image with this code:
sprite = pygame.image.load("Maps/MapTesting.png") sprite.convert() sprite = pygame.transform.scale(sprite, (sprite.get_width()*6, sprite.get_height()*6))
As you can see, the texture gets blown up 6 times to create the actual map texture. On average this texture is about 4500x800. This texture has to be blitted to the screen every frame, because the whole screen is dirty (thanks to the side scrolling). We do that using this code:
screen.blit(sprite, (0, 0), (cameraposx, cameraposy, windowheight, windowwidth))
And it works. The problem is is that it's quite slow: I get a meager 40 FPS on a low-decent PC, and that's without any of the actual AI/objects going on, while we're aiming for 60 FPS. How can we speed this up?
Note that the above code is sanitized and taken out of context. The full code can be found here: https://github.com/nightcracker/PyGG2
And last but not least, while the above image might look like 8-bit, there are elements in the game which require more bit-depth.