Jump to content
IGNORED

Space Invaders


attendo

Recommended Posts

I wonder if it can be done making a nice looking Space Invaders with bB.

 

I just started on something it already has 7 sprites on screen 6+player (so just 30 more to go, lol). It also has sound, movement, the enemies are flipped with REFP1 to the direction they walk and you can shoot a missile.

 

post-6948-1126607206_thumb.jpg post-6948-1126607215_thumb.jpg

 

Anyone in for it?

 

btw. I didn't used aliases with dim but you can easilly check what each var does by looking at the comments in the init part of the code.

 

 rem Space Invaders Clone
rem
rem People who worked on it
rem Attendo, enteryourname,

init
x=50 : rem players x pos.
a=50 : rem start of enemy1's x pos.
b=50 : rem start of enemy2's x pos.
c=50 : rem start of enemy3's x pos.
d=50 : rem start of enemy4's x pos.
e=50 : rem start of enemy5's x pos.
f=50 : rem start of enemy6's x pos.
l=36 : rem total # of enemys left
m=1  : rem used for switching
n=2  : rem direction 2=right -2=left
o=0  : rem delay counter
p=0  : rem ..(unused)
q=0  : rem missile y direction

COLUPF=208 : pfhline 0 10 31 on
AUDV0=0:AUDC0=2:AUDF0=1
main
player1:
%11100111
%10000100
%10000100
%10111100
%11111111
%11110011
%01111110
%00111100
end
NUSIZ1=$03 : COLUP1=52 : player1y=16
if m=1 then player1x=48+a else player1x=a
m=0-m
player0:
%11111110
%01111100
%11111110
%00111000
%01111100
%00111000
%00010000
%00000000
end
COLUP0=196 : player0x=x : player0y=80
drawscreen
o=o+1 : AUDV0=0
REFP1=8
if n=2 then REFP1=0
if o=13 then a=a+n : o=0 : AUDV0=10
if a>70 then n=0-n
if a<29 then n=0-n
if joy0left then x=x-1
if joy0right then x=x+1
if x<31 then x=31
if x>152 then x=152
if joy0fire && q<1 then goto playerfires
if q>0 then q=q-1 : missile0y=q
goto main

playerfires
missile0x=x+4
q=80 : missile0y=75
missile0height=3
goto main

spaceinvader.txt

 

Also here are some simple Space Invaders sprites I made in a zip package you can load them with sprite editor in the new 2600IDE.

Sprites_SpaceInvaders.zip

Link to comment
Share on other sites

I just started on something it already has 7 sprites on screen 6+player (so just 30 more to go, lol). It also has sound,  movement, the enemies are flipped with REFP1 to the direction they walk and you can shoot a missile.

 

I think you need to change the alien shape so that instead of being one alien it's a stack of aliens spaced vertically the same distance as the playfield pixel height (I forget how tall that as--8 double-pixels maybe?) Then you can use the playfield to try to obscure the aliens that aren't supposed to appear. You'll need to change the flicker method so that on half the frames you'll get the aliens with the playfield in front of them (and no ship or missiles); on the other half of the frames you'll get the player's ship and up to three 'projectiles' (one of the players can be used as a projectile) and these objects will appear in front of the playfield.

 

Do things that way and I think it should be possible to do a playable Space Invaders entirely in BB.

Link to comment
Share on other sites

Thanks for the tip!

 

My pleasure. While the game would obviously would be nicer without massive flicker (and the original 2600 cartridge shows that it can be done flickering nothing but the shots, and later carts have shown that even flickering the shots isn't necessary) being able to do the game at all in bB would be rather nice demonstration that bB is more than a "Firefly Construction Set".

 

A few more notes:

 

-1- While debugging, it may be useful to set the playfield color to something other than the background.

 

-2- The playfield will always be present every frame, but if it's set to the same color as the background and other sprites (player and enemy shots, e.g.) go in front of it it will be invisible. There is thus no need to worry about hiding it on alternate frames.

 

-3- During the "Aliens" frame, if you set one of the missiles to X coordinate 111 and set its NUSIZ to be two pixels wide, you'll get vertical lines marking the edges of the playfield (the normal approach of using PF0 for that won't work here because the playfield is invisible). If you want to hide the "extra" lines you get from this at the extreme edge of the screen, you can use PF0.

 

-4- When the flying saucer isn't at the top of the screen, you can use P0 and M0 for the alien shots; M1 for the player's shots. When the saucer appears, the aliens will shoot less.

 

-5- You'll have to read playfield pixels to figure out which aliens the player has shot, since collision detection will be pretty worthless (among other things, the shots and aliens are on opposite frames, and even aliens which have been hit will still be there).

 

