Where's your framerate gone?

Hello

I’m using SDL for the first time and having difficulty getting decent framerates out of it. Mainly due to confusion on my part. My machine spec is…
P4 2Gig
256 DDR ram
GeForce 4 Ti-4600
some soundcard or another and a harddrive. blah blah blah

First of all I tried the software surfaces as it would be quite nice to do some alpha. So I created my main surface like thus…

mainGlobs.screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

When I’ve created my surface for the images I do…

testImage = SDL_DisplayFormat( testImage );

Now when I run this I average around 40-50fps in window and fullscreen if I draw one big image for the background and 20-30 32x32 colourkeyed images for the foreground. As I up foreground tile count I lose framerate dropping to 25-30 fps for draw 50 32x32 images.

I also get a tearing as it’s not double buffered. I also get about the same fps if I use HW. I just can’t seem to get it to go flat out. At best it runs like 55 fps. That’s just drawing one 640x480 image.

Any suggestions? Or a checklist on how to ensure I’m getting a decent framerate.

Also, is there way to turn vsync off? I know there’s no use having it go faster than your refresh rate but I’d like to check so I can see the performance I’m getting.

Thanks

Scott

There are many things you could do to speed up the game,

Do you really really really need to use 32 bit color? If not, use 16 bit.

Don’t redraw the background all the time. This takes longer than you would
expect and it will eventually slow your app to a crawl when you add more
features (eg - artificial intelligence, collision detection, etc). A
technique I used in Starfighter was to draw the background once and then
simply replace the areas of the background that had been overdrawn in the
previous frame. This will greatly increase the speed.

Hmmm… maybe I’ll add this to my tutorials list…

cheers,

Steve :)> -----Original Message-----

From: Scott Newby [SMTP:waheyluggage at blueyonder.co.uk]
Sent: Tuesday, June 03, 2003 5:49 PM
To: sdl at libsdl.org
Subject: [SDL] Where’s your framerate gone?

Hello

I’m using SDL for the first time and having difficulty getting decent
framerates out of it. Mainly due to confusion on my part. My machine
spec is…
P4 2Gig
256 DDR ram
GeForce 4 Ti-4600
some soundcard or another and a harddrive. blah blah blah

First of all I tried the software surfaces as it would be quite nice to do
some alpha. So I created my main surface like thus…

mainGlobs.screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

When I’ve created my surface for the images I do…

testImage = SDL_DisplayFormat( testImage );

Now when I run this I average around 40-50fps in window and fullscreen if
I draw one big image for the background and 20-30 32x32 colourkeyed images
for the foreground. As I up foreground tile count I lose framerate
dropping to 25-30 fps for draw 50 32x32 images.

I also get a tearing as it’s not double buffered. I also get about the
same fps if I use HW. I just can’t seem to get it to go flat out. At
best it runs like 55 fps. That’s just drawing one 640x480 image.

Any suggestions? Or a checklist on how to ensure I’m getting a decent
framerate.

Also, is there way to turn vsync off? I know there’s no use having it go
faster than your refresh rate but I’d like to check so I can see the
performance I’m getting.

Thanks

Scott

.sophos.3.69.06.02.

Sweeney you have a SDL Tutorials site?

if yes tell me the URL :smiley:

                       Eduardo Garcia Rajo (h)------------------------------------------------------------------

Visite: http://www.solucion-digital.com.ar
SOLUCION DIGITAL
Redes - Software - Servicios

----- Original Message -----
From: sweenes@fnb.co.uk (Steven Sweeney))
To:
Sent: Wednesday, June 04, 2003 6:28 AM
Subject: RE: [SDL] Where’s your framerate gone?