[SDL] quick 2D paralax scrolling

Mattias Engdegård f91-men at nada.kth.se
Tue Apr 25 13:10:52 PDT 2000

>I've got some myself, but their performance leaves quite a bit to be
>desired.... Specifically, I keep the various background layers (or looping
>layers) in surfaces which I blit onto the screen surface (using
>SDL_BlitSurface or the lower blit function) whenever the screen
>moves. Then I (of course) blit the foreground graphics. I've used various
>combinations of UpdateRect and UpdateRects, but can seem to increase

If you are drawing to a software surface (for example, in X11 without DGA),
then it might pay off to undraw the overlays and sprites, if the background
stays put. That way you don't have to paint the entire buffer each frame.
It could be doable on hardware surfaces as well (with page flipping) but
then you want to minimize the slow reading from the buffer.

> (I'm basically trying to get performance similar to those old
>16-bit cart games for SNES/Genesis... and I have a 300 MHz AMD-K6 w/ 128
>Megs RAM and an 8 Meg graphic card, so I hoped that I could...)

Don't be so sure. Those machines have dedicated multi-layer tile-based video
circuits that can do a lot of this in relatively simple hardware, while you
have to waste a huge amount of cycles each frame to do it.

What kind of game are you doing, BTW? Is it a space shooter? Please please...

More information about the SDL mailing list