delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/02/01:22:02

From: "Smurf HQ" <Christopher DOT Wise AT eng DOT monash DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is Allegro too slow for 648 * 480 double buffering ?
Date: 2 Mar 1999 04:40:34 GMT
Organization: Materials Engineering, Monash
Lines: 42
Distribution: world
Message-ID: <01be6466$cf3a5160$cf86c282@mat-smurf.eng.monash.edu.au>
References: <36d9629e DOT 17499764 AT 158 DOT 152 DOT 254 DOT 68>
NNTP-Posting-Host: mat-wise.eng.monash.edu.au
X-Trace: towncrier.cc.monash.edu.au 920349634 11683 130.194.134.207 (2 Mar 1999 04:40:34 GMT)
X-Complaints-To: abuse AT monash DOT edu DOT au
NNTP-Posting-Date: 2 Mar 1999 04:40:34 GMT
X-Newsreader: Microsoft Internet News 4.70.1161
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Kevin <krugman AT nospam DOT demon DOT co DOT uk> wrote in article
<36d9629e DOT 17499764 AT 158 DOT 152 DOT 254 DOT 68>...
> Hi all,
> I'm trying to do a spritey double buffered game and would like ideally
> to do this at 640 * 480 * 8bpp. (Well I realy wanted 800 * 600, No
> chance)
> But the prrogram I have written to test the feasability of this idea
> seems to indicate that Allegro would be too slow for this.
> 
> The following listing just doesn't finish switching and clearing the 
> buffers quickly enough, are my conclusions about Allegro correct, or 
> am I doing something wrong or missing something really important?

As Robin Burrows says, you should remove the clear(screen); it is the
biggest slowdown and completely unnecessary.
Removing the clear(buffer); (for example by using 'dirty rectangles' will
have a much less lesser effect because on modern computers
writing to system memory is much faster than writing to video memory.
A couple of years ago I was doing the same thing myself.
I made a frame rate counter and did a little experimenting.
I suggest you do the same. Simply increment a counter each time
you draw a frame. Set up a timer (see the relevent allegro example) with a
one second resolutionand store the number of frames you have drawn in the
previous second to another variable which you then print to the buffer (you
have to print it every frame, so you have time to read it).
Once you have the frame rate, you can experiment.
 For example try removing the drawing code and see how that affects the
frame rate. My guess is hardly at all, because it is so simple.
This may change once you write a game.

Also you could remove the clear(buffer); line. The screen would look like
crap, but the frame rate would show you the maximum improvement that you
would get from a 'dirty rectangle' implementation. Then you could decide
for yourself if it was worth it.

Most importantly, you should try your program on a number of different
machines to get a good idea of how the framerate varies with different
hardware. I found that I got very different framerates depending on the
hardare and also on whether the system had vesa 2.
That was a couple of years ago. On todays machines, you should have
no problem.
Chris

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019