Atari 2600 Combat style multiplayer tank game

Got a programming project in mind? Tell everyone about it!
User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Atari 2600 Combat style multiplayer tank game

Postby sydney » Wed Jan 11, 2017 2:35 pm

I've had quite a long break from programming after finally finishing Beebout and I'm in the mood to write a game. I had originally decided way back when to write a River Raid style game but I'm struggling with scrolling so I decided to write a single screen game that won't be too taxing but has a bit more going on than just a bat and a ball. For those unfamiliar with Combat I'll briefly explain what it's all about.
Combat was game on the Atari 2600 which had loads - maybe 40 - different kinds of Combat game with tank vs tank or plane vs plane or jet vs jet. It was pretty simple and all you had to do was shoot your opponent.
jbnbeebs Jbiplane is probably a direct descendant of the plane vs plane version of Combat. I'm doing tanks!
Here is a screenshot of the tank version of Combat:

combat.jpg
(4.91 KiB) Not downloaded yet


I think I'd like to do a 4 player version if possible which would probably need joysticks for two of the players and when it's all done I'm wondering if an econet version would be possible.

I'm really just beginning right now and I haven't even thought of a name yet, I've thought of 'Battle Arena', 'Tank War' and 'Tank Arena' so far. Don't want to call it combat so if you have an amazing title let me know and I'll be forever grateful and give you 95% of the royalties.

User avatar
jbnbeeb
Posts: 363
Joined: Sat Apr 03, 2010 8:16 pm

Re: Atari 2600 Combat style multiplayer tank game

Postby jbnbeeb » Wed Jan 11, 2017 9:23 pm

Yes! I mentioned Combat in the jbiplane thread in Retrosoftware. I'd love to see a Combat game - and as a bonus a 1 player option maybe :D I may revisit jbiplane one day and do that.
I'm going to ..
ABUG North Halifax June 10-12
Image

User avatar
richardtoohey
Posts: 3354
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand

Re: Atari 2600 Combat style multiplayer tank game

Postby richardtoohey » Thu Jan 12, 2017 1:54 am

I was thinking of Combat myself; even started looking at the disassembly of it (the VCS version) and playing it on Atari 2600 emulators.

But even the simple (!) logic was enough to move it to the too-hard-for-now basket.

Will be interested in your progress. :D

And I'll get back to it one day.

User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Re: Atari 2600 Combat style multiplayer tank game

Postby sydney » Wed Jan 25, 2017 11:37 am

I was going to make a start on this today but I seem to have forgotten a lot of what I learned writing beebout. It's coming back slowly so I decided start in the same place I started with beebout by using the 'Basic Sprite plotter' code by Steve O'leary in the example code section of Retrosoftware. I'm going to start another thread about it in the programming section here.
On a more positive note I've got a good idea how I'm going to go about writing this game and it should be a lot more organised than my last attempt. I've got some of the graphics designed and I've decided to go with a 256 pixel wide mode 1 display. This obviously limits the colours available but the sprites I've designed look much better with the higher resolution available.

User avatar
Arcadian
Posts: 2733
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: Atari 2600 Combat style multiplayer tank game

Postby Arcadian » Wed Jan 25, 2017 1:29 pm

I love Combat and would love to see a Beeb version, especially a 4-player one! Good luck Simon!!
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug Leicestershire (17-19 November 2017)

User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Re: Atari 2600 Combat style multiplayer tank game

Postby sydney » Fri Jan 27, 2017 4:58 pm

First screenshot.
Not much going on yet but a lot of work is done and it'll hopefully come together quite quickly. Just need some free time now. It's a shame I'm not at the ABug this weekend :(

combat-wip.png

User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Re: Atari 2600 Combat style multiplayer tank game

Postby sydney » Fri Jan 27, 2017 7:21 pm

I had a little play around with an online sprite editor earlier and have a first draft of the tank sprite. If someone who can actually draw would like to redo this then that is fine by me.
combat.png
(1 KiB) Not downloaded yet

combat.gif
(16.78 KiB) Not downloaded yet

User avatar
FourthStone
Posts: 386
Joined: Thu Nov 17, 2016 2:29 am
Location: Melbourne, Australia

Re: Atari 2600 Combat style multiplayer tank game

Postby FourthStone » Sat Jan 28, 2017 3:08 am

Looks pretty good to me, enough to get started on a game engine at least.. Reminds me a bit of dune2 sprites on the PC BITD, which would also be an interesting project for the beeb :-k

EDIT:

DuneII_Devastator001.png
(1.14 KiB) Not downloaded yet

User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Re: Atari 2600 Combat style multiplayer tank game

Postby sydney » Wed Feb 01, 2017 11:30 am