-6- You'll probably have to be watchful for when the leftmost or rightmost column of aliens is cleared. Aliens shouldn't bounce off the edge of the screen if they're not really there, and you don't want your sprites to keep going past the edge of the playfield (since they'll all start showing up)

 

I don't think this will be a trivial game to implement in bB, but if you can read playfield pixels it should be possible to make a version of Space Invaders which 'works' and has only two big problems compared with Game#1 of the original

 

-1- 30Hz flicker on everything, instead of just shots

 

-2- No shields.

 

Still, not bad for a "Firefly Construction Set".

Link to comment
Share on other sites

Thanks for the tip!

 

I now got 36+1 'sprites' on screen, will try the rest later like improving the flicker method. So it seems it can be done, really nice.

931415[/snapback]

 

That's looking pretty good so far... you could make it look even better, in my opinion, by adding in sprites that are a bit more arcade accurate... unless, of course, you're just trying to recreate the Atari 2600 version. But, it would be pretty cool to make an SI with bB that's more like the arcade version (read, better) than the 2600 version. That would be a statement.

post-6801-1126765149_thumb.jpg

Link to comment
Share on other sites

But, it would be pretty cool to make an SI with bB that's more like the arcade version (read, better) than the 2600 version.  That would be a statement.

931677[/snapback]

 

There are already homebrew SI clones that are better than the original. bB isn't going to be able to get that good--at least not without a custom kernel. The original SI could support six differently-shaped sprites per scan line. bB supports two sprite shapes PER SCREEN. There really is no comparison.

 

BTW, does anyone know why the original SI makes rows of invaders 'disappear' from the comb as soon as the last invader in the row is destroyed? It has the unfortunate side effect of causing the explosion not to show up. Given that the kernel has no problem handling "missing" invaders, I wonder why it doesn't simply draw the empty row of invaders the same way as any other row?

 

Also, would anyone be interested in a hack to allow two-shot mode in games 1-16? It's a single-byte change in the binary file.

Link to comment
Share on other sites

Also, would anyone be interested in a hack to allow two-shot mode in games 1-16?  It's a single-byte change in the binary file.

931693[/snapback]

 

Can't you get this by just holding down reset while turning the machine on?

 

Of course, that brings me to another question:

 

Can this behavior be replicated in the emulators?

Edited by potatohead
Link to comment
Share on other sites

But, it would be pretty cool to make an SI with bB that's more like the arcade version (read, better) than the 2600 version.  That would be a statement.

931677[/snapback]

 

There are already homebrew SI clones that are better than the original. bB isn't going to be able to get that good--at least not without a custom kernel. The original SI could support six differently-shaped sprites per scan line. bB supports two sprite shapes PER SCREEN. There really is no comparison.

 

 

I never said anything about this being the best SI on 2600 ever (I'm well aware of the numerous clones and hacks that are better in one way or another)... I just said that I think it could be better than the original 2600 version with some effort. Yeah it'll need some assembly thrown in along with the bB code to make it there, but that's not against the rules (if there are any) or outside the realm of possibility.

 

Anyways, what I came in here to say is... attendo, if you wanted some sprites that look as much like the arcade as possible given the limitations of what you're doing, I've made some for you. They're different sprites than any other existing SI homebrew or hack, so they'll be completely unique to your version and no one will give you any trouble about stealing their sprites. They also do something that most other hacks/etc. don't do, the top rows of invaders are the smallest, the middle rows are a bit bigger, and the bottom rows are the biggest. I've also included a new version of the ship that's proportional to the invaders. Best of luck on the game if you are going to continue with it.

 

PS: If you were to go more along the lines of arcade accuracy, you could leave off the topmost row of invaders... this would give you more room for the shields if you find a way to implement them.

post-6801-1126871060_thumb.jpg

Link to comment
Share on other sites

Anyways, what I came in here to say is... attendo, if you wanted some sprites that look as much like the arcade as possible given the limitations of what you're doing, I've made some for you.  They're different sprites than any other existing SI homebrew or hack, so they'll be completely unique to your version and no one will give you any trouble about stealing their sprites.  They also do something that most other hacks/etc. don't do, the top rows of invaders are the smallest, the middle rows are a bit bigger, and the bottom rows are the biggest.  I've also included a new version of the ship that's proportional to the invaders.  Best of luck on the game if you are going to continue with it.

932549[/snapback]

 

Sadly I never really played the arcade version of SI :( so I don't know the differences only know the 2600 SI version. What would be cool if you could select between 2600 mode and a Arcade mode in the main screen. Do you have the 0110001..etc. for the sprites?

Link to comment
Share on other sites

Anyways, what I came in here to say is... attendo, if you wanted some sprites that look as much like the arcade as possible given the limitations of what you're doing, I've made some for you.  They're different sprites than any other existing SI homebrew or hack, so they'll be completely unique to your version and no one will give you any trouble about stealing their sprites.  They also do something that most other hacks/etc. don't do, the top rows of invaders are the smallest, the middle rows are a bit bigger, and the bottom rows are the biggest.  I've also included a new version of the ship that's proportional to the invaders.  Best of luck on the game if you are going to continue with it.

932549[/snapback]

 

Sadly I never really played the arcade version of SI :( so I don't know the differences only know the 2600 SI version. What would be cool if you could select between 2600 mode and a Arcade mode in the main screen. Do you have the 0110001..etc. for the sprites?

932580[/snapback]

 

Yeah, here they are...

 

The little guys...

Frame0
       .byte #%00100100;--
       .byte #%01011010;--
       .byte #%01111110;--
       .byte #%01011010;--
       .byte #%00111100;--
       .byte #%00011000;--
Frame1
       .byte #%01011010;--
       .byte #%00100100;--
       .byte #%01111110;--
       .byte #%01011010;--
       .byte #%00111100;--
       .byte #%00011000;--

The medium guys...

Frame0
       .byte #%00011000;--
       .byte #%10100101;--
       .byte #%11111111;--
       .byte #%11011011;--
       .byte #%01111110;--
       .byte #%00100100;--
       .byte #%01000010;--
Frame1
       .byte #%01000010;--
       .byte #%00100100;--
       .byte #%01111110;--
       .byte #%11011011;--
       .byte #%11111111;--
       .byte #%10100101;--
       .byte #%01000010;--

The big guys...

Frame0
       .byte #%01000010;--
       .byte #%10011001;--
       .byte #%01100110;--
       .byte #%11111111;--
       .byte #%10011001;--
       .byte #%11111111;--
       .byte #%01111110;--
       .byte #%00011000;--
Frame1
       .byte #%10000001;--
       .byte #%01011010;--
       .byte #%01100110;--
       .byte #%11111111;--
       .byte #%10011001;--
       .byte #%11111111;--
       .byte #%01111110;--
       .byte #%00011000;--

Here's the ship too, if you need it...

Frame0
       .byte #%11111110;--
       .byte #%11111110;--
       .byte #%01111100;--
       .byte #%00010000;--

Check out this page for arcade SI emulators.

 

I've attached a pic of the arcade SI as well...

post-6801-1126883222_thumb.jpg

Edited by jussts
Link to comment
Share on other sites

As much as I hate to keep hijacking this thread... I've figured out a way to emulate the look of the arcade game's sprites even more closely. The uppermost sprites in the arcade version seem to lag behind the middle ones slightly, which in turn lag behind the lower ones. You can achieve this look 'for free' so to speak (no extra coding involved) with a minor graphical change (see attached images). There is, in my opinion, only one graphical setback... the middle invaders don't look quite as good to me, but the overall effect looks so much more like the arcade version that I don't mind.

 

I've included two versions... the only difference is in the third row of invaders... I'm not sure which option is better. Option one looks better to my eye but option two seems more arcade accurate (if I had to choose, I'd go with option one at the moment).

 

PS: If you go with these new 'lagging' sprites yours will be the only 2600 version of SI to have this extra touch of verisimilitude (to my knowledge, at least).

post-6801-1126893038_thumb.png

post-6801-1126893047_thumb.png

Edited by jussts
Link to comment
Share on other sites

  • 3 weeks later...
Well I found some time to play with it but I can't seem to get rid of that flickering so if anyone wants to continue with this project of making the first game made with bB that has around 37 sprites onscreen be my guest..

 

Here's the code:

 

bBspaceinvader.txt

 

And the bin:

 

bBspaceinvader.txt.bin

941043[/snapback]

Maybe you could eliminate the flickering by using both players for invaders, and making the tank from two missiles, and make all projectiles from the ball (flickered if needed.)

Link to comment
Share on other sites

Maybe you could eliminate the flickering by using both players for invaders, and making the tank from two missiles, and make all projectiles from the ball (flickered if needed.)

941147[/snapback]

 

The only way I can see that the game can work will be to use both players for the invaders on the 'even frames', with the sprites 'behind' the playfield (which is used to cover up any invaders that are destroyed), and with the player ship, shots, enemy bombs, etc. on the 'odd' frames (with the sprites 'in front of' the playfield). Further, when the invaders are displayed, there won't be any sprites that are usable for shots or bombs since the playfield (and ball) will be black while the missiles will be triplexed.

Link to comment
Share on other sites

Maybe you could eliminate the flickering by using both players for invaders, and making the tank from two missiles, and make all projectiles from the ball (flickered if needed.)

941147[/snapback]

 

The only way I can see that the game can work will be to use both players for the invaders on the 'even frames', with the sprites 'behind' the playfield (which is used to cover up any invaders that are destroyed), and with the player ship, shots, enemy bombs, etc. on the 'odd' frames (with the sprites 'in front of' the playfield). Further, when the invaders are displayed, there won't be any sprites that are usable for shots or bombs since the playfield (and ball) will be black while the missiles will be triplexed.

941167[/snapback]

Yeah, the tank made of two missiles won't work. So I tried being more creative than that. I did find another way.

 

I whipped up this demo. It uses the standard bB kernel with no mods. It's got its own limitations (everything is the same color) but there's no flicker.

 

Without cheating (i.e. looking at code or turning off objects in z26) can anyone guess how it works?

bBinv.bin

Link to comment
Share on other sites

Yeah, the tank made of two missiles won't work.  So I tried being more creative than that.  I did find another way.

I know also tried making a tank with the missiles but no succes

 

I whipped up this demo.  It uses the standard bB kernel with no mods.  It's got its own limitations (everything is the same color) but there's no flicker.

 

Without cheating (i.e. looking at code or turning off objects in z26) can anyone guess how it works?

941278[/snapback]

 

Lol, I gues you used pfpixel for the tank plus with a missile on it, pretty smart! Seems this way it will be possible because now player0 and 1 can be used for the sprites, great!

Link to comment
Share on other sites

Yeah, the tank made of two missiles won't work.  So I tried being more creative than that.  I did find another way.

I know also tried making a tank with the missiles but no succes

 

I whipped up this demo.  It uses the standard bB kernel with no mods.  It's got its own limitations (everything is the same color) but there's no flicker.

 

Without cheating (i.e. looking at code or turning off objects in z26) can anyone guess how it works?

941278[/snapback]

 

Lol, I gues you used pfpixel for the tank plus with a missile on it, pretty smart! Seems this way it will be possible because now player0 and 1 can be used for the sprites, great!

941280[/snapback]

It's actually a little more involved than that. Note that the tank moves smoothly instead of by steps of 4 pixels as a playfield block would.

Link to comment
Share on other sites

You used the 2nd missile and the ball? common tel us :)

941285[/snapback]

Not exactly... remember when we use triple copies of both players, it also creates triple copies of both missiles.

 

I should also note that this SI engine has the ability to turn off individual invaders (easily I might add)

 

Without giving it away, if you need a hint, here's the same program with only one change - the background color has been changed from black to gray.

bBinvhint.bin

Link to comment
Share on other sites

Not exactly... remember when we use triple copies of both players, it also creates triple copies of both missiles.

 

I should also note that this SI engine has the ability to turn off individual invaders (easily I might add)

 

Without giving it away, if you need a hint, here's the same program with only one change - the background color has been changed from black to gray.

I'd like to play around with the bB code for that after it's all fixed up. That would be a nice sample program to learn from. Things like a Space Invaders game, a Breakout game, a Pac-Man game with 'dots' to eat, an Asteroids game, and so on would be great newbie grabbers and help teach us things we need to know at the same time.

Link to comment
Share on other sites

Without cheating (i.e. looking at code or turning off objects in z26) can anyone guess how it works?

 

Okay, I'll admit I cheated. Using black sprites for masking is pretty clever, but there's a problem: the black sprites will cover up the shots and bombs. "Score" mode would help things out except that it can only be used with players/missiles in front of the Ball. Swapping the playfield and background would allow you to get by with playfield-in-front mode but then the ball would be black.

Link to comment
Share on other sites

Without cheating (i.e. looking at code or turning off objects in z26) can anyone guess how it works?

 

Okay, I'll admit I cheated. Using black sprites for masking is pretty clever, but there's a problem: the black sprites will cover up the shots and bombs. "Score" mode would help things out except that it can only be used with players/missiles in front of the Ball. Swapping the playfield and background would allow you to get by with playfield-in-front mode but then the ball would be black.

941368[/snapback]

It's not perfect, but it's the most workable compromise if we are to eliminate flicker. The shots and bombs will be obscured by the black sprites but will be visible behind invaders that are turned off - so they won't completely disappear.

 

I'll play around with it later to see if I can get collision detection working well enough to be able to shoot the invaders.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...