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.

DarkBASIC Professional Discussion / Galaga Background

Author
Message
MasterInsan0
22
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 13th Jan 2004 03:45
I'm not entirely sure if this question is worthy of the "big kid's board", but I'll ask anyway. I've been having trouble getting a Galaga-style background to work in my remake. I can get the background to randomly place dots of a random color, but it's WAY too fast, and if I implement a timer to slow the rate down at which is redraws the stars, it looks really bad (choppy).

What I think I need is a way to only refresh some of the "stars" and leave the others. However, I really cannot figure it out. I figure if they did it in the original Galaga then it's probably possible in DBPro (not necessarily, but probably). Any ideas?

My friends' and my website for programming:
http://unseenstudios.dbpcommunity.com
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 13th Jan 2004 04:03 Edited at: 13th Jan 2004 04:04
maybe only update the stars certain passes thru your main loop, so as not to affect the speed of the rest of the game. maybe keep a counter variable that you check with MOD each pass, but only update starts every so often on the zero return. Then, reset that variable so it eventually doesn't blow up by growing too large


just an idea

-RUST-

MasterInsan0
22
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 13th Jan 2004 04:09 Edited at: 13th Jan 2004 04:09
Well, I tried that in a way, but what I keep ending up doing is drawing all of the stars at once. What I need to do is at first, draw all of my stars. Then, later on as the game loops, I need to make some of the stars disappear and some new ones appear, but some need to stay unchanged, at least for a second or so.

Without positioning every single dot manually and then simply randomly choosing which ones to draw and which ones not to draw, I can't see a way to pull this off. But then again I'm not a master like some of the people on this board.

I now worship Galaga more than ever...

My friends' and my website for programming:
http://unseenstudios.dbpcommunity.com
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 13th Jan 2004 04:22
Well, you could use one large image to show the stationary stars and an array to hold all the sprite data for the moving stars. When a sprite moves off the bottom of the screen, you reset the values back to the top and give it a new set of random values for location and movement.
--
TAZ

MasterInsan0
22
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 13th Jan 2004 04:33 Edited at: 13th Jan 2004 04:33
Zircher, that would work if I were using a moving background, but since I'm trying to emulate the original Galaga as much as possible, I would really rather just have the original background. The only time the screen really scrolls is when your plane is captured, and if I can get the normal background to work, this should be easy.

For those that haven't played Galaga, go here for a glimpse of the Greatness. It's not too great of an image, but since emulation is looked down on by most I'm not going to give a direct link to a ROM or something. Anyway, go here to see Galaga in action, and what I'm trying to recreate:

http://web.utanet.at/nkehrer/ONE_Play.html

(OK, well, it seems that the NES version of Galaga DID have scrolling stars, but the Arcade version did not. Other than that and the sound, it is a faithful port.)

My friends' and my website for programming:
http://unseenstudios.dbpcommunity.com
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 13th Jan 2004 07:16
Here's some interesting Galaga info.

http://www.klov.com/G/Galaga.html

I still think that a horde of little sprites would do the trick and you could just use a flat black background.

I might have to play with that later. If you want, feel free to post the background starfield part of your code and I'll see if there is anything I can do to fix the choppiness.
--
TAZ

MasterInsan0
22
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 14th Jan 2004 01:11
Well I'll be...the background DID scroll in Galaga, but it also blinked and was random. Ouch. This is starting to seem harder and harder to code. The only time it didn't scroll is at the beginning of a stage.

The colors are also random, but they don't change after blinking.

Alright, I'm desperate now. Please explain to me how this "horde of tiny sprites" thing works. I'm not quite understanding.

Any help would be much appreciated.

My friends' and my website for programming:
http://unseenstudios.dbpcommunity.com
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 14th Jan 2004 04:47 Edited at: 14th Jan 2004 04:54
Well, a sprite really is just an image that has some functions associated with it like rotation and movement. In this case the sprite would be something as simple as a little square.

The way that I'd design it would be to have an UDT array (user defined type) that holds the location of the sprite, its speed, and whether is is hidden (blink off) or shown (blink on.)

You could set up a loop to randomly generate the start positions of a hundred or so stars and every loop you could move the sprites based on their speed and off set their location if they're hidden or not. [Substract -1500 from the X axis of the sprite and it will be hidden, but you can continue to move it downwards.] When the sprite hits the bottom, assign a new random starting location and speed.
--
TAZ

Login to post a reply

Server time is: 2025-05-19 04:49:37
Your offset time is: 2025-05-19 04:49:37