GP32X.com - GP32 GP2X Pandora The Wiz - open source entertainment: Bouncing Bubbles - Final Questions ;) - GP32X.com - GP32 GP2X Pandora The Wiz - open source entertainment

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Bouncing Bubbles - Final Questions ;)

#1 User is offline   0-bake

  • Mega GP Mania
  • PipPipPipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 536
  • Joined: 15-December 03

Posted 10 December 2005 - 11:42 AM

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)

Posted Image
Posted Image

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:

#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.

#2 User is offline   kissbengt

  • GP32 User
  • PipPipPip
  • Group: Members
  • Posts: 53
  • Joined: 29-October 03
  • Location:Karlshamn, Sweden

Posted 10 December 2005 - 03:46 PM

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.

#3 User is offline   0-bake

  • Mega GP Mania
  • PipPipPipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 536
  • Joined: 15-December 03

Posted 11 December 2005 - 08:03 PM

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.

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);
  }
}


#4 User is offline   Dryer Lint

  • GP32 Hardcore
  • PipPipPipPip
  • Group: Members
  • Posts: 143
  • Joined: 15-May 05

Post icon  Posted 11 December 2005 - 10:07 PM

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

#5 User is offline   0-bake

  • Mega GP Mania
  • PipPipPipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 536
  • Joined: 15-December 03

Posted 11 December 2005 - 11:39 PM

Dryer Lint, on Dec 11 2005, 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
View Post


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.

#6 User is offline   Dryer Lint

  • GP32 Hardcore
  • PipPipPipPip
  • Group: Members
  • Posts: 143
  • Joined: 15-May 05

Posted 14 December 2005 - 07:42 PM

0-bake, on Dec 12 2005, 01:39 AM, said:

Dryer Lint, on Dec 11 2005, 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
View Post


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.
View Post


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!

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic