GP32 Bouncing Bubbles - Final Questions ;)


0-bake

Active Member
Joined
Dec 15, 2003
Messages
538
hi,

a few months ago i started making a game (the idea is from an old atari st monochrome game). some of you may remember my various questions in #gp32dev ;)

after a few months break, i continued working on it and it is now very close to be finished.

but i have a few last questions about putting sprites and clockspeed.
i attached two screenshots, the title-screen (running level 40 as a demo in background + title-sprite,pressstart-sprite,info_credits-sprite) and the normal level 40 ingame screenshot.
(the game is about: you control the ship, can move left/right and shoot and you have to shoot all enemies, which are bouncing and flying around)

titlescreenie13fe.gif

ingamescreenie11ah.gif


the problem is that these big sprites on the title screen are slowing down the program appr. 50%
the game is running at 90MHz and i'm using mr.mirko's sdk replacement.


basically (without my stuff) it looks like this:

Code:
#include "gp32.h"
#include "backgrnd_bin.h"

u16 *framebuffer[2];
int swapper=0;

void swap_screen()
{
 gp_setFramebuffer(framebuffer[swapper],1);
 swapper++; if (swapper == 2) swapper=0;
}

int main()
{
 int refreshrate=0;
 refreshrate=gp_initFramebuffer(framebuffer[0],16,85);
 while (1)
 {
  swap_screen();
  memcpy(framebuffer[swapper],backgrnd_bin,320*240*2);
 }
}

and i'm using gp_drawSpriteHT for putting sprites.

so is it normal, that these 3 big sprites (actually they are that big) can slow the program down that hard?
i mean, whole emulators run at 90MHz and i'm just drawing a few sprites.
 
the blitting routines in mirkos sdk are very slow, try to use memcpy whenever possible. a number of faster replacements have also been made iirc correctly some of these actually come with the sdk.
 
hm, where can i find faster PutSprite routines? can you give me a link, please?
and where is the use of memcpy possible?

right now, i'm using a slightly modified version of Mr.Mirkos gp_drawSpriteHT (almost the same, but i cut out the sprites from one big bitmap file. makes it easier to modify).

every pixel in the sprite is checked for transparency and then set to the framebuffer.

Code:
void setpixel(int x, int y, u16 color, u16 *framebuffer ) {
     if ( !((x<0) || (x>319) || (y<0) || (y>239)) )
       gp_drawPixel16(x,y,color,framebuffer);
}

void SetSprite(tSprite *sprite,u16 *source_img,u16 trans,int source_x,int source_y,int width,int height)
{
 sprite->width=width;
 sprite->height=height;
 sprite->trans=trans;
 sprite->data=(u16*)malloc((height*width)*sizeof(u16));
 int y,x,i=0;
 for (y=source_y;y<height+source_y;y++)
  for (x=source_x;x<width+source_x;x++) 
  {
    sprite->data[i++]=source_img[6+x+(y*320)];
  }
}

void PutSprite(tSprite *sprite,int put_x,int put_y,u16 *framebuffer)
{
 int xx,yy,i=0;
 u16 color;
 for (yy=0; yy<(sprite->height); yy++)
  for (xx=0; xx<(sprite->width); xx++) 
  {
   color=sprite->data[i++];
   if (color != sprite->trans) setpixel(put_x+xx,put_y+yy,color,framebuffer);
  }
}
 
I can't help you with your programming problem, but OMG! I own this game! It's somewhere down in the cellar along with my Atari STF 1040.

This is amazing, I can't wait to play this game on my lovely GP32. :-D
 
Dryer Lint posted on Dec 11 2005 at 10:07 PM said:
I can't help you with your programming problem, but OMG! I own this game! It's somewhere down in the cellar along with my Atari STF 1040.

This is amazing, I can't wait to play this game on my lovely GP32. :-D

wow, great to hear that :)
the game is more or less finished, there is "just" some graphic work left, like the background and "ready for next level screen" and so on. - any ideas?
ah, and the sound for the shot and the explosion ist missing, but that shouldn't be too hard.
 
Last edited by a moderator:
0-bake posted on Dec 12 2005 at 01:39 AM said:
Dryer Lint posted on Dec 11 2005 at 10:07 PM said:
I can't help you with your programming problem, but OMG! I own this game! It's somewhere down in the cellar along with my Atari STF 1040.

This is amazing, I can't wait to play this game on my lovely GP32. :-D

wow, great to hear that :)
the game is more or less finished, there is "just" some graphic work left, like the background and "ready for next level screen" and so on. - any ideas?
ah, and the sound for the shot and the explosion ist missing, but that shouldn't be too hard.

I think you should use the original Atari GEM/TOS system font for everything, that would be nifty. (I searched for a TTF-font for quite some time now but found nothing. Although SF Atarian looks almost like the real thing, but it's CAPS-only. :-/ )
And sound is absolutely essential!
 
Last edited by a moderator:
Back
Top