Jump to content
PacManPlus

Re-visiting Defender...

Recommended Posts

Hi guys:

 

For those of you that don't know, I have re-started porting 'Defender' to the 7800. 

 

I started from scratch as I wanted to use 320B mode and I had an idea for the terrain (use 320A mode for that).

 

However, I'm finding that I'm having issues with the scanner area:

 

image.png.9666f676263b5b6424417184af512d95.png

 

As you can see, I have a 16x4 tile grid, which works out to be 64x30 pixels. (The bottom two scan lines are the scanner box itself).

When I did this the first time, I blocked out an area of (added) memory, made the DL point to that area of RAM and just updated it each frame.

 

This time, I would really like to not use expanded memory (I want to see if I can do this within the limits of the vanilla console).

I tried using DL entries for each of the 'dots', but because of the character modes used (score, ships in reserve, etc) I can only get 4 sprite DLs in the zone before I run out of Maria cycles.

Flickering at 30Hz is not out of the question, but even then I'll only get 8.  I won't go more than 30Hz as then it gets bad.

 

I know Atari has done this with Defender and Defender II on the 2600 (with  Defender II only adding 128 more bytes of memory), so there has to be some sort of trick of doing this without using much memory.

(I would try and read the Defender II code but there is no disassembly of it that I know of).

 

Does anyone have any ideas?

Thanks,

Bob

Edited by PacManPlus
  • Like 37
  • Thanks 2

Share this post


Link to post
Share on other sites

What you have so far looks fantastic.

 

By my calculations, bitmapping the entire scanner would take 512 bytes (64 pixels wide, 32 pixels tall, 4 pixels per byte). I take it you don't have that. How much RAM do you have available?

 

I fully support getting this to work without extra resources.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks guys!!!

2 hours ago, Pat Brady said:

What you have so far looks fantastic.

 

By my calculations, bitmapping the entire scanner would take 512 bytes (64 pixels wide, 32 pixels tall, 4 pixels per byte). I take it you don't have that. How much RAM do you have available?

 

I fully support getting this to work without extra resources.

I wish, as that's all the RAM I have left.  If I use RAM for a 16 'tile' sprite, I will need 32 bytes (16 tiles x 2 bytes per pixel) continuous, and aligned by page (because that's how the graphics are fetched).  That needs to be done 8 times for each zone, by 4 zones. I get 1024 bytes, and they must be aligned by contiguous pages. :(   I *know* it wasn't done like this for the 2600 as you have at most 256 bytes (with SARA) for the entire game. Maybe @johnnywc might know of a shortcut (he did Wizard Of War for the 2600 which has a scanner area)

 

2 hours ago, Yurkie said:

Where do I send the money PacManPlus? I NEED this!

LOL thank you.  This one might be a while, as it will be challenging for me.

 

2 hours ago, Karl G said:

Have you seen how the top part looks if you use 320A mode up there as well?

Can't use 320A unfortunately; need the different color dots for each of the different types of enemies.  (sometimes more than one color each)

 

1 hour ago, swlovinist said:

Amazing, I cant wait to play this one! 

Thank you, John :)

 

 

 

Actually, while I was doing this, I got another idea for a game.  For those of you with the PS4 and a VR headset, there's a wonderful game for it called Moss (to me it's one of the best for the system).  I'm imagining a 2-D version of that (i.e. a side scroller platform game)... :ponder:

Edited by PacManPlus
  • Like 2

Share this post


Link to post
Share on other sites

Great that this is back!

 

Anyway, I had an idea how you could do hyperspace, if the left button is fire and the right button is smart bombs, how about hold down fire and then hit smart bombs?

Edited by SoundGammon
Correct bad english!
  • Like 1

Share this post


Link to post
Share on other sites
10 minutes ago, SoundGammon said:

Great that this is back!

 

Anyway, I had an idea how you could do hyperspace, if the left button is fire and the right button is smart bombs, how about hold down fire and then hit smart bombs?

That actually was my plan. :)

  • Like 4

Share this post


Link to post
Share on other sites
9 minutes ago, PacManPlus said:

