[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Fast Scrolling

I rewrote the draw function to cache some data, and
then make one call to blit:


This speeds it up on my box to about 55 fps from 47
fps.  When moved though the frame rate drops a bit
more than it normally does(not by much more).

Of course if the mouse position is moved lots, heaps
of memory can be used in the cache.  Then if it swaps
the frame rate will drop lots!

This shows a couple of things.  
1) it can be sped up with a c draw loop.
2) if the game doesn't move much more optimizations
can be done.
3) different draw loops depending on movement are

You could use dirty rects for games where the
background doesn't move much and there are not many
moving sprites( some platformers ).

Other optimizations could be made for games which only
scroll in one direction.

Of course if you use opengl everything can go 600 fps

what else can make it faster?

 --- Pete Shinners <pete@shinners.org> wrote: > Damien
Miller wrote:
> > Can anyone point me to a good example of a fast
> scrolling background
> > (full-screen or nearly full-screen)?
> i wrote a pretty cool and fast scrolling tile engine
> for my 48 hour 
> game. unfortunately i never got to creating an
> actual map to scroll 
> around. here is a small cleaned up version of the
> scrolling code.

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts