Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / speed issues

Author
Message
MrSparkle
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 7th Dec 2003 04:02
i'm making a side-scrolling shooter game (kinda like a side-scrolling version of "raptor: call of the shadows"). the setting is in space, and as a result i need stars. the stars are single-pixel sprites, and I would estimate that there are about 30 of them on screen at one time.

then there are some random enemy ships that come and shoot at you.

my problem is this: the program gradually, but substantially, slows down. i'm assuming it's something to do with the number of sprites. one of my friends suggested that i delete any off-screen sprites that i'm not going to use anymore. i tried that but it didn't help.

i do have a counter that keeps track of how many sprites have been created. however, it doesn't have to increase to much more than, say, 250, for it to start slowing down.

in addition i have some 54 images to be used for sprites. these are all loaded at once. somehow, though, i dont think the number of images is causing it to slow more and more as time progresses.

thanks for investigating my problem!

Old school is awesome - music, games, etc...
Sync
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hungary
Posted: 7th Dec 2003 16:00
It's unnecessary to delete the off-screen sprites.
Turn the backdrop on, and use the set sprite num,0,1 command after sprite creating. (and use the sync on ... sync also)

386SX, 2MB EDO RAM, 512kB VESA video card, 40MB HDD, 5,25 FDD
nesztek angolok, örüljetek
Sync
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hungary
Posted: 7th Dec 2003 16:04
(i see just now Pincho wrote it in the backsave help topic)

386SX, 2MB EDO RAM, 512kB VESA video card, 40MB HDD, 5,25 FDD
nesztek angolok, örüljetek
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 7th Dec 2003 23:15
If its a side scroller do you really need all the stars as seperate objects? Surely you could put all of the stars on one object. Scroll the camera instead of the stars, and if it's 2D then put the stars on a bitmap instead.

Pincho.
justinHeintz
20
Years of Service
User Offline
Joined: 5th Dec 2003
Location: my house
Posted: 8th Dec 2003 23:48
but how do you move a bitmap ? if he dosnt do that it wont look good

Justin Heintz
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Dec 2003 00:07
You use Copy Bitmap to scroll a bitmap. You offset the copy X/Y.
MrSparkle
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 9th Dec 2003 03:06
thank you all!

Old school is awesome - music, games, etc...
las6
21
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 10th Dec 2003 09:44
I used 3d, so I solved the problem by creating layers of plains, textured with transparent star images (each different, btw). Now I offsetted the texture uv instead of the objects, and rather than moving the objects or my ship, I scroll the textures. You can't really tell the difference. Plus you don't have to worry about the edges.

I'm quite sure this is possible to do with sprites too.

and One thing. I think you are creating too many sprites there..(Even though I had no problems running 500 sprites last time I tried)
So are you really creating new sprite each time old one dies?
Also, don't try deleting the old stuff, reuse it. When it goes offscreen, just reposition it so that it will come back to the screen when you move.

Keyboard not detected. Press F1 to continue.

Login to post a reply

Server time is: 2024-05-02 14:32:53
Your offset time is: 2024-05-02 14:32:53