[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] Fast Scrolling
For those who were wondering about my adventures in the wonderful
land of DOUBLEBUF+FULLSCREEN, they might have understood that my
goal was to provide a fullscreen tiling engine.
I am nearly there (My head was ringing with a stupid bug at 2.00 am yesterday...),
until to arrive in the bed to realize where the mistake was... Will be going on
today after work.
I believe that my I have done will be significantly quicker that our master
shreadwheat own quick tile engine...
(and I like the [((x+1), (y+1), (x-1)*tilew, (y-1)*tileh+2)
for y in range(480/tileh+2) for x in range(640/tilew+2)]) :)
(and will use it in my own full redraw routine!)
How I do it?
First I prepare the first render of the tile-world in an offscreen buffer.
Then at every movement, I update the camera view by simply copying the offscreen
buffer from a specific offset.
If the camera moves too far apart (more than one tile up(or down or left or right)),
I then shift up (or...) the offscreen buffer and proceed with filling up the now
empty rows/columns with my tiles.
At everyframe, all in all i just do:
- one accelerated giant blit!
Every 8 frames (tilesize=64, speed=8), I copy between 10 and 20 frames
(in a 640x640 sized map)...
A 800x600 double buffer fullscreen tiled map that can move without hiccup at
60 fps in 8 bit on an AMD-K500 (I nearly forgot to add.... OH! and on top of
that I have 20 64x64 bobs moving for stress testing!).
I intend to offer this to the PCR when it is finished and cleaned up...
if you want I can send the "half buggy" version to anybody who ask on that
pygame mailing list