Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pygame: Tiled Map or Large Image

Tags:

python

pygame

I am trying to decide if it is better to use a pre-rendered large image for a scrolling map game or to render the tiles individual on screen each frame. I have tried to program the game both ways and don't see any obvious difference in speed, but that might be due to my lack of experiences.

Besides for memory, is there a speed reasons to not use a pre-rendered map?

like image 880
i_4_got Avatar asked Dec 15 '10 15:12

i_4_got


2 Answers

The only reason I can think of for picking one over the other on modern hardware (anything as fast and with as much ram as, say, an iPhone), would be technical ones that make the game code itself easier to follow. There's not much performance wise to distinguish them.

One exception I can think of, is if you are using a truly massive background, and doing tile rendering in a GPU, tiles can be textures and you'll get a modest speed bump since you don't need to push much data between cpu and gpu per frame, and it'll use very little video ram.

like image 68
SingleNegationElimination Avatar answered Oct 06 '22 01:10

SingleNegationElimination


Memory and speed are closely related. If your tile set fits in video memory, but the pre-rendered map doesn't, speed will suffer.

like image 26
nmichaels Avatar answered Oct 05 '22 23:10

nmichaels