www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/05/06:03:21

From: <freddiem AT gem DOT co DOT za>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Speed with Allegro
Date: Mon, 5 Jan 1998 12:43:51 +0200
Organization: Ye 'Ol Disorganized NNTPCache groupie
Lines: 41
Message-ID: <883997577.487498@air.adept.co.za>
References: <68p4ib$cr8$1 AT towncrier DOT cc DOT monash DOT edu DOT au>
NNTP-Posting-Host: air.adept.co.za
Cache-Post-Path: air.adept.co.za!unknown AT cybersonic DOT co DOT za
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Robert Clayton wrote in message <68p4ib$cr8$1 AT towncrier DOT cc DOT monash DOT edu DOT au>...
>Okay, my problem is this-
>I can make some sprites dance around the screen, and I have a little
>space ship that the player controls.  That's all fine and dandy, the
>problem is that I can't get it to run fast enough.  I can smoothly
>scroll the ships, etc.  I don't know why.
>It's not my machine, a P166.  I'm using Allegro, drawing the sprites
>onto a bitmap which I then show, using the double buffering technique.
>Any help?

Ok here's a checklist :
1. What resolution are you running? If its above 640x480 lower it!. Also try
using vesa2.0 linear frame buffering mode for hi res modes. Its the fastest
you are going to get.
2. I also suspect that your code is doing something unnecessary somewhere.
Don't sync with vertical retraces, that slows down performance drastically.
3. Don't try to display 200+ sprites at once, though I think you know better
than to do this.
4. Don't run in 15, 16, 24 or 32 bit truecolor modes because thats frame
rate suicide!
5. If this doesn't help then its probably a problem with some calculating
routine somewhere. Maybe some intensive maths routine, plenty sqrt's or
something. Try using fixed point routines as much as possible.
6. Maybe your definition of "fast enough" is unusual. 40-50 fps is a really
good frame rate to get. And its not a problem with allegro. I'm running a
640x480 256 color tilemap fullscreen on a p150 and I get 40-50 fps.
7. Your code should be something like this :
<initialize allegro and all that stuff>
buffer=createbitmap(640,480);
clear(buffer);
do
{
clear(buffer); // if you are going to draw over the whole screen anyway
remove this.
<calculate stuff>
draw_sprite(buffer,sprite,x,y); // and all other stuff
blit(sprite,buffer,0,0,0,0,640,480); // don't use draw_sprite for this!
} while (!key[key_esc]);


- Raw text -


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