Stable framerate

i’m currently working an a port of an old horizontal scrolling
space-shoter game. it already scrolls but this is very unsmooth. i have
included the code provided on the sdl-homepage (doc -> exmaples ->
timer) but it does not help much. is there another way to do this?
AFAICS, SDL_DOUBLEBUFFER only works with hardware support and this is
only available for root. :frowning: btw, i’m talking about linux as my main
target.

thanx …
clemens

i’m currently working an a port of an old horizontal scrolling
space-shoter game. it already scrolls but this is very unsmooth. i have
included the code provided on the sdl-homepage (doc -> exmaples ->
timer) but it does not help much.

As expected. Correct translation of frame time into “logic time” is only half a solution. You also need raw speed (ie sufficient frame rate), and preferably, some way of keeping track of the video timing.

is there another way to do this?

Not really, but there are (at least in theory) ways of solving the whole problem; not just the most important part.

AFAICS, SDL_DOUBLEBUFFER only works with hardware support and this is
only available for root. :frowning: btw, i’m talking about linux as my main
target.

…and even if you are root and get h/w pageflipping with DGA, you still have two major problems:

1) No retrace synchronization.
2) Slow rendering.

There isn’t much you can do about 1), short of trying to motivate me or someone else to implement a clean retrace sync “framework” for Linux sooner. (I have plans, ideas and even some prototype code, but not enough time. Better one active project than lots of “sleeping” projects…)

As for 2) (which is only an issue if you want higher resolutions than 320x240), the most reliable, and also most portable solution is OpenGL. While you’ll find very few Linux systems that can accelerate any of SDL’s blitting calls, accelerated OpenGL is pretty common these days. OpenGL is excellent for 2D rendering, and gives you a lot of possibilities you could only dream of with software rendering.

Anyway, I’ve lost count… This is a VFAQ, and you’ll find tons of links, ideas and general discussion on this topic in the list archive.

//David

.---------------------------------------
| David Olofson
| Programmer

david.olofson at reologica.se
Address:
REOLOGICA Instruments AB
Scheelev?gen 30
223 63 LUND
Sweden
---------------------------------------
Phone: 046-12 77 60
Fax: 046-12 50 57
Mobil:
E-mail: david.olofson at reologica.se
WWW: http://www.reologica.se

`-----> We Make Rheology RealOn Fri, 28/06/2002 21:51:27 , Clemens Kirchgatterer wrote:

I’ll buy you a beer.On Fri, Jun 28, 2002 at 10:42:35PM +0200, David Olofson wrote:

There isn’t much you can do about 1), short of trying to motivate me or
someone else to implement a clean retrace sync “framework” for Linux
sooner. (I have plans, ideas and even some prototype code, but not enough
time. Better one active project than lots of “sleeping” projects…)


Matthew Miller @Matthew_Miller http://www.mattdm.org/
Boston University Linux ------> http://linux.bu.edu/

Well, I’ll think about it! :slight_smile:

//David

.---------------------------------------
| David Olofson
| Programmer

david.olofson at reologica.se
Address:
REOLOGICA Instruments AB
Scheelev?gen 30
223 63 LUND
Sweden
---------------------------------------
Phone: 046-12 77 60
Fax: 046-12 50 57
Mobil:
E-mail: david.olofson at reologica.se
WWW: http://www.reologica.se

`-----> We Make Rheology RealOn Fri, 28/06/2002 17:04:29 , Matthew Miller wrote:

On Fri, Jun 28, 2002 at 10:42:35PM +0200, David Olofson wrote:

There isn’t much you can do about 1), short of trying to motivate me or
someone else to implement a clean retrace sync “framework” for Linux
sooner. (I have plans, ideas and even some prototype code, but not enough
time. Better one active project than lots of “sleeping” projects…)

I’ll buy you a beer.