I wish, as that's all the RAM I have left.  If I use RAM for a 16 'tile' sprite, I will need 32 bytes (16 tiles x 2 bytes per pixel) continuous, and aligned by page (because that's how the graphics are fetched).  That needs to be done 8 times for each zone, by 4 zones. I get 1024 bytes, and they must be aligned by contiguous pages. :(   I *know* it wasn't done like this for the 2600 as you have at most 256 bytes (with SARA) for the entire game. Maybe @johnnywc might know of a shortcut (he did Wizard Of War for the 2600 which has a scanner area)

 

I responded via PM.

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, PacManPlus said:

 

Actually, while I was doing this, I got another idea for a game.  For those of you with the PS4 and a VR headset, there's a wonderful game for it called Moss (to me it's one of the best for the system).  I'm imagining a 2-D version of that (i.e. a side scroller platform game)... :ponder:

What 3d glasses do you use?

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, PacManPlus said:

Does anyone have any ideas?

You can do it 2600 kernel style. Create 2 or 4 vertical line sprites in the radar DL, and as you go through each scanline in the radar, change the object X to enable+relocate or disable the sprite. This will require some pre-calculation in non-kernel time, saving the X for each dot ahead of time, so you'll need 120 bytes for a 4 dots per row radar, or 60 bytes for 2 dots per row radar. If you need to skimp even more, you can put dots on every other line.

 

  • Thanks 1

Share this post


Link to post
Share on other sites
22 hours ago, PacManPlus said:

Maybe @johnnywc might know of a shortcut (he did Wizard Of War for the 2600 which has a scanner area)

 Hi Bob!

 

Awesome work on Defender7800 - it's looking great so far (Defender is one of my favs from 'back in the day' ;) ). :thumbsup:

 

For WoW It's much simpler than what you're doing so I'm not sure how helpful it will be.  The grid is only 11x6, so it only takes up 12 bytes (and could have taken up less if I didn't pad the 2 bytes per row).  Since I use the PF to render the scanner area, I basically just cycle through each of the 6 rows to see if there is an enemy on that row and then update the PF in RAM accordingly.  Since I can only have 1 color per line, it will flicker at 30hz (sometimes even 20hz) if I need to render red, blue and yellow.  I couldn't use the players because I'm using those to render the timer on each side (plus I'm using the missiles for the sides of the scanner to keep them blue with a color change mid-line).  

 

I wish I had some suggestions about what to do, but my lack of knowledge for the 7800 isn't going to help. 😕  

 

 

22 hours ago, PacManPlus said:

I know Atari has done this with Defender and Defender II on the 2600 (with  Defender II only adding 128 more bytes of memory), so there has to be some sort of trick of doing this without using much memory.

(I would try and read the Defender II code but there is no disassembly of it that I know of).

Regarding 2600 Defender, they are using just the ball and M1 and LOTS of flicker.  The ball is used for your ship and the humanoids, displaying 1 per frame, and M1 is used for all the enemies, 1 per frame. 😕

 

For Defender II, they are using a 48-pixel sprite stored in memory (12 lines high I think) that would take 6*12 = 72 bytes.  All enemies and humanoids are 1 color (green) and they use the ball for your ship.  They 'blink' the landers to distinguish them from the other enemies.  So, in short, they are using the same method as you are (one big area of memory), it just happens to be much smaller. :D 

 

Hope that helps!  

 

Thanks,

John

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

So given the scheme the arcade version uses:

- Landers: orange/green
- Mutants: flashing/green
- Baiters: green
- Bombers: purple
- Pods: flashing
- Swarmers: red/orange
- Humanoids: grey

 

Have you considered halving the vertical resolution of the scanner dots? The dots are already two scanlines high, so it wouldn't be a hugely noticeable change. Additionally, and if you're willing to accept 20Hz flicker, you could drop the color depth of the scanner dots down to one bit per pixel, then alternate drawing the dots in red, green, and white. This would allow using the color scheme from the Atari 800 version of Defender:

- Landers: green
- Mutants: alternating red/green
- Baiters: alternating green/white
- Bombers: alternating white/red
- Pods: alternating red/white/green
- Swarmers: red
- Humanoids: white

 

It would be flickery and ugly, but it would get you a scanner just under 128 bytes.

 

Or, if you have the RAM for 2 bits per pixel and only want 30Hz flicker, and can do per-scanline palette changes, this allows exploiting the fact that there are only 6 enemy types, allowing each enemy to be given its own palette color.

(palette color 0 assumed below to always be black)

 

Odd frames: draw landers (color 1), mutants (color 2), and baiters (color 3).

- Odd scanlines palette: orange, flashing, green

- Even scanlines palette: green, green, green

 

Even frames: draw bombers (color 1), pods (color 2), and swarmers (color 3).

- Odd scanlines palette: purple, flashing, red

- Even scanlines palette: purple, flashing, orange

 

Humanoids draw every frame using color 1 or 3. High-speed enemies like baiters could also be drawn every frame, to make the scanner appear more responsive.

 

If CPU time for stuffing the palette is a concern, the above could be shuffled around to minimize the number of colors that need changing per scanline. Swarmers could be made solid red, yadda yadda.

 

And if per-scanline stuffing isn't an option at all, the affected enemies (really only landers and mutants) could blink between their two colors. Though given all the flickering already going on, it would probably be better to just give them their own unique colors.

Edited by ZylonBane
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks guys!  Out of all these suggestions, I'm sure I'll get something working.  Thank you :)

 