I was hoping to get some work done on this today but I've just been too busy with various jobs around the house and booking a table at Wakefield and erm playing Arcadians.
I think I'm going to run into a major problem with memory. Each sprite is 12-16 pixels wide and 12-16 pixels deep which works out at between 48 to 64 bytes each. There are 16 frames which makes 16*64 = 1024 bytes. I was hoping to have single pixel precision movement so I'd need an additional 3 copies of each sprite offset by an extra pixel each which gives 4k of sprite data per tank. With 4 tanks I'm already up to 16k just for the tank sprites!
To counter this I'm willing to compromise on the single pixel precision and move to two pixel which immediately removes half of the sprite data.
Another idea I have is to use the fact that the downward facing sprites are mirror images of the upward facing sprites. I could simply have a 'Facing Down' flag and plot the sprites in reverse. Not sure exactly how to do this but that's half of the fun of what writing a game.
I'm also not sure the sprite plotting routine will be able to plot 4 tanks and 4 bullets fast enough, especially considering it's entirely possible all 8 sprites could be at the top of the screen.

User avatar
tricky
Posts: 1816
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Atari 2600 Combat style multiplayer tank game

Postby tricky » Wed Feb 01, 2017 1:34 pm

You could have the same tank, but with a different "badge" in the centre of each tank or even dither the sprite colour. To use a pattern over your colour, use say colour 0 for background (cyan), colour 2 for outlines (black) and colour 3 for your tank (yellow). Then when drawing, you can AND it with 0xF0 to turn colour 3 (yellow) into colour 1 (whatever). You can do the same thing with a pattern (character aligned unless you swap it as the tank moves) to give whatever dither pattern you like.
Even if you use 4K for sprites, you could have the screen be 256x256 (16K and faster to draw), leaving 12K if you don't need the OS or BASIC.
My vertical scrolling framework demo draws up to 16 9x17 masked sprites and redraws the background (which is also being decoded) at 50fps with no flicker, although it is in mode 5, but there is definitely time if you don't mind jumping through a few hoops!

User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Re: Atari 2600 Combat style multiplayer tank game

Postby sydney » Wed Feb 01, 2017 2:28 pm

Thanks Tricky!
I'd thought about the 'badge' idea too - simply colouring the circle in the centre of each tank in the correct colour for each player. I'm already using 256x256 so have 4k more than using a standard mode.
I'd like to keep the OS active as I'd like to try to add an econet mode with 4 beebs connected up, not sure whether I'll manage this but it should be interesting.

User avatar
tricky
Posts: 1816
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Atari 2600 Combat style multiplayer tank game

Postby tricky » Wed Feb 01, 2017 4:59 pm

Sorry, forgot about multiplayer.

User avatar
FourthStone
Posts: 386
Joined: Thu Nov 17, 2016 2:29 am
Location: Melbourne, Australia

Re: Atari 2600 Combat style multiplayer tank game

Postby FourthStone » Wed Feb 01, 2017 8:11 pm

You could technically get away with 4 sprites (times 4 for single pixel movement so 16 total) and use rotation or reflection to get the remaining frames. Makes the sprite plotter a bit more complicated but it will save you a ton of memory. I think the number of sprites being plotted won't be an issue and the beeb doesn't care if they're all on the same scanline as it doesn't use sprite hardware.

Good luck, looks like a fun project :D

User avatar
sydney
Posts: 1967
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne

Re: Atari 2600 Combat style multiplayer tank game

Postby sydney » Wed Feb 01, 2017 8:39 pm

FourthStone wrote:You could technically get away with 4 sprites (times 4 for single pixel movement so 16 total) and use rotation or reflection to get the remaining frames.


I fear rotating the sprites will be much too slow and beyond my ability to code.

Makes the sprite plotter a bit more complicated but it will save you a ton of memory. I think the number of sprites being plotted won't be an issue and the beeb doesn't care if they're all on the same scanline as it doesn't use sprite hardware.


The problem with having no sprite hardware is that the 6502 has to do all the work. The beeb runs at 2 MHz which gives approximately 40000 cycles per frame in a 50 Hz game. This sounds a lot until you realise how many cycles are used in plotting just one sprite. This thread over at RS describes a 20x24 pixel masked sprite taking approximately 9200 cycles. My sprites are about half the size and not masked so should take less than half this number of cycles. Taking 4000 cycles per sprite as a best guess, plotting 4 sprites at the top of the screen will take 16000 cycles but the raster will be 40% (16000/40000) of the way down the screen so there will be flickering.

This is my understanding of roughly how it works - does it sound right?

User avatar
tricky
Posts: 1816
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Atari 2600 Combat style multiplayer tank game

Postby tricky » Wed Feb 01, 2017 8:58 pm

That was 20 mode 2 pixels, 10 bytes wide, so you can half those times again and I haven't checked, but I think that was masking with a single page of masks, which is slower again. Roughly 18% of the frame is "offscreen", so even without tricks, you are close.
Add a score area at the top or bottom and you are done.

FourthStone, vertical flipping is OK, but horizontal mirroring isn't so nice, but could be done with a page to look up the mirrored bytes, but the mirrored and flipped would probably require similar code to the masked sprites with a single extra page.

For my vertical scrolling demo, I wait for the raster to be a quarter down the screen and then clear the background for the top quarter, wait for the beam to be half way and clear the next quarter, drawing the top, repeat until the bottom and you have 1/2 of the visible screen (3/5 total) to draw with no flicker. It does mean iterating over your sprites 4 times, but you don't have many.


Return to “projects”

Who is online

Users browsing this forum: No registered users and 1 guest