Thursday 4 June 2020

Being a bit more specific

Another session tonight and very good progress. Coding object-specific rendering routines is definitely the way to go.

First cab off the rank was the player base. Once I had that sorted, to render the invader it was simply a case of writing a small loop to erase the area above, then branch to the player base render routine, since both objects are the same size.

As a consequence, the invaders now march across and down the screen correctly, as you 'd expect in the finished game.

Player moving, invaders marching. UFO TBD.

I should add that these object-specific routines are indeed faster than the generic routine that was to have replaced the original. Since the object size is known and fixed, there is no need for an inner loop.

I did however discover another complexity in the rotation that will require a little tweaking. The pixel coordinates of objects are actually in reference to the bottom left pixel of the object's bounding box on the original vertical display. Thus far I have been converting it on-the-fly and using a reference point of the top left pixel of the bounding box. I have to further analyze the implications but I'm thinking at this point only the invaders will matter because of the blanking described above, and this was easily remedied in a single ASM instruction.

UFO, invader bombs and player laser to go. Then the matter of the shields. I haven't revisited them this time around, but I vaguely recall there being some particular complexities with the bullets and laser hitting the shields. But if that does turn out to be the case, I have a plan of attack in mind.

One task that I've neglected to mention is the top and bottom of the screen, where the scores and credits are displayed. The vertical resolution of the original arcade monitor is greater than the CoCo3 can display. Fortunately the actual playfield dimensions will fit, and there's sufficient area to either side of the playfield to contain this information. I'm sure you've seen this type of layout on other homebrew ports of Space Invaders.

It should simply be a case of changing a few "magic numbers" in the code/data to move these strings.

And now that I can see the light at the end of the tunnel, I'm starting to think about adding sound. Definitely not one of my areas of expertise, but I think there is sufficient information in the form of blogs and sample code out there that I can leverage off. Obviously I'll be simply playing samples from the early versions of MAME; pretty sure this is a bit too heavy for the CoCo3! 😉

No comments:

Post a Comment