The only thing, are the colors (ZB brought this up in the post above).  Because I needed the Grey, White, Level Color, and 'flashing' color for the top (for the score, lives, smart bombs, and scanner border), this is how I have my two palettes:

(Also, please remember transparency HAS to be on because of all the little dots in the scanner):

Scanner Area:

	LDA #GREEN
	STA Z0C1
	LDA LEVELCOLOR								;THIS NEEDS TO BE THE LEVEL COLOR
	STA Z0C2
	LDA #WHITE
	STA Z0C3

	LDA #HOTPINK
	STA Z4C1
	LDA RTLOCAL+1								;FLASHING COLOR
	STA Z4C2
	LDA #GREY
	STA Z4C3

Playfield Area:

	LDA #RED								;TRIBUTE TO CULTURE CLUB? (10 POINTS IF YOU GET THE REFERENCE)
	STA Z0C1
	LDA #GOLD
	STA Z0C2
	LDA #GREEN
	STA Z0C3

	LDA RTLOCAL+1								;FLASHING COLOR
	STA Z4C1
	LDA #GREY
	STA Z4C2
	LDA #HOTPINK
	STA Z4C3

(I know I probably have to re-sequence the color cycling to match the arcade; I'll do that at a later time)

 

So, from what we have above, and knowing that the #GREEN and #HOTPINK in the scanner area need to be paired with another color, this is what I came up for the color scheme for the enemies in the scanner:

		Color 1			Color 2
Player:		White			N/A
Humanoid:	Grey			N/A
Lander:		Green (left color)	White (right color)
Mutant:		Flashing (top)		Grey (bottom)
Baiter:		Green (left)		Level Color (right) (works out the best when the level color is either black or green)
Bomber:		Hot Pink (left)		Flashing (right)
Pod:		Flashing		N/A
Swarmer:	Grey (left)		Hot Pink (right)

Level color is the color of the scanner border and the border between the scanner area and the playfield.

To that end, this is what they will look like (the 'orange' color is the flashing color, and the dark blue is the level color):

image.png.7e58edfef3a7f041e05eba0155977562.png

 

 

Thanks again,

Bob

Edited by PacManPlus
Added color examples
  • Like 2

Share this post


Link to post
Share on other sites
59 minutes ago, Stephen said:

Oh hell yeah!  I love this game even though I suck at it (pathetically).

I love (but suck at) the arcade version. The A8 version is a lot of fun, and since I built my own (awesome) thumbstick controller from Scott Baker’s design for my 5200, the 5200 version is my middle-aged jam. This is Standard (default) difficulty. 

 

VERY excited to see Bob working on this! :D

B1E96F19-338A-45C3-84E9-7DE721CF9CF1.jpeg

  • Like 3

Share this post


Link to post
Share on other sites

Considering how fast he churned out some other great classics, I'd hardly be surprised.  Maybe check again after the weekend. :P

  • Like 3
  • Haha 3

Share this post


Link to post
Share on other sites

Side Note:

 

This might be the first game to use the AtariVox.  If I can get the scanner to work using Pat Brady's re-arrangement of memory he did for me, I won't have $200 of re-usable memory for the HSC.

I still need to pick one (AtariVox) up and figure out how it works.

 

The reality now is (most likely) that more people will have the AtariVox than the XM or HSC at this point. 😢 The AtariVox is still being made, but the HSC, CCII, and possibly the XMs aren't.

 

 

Edited by PacManPlus
  • Like 4

Share this post


Link to post
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...