Framerate issues

Hi all, I’m sure this has been addressed before and it might sound like
a newbie-ish question but I guess that’s what this list is for :slight_smile:

I’m writing a tile-based 2D top-down shooter. In fact, I’m writing a
Linux client for a Windows game (without the original source, of
course…) Now the problem is that I need to refresh the whole screen
on every frame. This really kills the framerate but there’s no way
around it since there’s a lot of scrolling and all that kind of stuff.

I created the display surface with the flags SDL_HWSURFACE |
SDL_DOUBLEBUF | SDL_ANYFORMAT and all the other surfaces have
SDL_HWSURFACE set and use the same display format as the display
surface. Also, I’m using the suggested color depth returned by
SDL_VideoModeOK(…). With all of this, I’m getting around 40 frames
per second on my NVidia GeForce2 MX 400 at 800x600:16.

So then instead of using the X11 target, I tried SVGALib and that just
doens’t work (doesn’t like my mouse and doesn’t register keystrokes).
So I recompiled SDL and SVGALib and I still got the same problem. I
tried using dga (yes, I have dga enabled in my XF86Config file) but
apparently no surface could be created.

I am using SDL 1.2.3 on Slack 8, X4 and AMD Athlon 1.1 w/ GeForce 2 MX
400 (NVidia drivers). Any suggestions? Thanks in advance.

Cheers,
Snrrrub__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

Sharvil Nanavati wrote:

I’m writing a tile-based 2D top-down shooter. In fact, I’m writing a
Linux client for a Windows game (without the original source, of
course…) Now the problem is that I need to refresh the whole screen
on every frame. This really kills the framerate but there’s no way
around it since there’s a lot of scrolling and all that kind of stuff.

… With all of this, I’m getting around 40 frames
per second on my NVidia GeForce2 MX 400 at 800x600:16.

using non hardware accelerated surfaces, this is the framerate i’d
expect from SDL with fullscreen redraws. still, 40fps should be plenty
for your game?

using directx under windows with hardware accelerated blits, the
framerate will be much higher. i expect using DGA under linux should
also get you a considerable boost. but at this point i believe DGA
should be an “option” and not a “requirement” :]

So then instead of using the X11 target, I tried SVGALib and that just
doens’t work (doesn’t like my mouse and doesn’t register keystrokes).
So I recompiled SDL and SVGALib and I still got the same problem. I
tried using dga (yes, I have dga enabled in my XF86Config file) but
apparently no surface could be created.

Are you running it as root when using DGA? Do the test programs work?
Have you tried using the framebuffer console?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sharvil Nanavati wrote:

I’m writing a tile-based 2D top-down shooter. In fact, I’m writing a
Linux client for a Windows game (without the original source, of
course…) Now the problem is that I need to refresh the whole screen
on every frame. This really kills the framerate but there’s no way
around it since there’s a lot of scrolling and all that kind of
stuff.

… With all of this, I’m getting around 40 frames
per second on my NVidia GeForce2 MX 400 at 800x600:16.

using non hardware accelerated surfaces, this is the framerate i’d
expect from SDL with fullscreen redraws. still, 40fps should be plenty
for your game?

IMHO, full frame rate (ie frame rate == CRT refresh rate) is the only
way to go for smooth animation - but that’s just me being picky, and used
to old monster machines like the… uhm, C64. :wink:

Seriously, retrace-locked full frame rate animation still seems to be out
of reach with many OS/driver combos, but 60 fps looks pretty good in most
cases, IMO. Anything below 50 fps starts to make everything look
seriously blurred to me.

using directx under windows with hardware accelerated blits, the
framerate will be much higher. i expect using DGA under linux should
also get you a considerable boost. but at this point i believe DGA
should be an “option” and not a “requirement” :]

Or; “Accelerated 2D is still cutting edge high end stuff, so we’d better
use good old OpenGL with h/w acceleration for all serious 2D animation
for now.”

The only “2D” solution I’ve had any real luck with is 2D-on-OpenGL, so
this is indeed the way it looks to me… Doesn’t require
weird/dangerous/non-standard configurations or drivers. Doesn’t even
require root privileges, and still beats the sh*t out of DGA2 - and
that’s not counting the bonus blending and transformation capabilities.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Monday 26 November 2001 19:11, Pete Shinners wrote: