Mail Archives: djgpp/1999/03/02/01:22:02
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 -