Jump to content
  • entries
    62
  • comments
    464
  • views
    86,917

SpaceWar!


supercat

850 views

Here's my start of what Atari's "Space War" should have been. Everything suffers from 30Hz flicker (oh well) but the players can have get 4 shots on screen. Or maybe I'll go with three shots per player and have two floating fuel pods.

 

In addition to the "combat-style" two-player game, I was planning to also have a single-player game in which a computer-controlled ship lays down red and green dots. The player is required to collect the green dots while avoiding the red dots or the computer-controlled ship.

 

The kernel is working, as is the basic accelleration of the players. Shot handling needs a lot of work, and I still have to get gravity working. With luck I'll be able to have gravity affect the shots as well as the players. Should make things interesting.

12 Comments


Recommended Comments

This is great! I LOVE SpaceWar. First game I played in the arcade was the Cinematronic version (called Space Wars with an 's')

 

Are you going for the MIT SpaceWar! look / feel or the Cinematronic version? Either way, would be an improvement over the Atari version which somehow misses the fun of the original. From your name SpaceWar! you'd be going for the original. :-)

 

I do enjoy the Vectrex version. It keeps the fun of the original.

Link to comment
Are you going for the MIT SpaceWar! look / feel or the Cinematronic version? Either way, would be an improvement over the Atari version which somehow misses the fun of the original. From your name SpaceWar! you'd be going for the original. :-)

 

What are the differences? The Cinematronic version I think allowed a space ship to be damaged without being destroyed. Cute, but it would require some extra sprite designs and add other complications. I'm trying for a minimalist 2K minigame.

 

I was thinking of doing a "crock explosion" when a player gets hit and see if anyone recognizes the concept. Would save code space over doing a better one.

 

The biggest limitation in Atari's Space War cartridge, I think, is the fact that each player is only allowed one shot at a time. Adding four would be nicer than adding three, but having something like floating energy pods would be nice.

 

Further, reducing the number of shots for each player to three would allow simplified collision detection (if player collisions only register with shots of the opposite color or the energy pod of the same color). Though for the single-player game I might want to recognize collisions with more objects than that.

 

Perhaps in the single player game I could decide not to flicker the player's ship. Then I'd be limited to eight other objects rather than nine, and the "enemy" would have to be a block rather than a ship (my kernel at present doesn't allow for two player shapes, though I guess that could change if needed). Still might be some interesting possibilities, though.

Link to comment

It doesn't seem worth it to me to require flickering the ships just to get an extra shot. I'd use 3 shots per ship and not flicker the ships, or flicker the shots at 20 Hz.

Link to comment

It doesn't seem worth it to me to require flickering the ships just to get an extra shot. I'd use 3 shots per ship and not flicker the ships, or flicker the shots at 20 Hz.

 

The flickering ship in Asteroids is not considered objectionable; 20Hz flicker is evil.

 

It would be possible I suppose to alternate frames

(P0)	(M0)	(P1)	(M1)	(BL)
Ship0   Shot0A  Ship1   Shot1A  Shot0C
Ship0   Shot0B  Ship1   Shot1B  Shot1C

but the code for that would be a little messy. The code works out much more nicely with:

(P0)	(M0)	(P1)	(M1)	(BL)
Ship0   Shot0A  Shot0B  Shot0C  Shot0D
Ship1   Shot1A  Shot1B  Shot1C  Shot1D

or nicer yet (from a coding standpoint) if I decide to go with floating "energy pods" that players need to collect to reload

(P0)	(M0)	(P1)	(M1)	(BL)
Ship0   Epod0   Shot1A  Shot1C  Shot1D
Ship1   Epod1   Shot0B  Shot0C  Shot0D

I have two sets of variables, and on each frame I swap them. The code always uses the variables in the first set for both display and movement computations. Using the latter arrangement of sprites would make processing collisions extremely nice and easy.

Link to comment
I would strongly recommend plan A. Both ships at 60Hz would be much preferable.

 

Eh, maybe. I can see some advantages to doing that (it'd certainly help with collision detection) but I'll keep going with the current kernel for now. Right now I'm working on gravity. It sorta works, but I don't know if there will be enough vblank time to run gravity on the shots as well as the ships. The original didn't, but I think the game would be more interesting if it did.

Link to comment

I have partially disassembled the original Atari 2600 Space War for converting it into that PDP-1 version. Interested in the code?

 

Sure. Is it on Minidig or something?

 

For my own gravity routines, I scale X and Y so that the larger is in the range 128..255. Then I use the top 4 bits of X and Y to perform a table lookup (in a table that uses 192 bytes from a page; the unused bytes are in eight groups of eight). Then I shift up the value by twice the number of bits I had to shift up the original X and Y.

 

Right now the shifting code puts the table value into the lowest byte of a three-byte variable and then shifts everything left twice the specified number of times. It should be possible to speed things up considerably if I recognize the different cases:

 store in LSB; shift left 2x
 store in LSB; shift left 4x
 store in mid; shift right 2x
 store in mid
 store in mid; shift left 2x
 store in mid; shift left 4x
 store in upper; shift right 2x

Still not sure it would be possible to run gravity on all the shots, but if I have fuel pods in the game it might be nice to run gravity on those.

Link to comment

I'll PM the code to you (must first check where I have it).

 

IIRC the approach is based a X and Y distance tables, which are then combined "somehow". The results looked convincing though there are heavily cheating with the math. Didn't fully understand it back then, but I was able to adapt the gravity effects for the PDP-1 version.

Link to comment

It should be possible to do the very same display almost without flicker, with a small trick: Have greens shots only on odd scanlines and reds only on even. You need only flicker then when green or red manage to fire 4 shots straight horizontal, or, when a horizontal area gets too crowded for repositionings, for example you cannot have three shots in one scanline and two on different positions in the next.

Link to comment
Guest
Add a comment...

×   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...