Jump to content
IGNORED

My first arcade port and the power of the console


AnalogKid

Recommended Posts

About two weeks ago I decided to try writing my first arcade port for the Colecovision so I looked around for a title I thought should be available for the standard console and landed on Asteroids.  Yeah, I dove in the deep end ?   After getting past the learning curve of using the library SDK and relearning C, which I haven't used in 20 years, I came up with something that I think demonstrates how powerful and underrated the console really is.  At its most intense, my port of the game has 21 independent sprites moving in their own directions at their own paces with animated explosions of different rates and all sound channels filling the room without any lag or jitter.  The console could easily support a few more asteroids on the screen but I coded to avoid the dreaded 4-sprite-per-line issue.  Anyway, here's my initial proof-of-concept demo:

Starting out, round one

Bring it on!

 

Not too shabby for a 3.5Mhz Z80 with 1K RAM running C based code.  Well done Coleco


btw if anyone out there is coding in C and could use some tricks for having a large number of characters with independent pacing, I'd be happy to share

  • Like 12
  • Thanks 2
Link to comment
Share on other sites

20 minutes ago, AnalogKid said:

About two weeks ago I decided to try writing my first arcade port for the Colecovision so I looked around for a title I thought should be available for the standard console and landed on Asteroids.  Yeah, I dove in the deep end ?   After getting past the learning curve of using the library SDK and relearning C, which I haven't used in 20 years, I came up with something that I think demonstrates how powerful and underrated the console really is.  At its most intense, my port of the game has 21 independent sprites moving in their own directions at their own paces with animated explosions of different rates and all sound channels filling the room without any lag or jitter.  The console could easily support a few more asteroids on the screen but I coded to avoid the dreaded 4-sprite-per-line issue.  Anyway, here's my initial proof-of-concept demo:

Starting out, round one

Bring it on!

 

Not too shabby for a 3.5Mhz Z80 with 1K RAM running C based code.  Well done Coleco


btw if anyone out there is coding in C and could use some tricks for having a large number of characters with independent pacing, I'd be happy to share

Absolutely outstanding work!  Love the smoothness of the ship spin animation, asteroid shapes are spot on, explosion animations are awesome and the sound effects are also spot on.

Link to comment
Share on other sites

1 hour ago, Tony Cruise said:

Absolutely outstanding work!  Love the smoothness of the ship spin animation, asteroid shapes are spot on, explosion animations are awesome and the sound effects are also spot on.

Two weeks ago and he has Asteroids up with sound, scoring, asteroids and ships.

6 years and counting and you still don't even have your astrosmash clone up and running with sound or much else.

 

Well, I take that back. Your ship does go left and right so I guess there is some progress.

I'm only jesting...  I know you don't have time to work on your video series.  Shoulder Blade can be a addicting

 

 

I think we have a new teacher in town guys.

Link to comment
Share on other sites

18 hours ago, AnalogKid said:

About two weeks ago I decided to try writing my first arcade port for the Colecovision so I looked around for a title I thought should be available for the standard console and landed on Asteroids.  Yeah, I dove in the deep end ?   After getting past the learning curve of using the library SDK and relearning C, which I haven't used in 20 years, I came up with something that I think demonstrates how powerful and underrated the console really is.  At its most intense, my port of the game has 21 independent sprites moving in their own directions at their own paces with animated explosions of different rates and all sound channels filling the room without any lag or jitter.  The console could easily support a few more asteroids on the screen but I coded to avoid the dreaded 4-sprite-per-line issue.  Anyway, here's my initial proof-of-concept demo:

Starting out, round one

Bring it on!

 

Not too shabby for a 3.5Mhz Z80 with 1K RAM running C based code.  Well done Coleco


btw if anyone out there is coding in C and could use some tricks for having a large number of characters with independent pacing, I'd be happy to share

That's freakin awesome work.

My first response would be are those sprite asteroids being more than 4 and then I am thinking Space Fury was able to get away with it and create a really fun game.

 

Then again with modern techniques they could be fully animated pattern tables which would be a nightmare and slow.

 

Congrats.

Looking forward to my copy when it's released.

Link to comment
Share on other sites

16 hours ago, Richard the 7th said:

Two weeks ago and he has Asteroids up with sound, scoring, asteroids and ships.

6 years and counting and you still don't even have your astrosmash clone up and running with sound or much else.

 

Well, I take that back. Your ship does go left and right so I guess there is some progress.

I'm only jesting...  I know you don't have time to work on your video series.  Shoulder Blade can be a addicting

 

 

I think we have a new teacher in town guys.

Dude, I am new here and I even find that in poor taste.

We are a community of like minded enthusiasts trying to enjoy what little we have so positive support or just don't say anything please.

What good does it do to bum someone out.

 

BTW, people do have lives.

 

Me personally I would rather play with my kids than to program my Coleco games 24/7 and I have yet to see deadlines or promises made on a single video Tony has made.

 

So again, please, positive reinforcement for our developers.

Link to comment
Share on other sites

On 11/5/2020 at 5:43 PM, AnalogKid said:

About two weeks ago I decided to try writing my first arcade port for the Colecovision so I looked around for a title I thought should be available for the standard console and landed on Asteroids.  Yeah, I dove in the deep end ?   After getting past the learning curve of using the library SDK and relearning C, which I haven't used in 20 years, I came up with something that I think demonstrates how powerful and underrated the console really is.  At its most intense, my port of the game has 21 independent sprites moving in their own directions at their own paces with animated explosions of different rates and all sound channels filling the room without any lag or jitter.  The console could easily support a few more asteroids on the screen but I coded to avoid the dreaded 4-sprite-per-line issue.  Anyway, here's my initial proof-of-concept demo:

Starting out, round one

Bring it on!

 

Not too shabby for a 3.5Mhz Z80 with 1K RAM running C based code.  Well done Coleco


btw if anyone out there is coding in C and could use some tricks for having a large number of characters with independent pacing, I'd be happy to share

Very nice! When it gets close to done, I would have it checked on CoolCV, ColEm and the Phoenix as well as the OG ColecoVision for compatibility.

Link to comment
Share on other sites

  • 2 weeks later...

Fantastic port.

Observations......

 

Hyperspace missing

Thrust animation from tail

 

The most important aspect that made Asteroids Asteroids.
The dant dant dant dant that became faster to raise your blood pressure forcing you to make mistakes.

 

I could nitpick but no one said it was going to be an exact clone.

 

Now this makes me want to put together an asteroids type controller to play.

 

Also, feel free to share the source code.....?

Edited by Itchy Scratchy
Link to comment
Share on other sites

Actually I did code hyperspace though it's not obvious so I should have mentioned.  I put it on the "1" keypad key so you really have to mean to hit it  :)   I also was nice and checked for a clear landing spot, the same way I have it check for a clear spot before restarting after your ship is hit.  I also made the UFO not shoot you the instant it appears from the edge, one of those little things that pisses me off, like the spider in Centipede that is aimed exactly at your player's gun...  I'm not out to steal your quarters.   I was increasing the pace of the "Jaws" music but yeah I too was feeling like it wasn't enough.  I'll add a couple more steps.

 

One change I definitely see me doing is doubling the number of ship angles.  When the play area is small, like in Omega Race, you don't really notice how lame 16 angles is.  When you're unable to shoot an asteroid halfway across the screen because it's in your blind spot, that's pretty atrocious.  
 

I do plan to share the framework I came up with as I think it may be helpful to people tackling the coordination of a lot of characters with different speeds and directions.  Also I found ways to eliminate as much math as possible which is what the Z80 really wants.  

 

However, at the moment I'm halfway through coding Missile Command and also started a racing game because I feel like there aren't nearly enough games using the steering controller and of those that there are, well, some of them treated the steering wheel like it might as well have been a joystick or an Atari paddle controller.  As for Missile Command, today coded the mushroom cloud animation and blew up my first city, added collision detection and shot down my first missile, and added the dreaded MIRV split.  

  • Like 5
Link to comment
Share on other sites

Very nicely done. I've wondered if you have implanted sub pixel positioning for the ship.


One of my very first Colecovision game I programmed was Computer Space.  My routine for the 16 pulsation looks like,
 

void ShipAccelerate(){
if (rotateme>=0 && rotateme<=15){projy+=-4;}
//if (shipr==0){shipp=0;}
if (rotateme>=16 && rotateme<=31){projy+=-3;projx+=1;}

if (rotateme>=32 && rotateme<=47){projy+=-2;projx+=2;}
if (rotateme>=48 && rotateme<=63){projy+=-1;projx+=3;}
if (rotateme>=64 && rotateme<=79){projx+=4;}
if (rotateme>=80 && rotateme<=95){projy+=1;projx+=3;}
if (rotateme>=96 && rotateme<=111){projy+=2;projx+=2;}
if (rotateme>=112 && rotateme<=127){projy+=3;projx+=1;}
if (rotateme>=128 && rotateme<=143){projy+=4;}
if (rotateme>=144 && rotateme<=159){projy+=3;projx+=-1;}
if (rotateme>=160 && rotateme<=175){projy+=2;projx+=-2;}
if (rotateme>=176 && rotateme<=191){projy+=1;projx+=-3;}
if (rotateme>=192 && rotateme<=207){projx+=-4;}
if (rotateme>=208 && rotateme<=223){projy+=-1;projx+=-3;}
if (rotateme>=224 && rotateme<=239){projy+=-2;projx+=-2;}
if (rotateme>=240 && rotateme<=255){projy+=-3;projx+=-1;}
if (projx>=49){projx=48;}
if (projx<=-49){projx=-48;}
if (projy>=49){projy=48;}
if (projy<=-49){projy=-48;}
}

And I applied the movement to the ships every 3 frames to get around doing subpixel position.  If I have done this today, I would use tables and divide by 16 verse rotation.
 

On 11/8/2020 at 1:05 PM, youki said:

Are your Asteroid all sprites?

I think Asteroid would be very hard to do without sprites.  Vector to background with the slow VDP with nmi corruption issue would be issue.  Challenger I did was mostly sprites.  Only the bonus bug was the only bg object.  The game run at 20 fps due to software collision detection 6 shots vs 16 objects(doing 2 shots vs 16 object per delay(1);).

Link to comment
Share on other sites

3 hours ago, Kiwi said:

I think Asteroid would be very hard to do without sprites.  Vector to background with the slow VDP with nmi corruption issue would be issue.  Challenger I did was mostly sprites.  Only the bonus bug was the only bg object.  The game run at 20 fps due to software collision detection 6 shots vs 16 objects(doing 2 shots vs 16 object per delay(1);).

 

Of course not for all  asteroids but just some of them.  Or use char for the ship. 

Or work in "bitmap" mode and use a mix of software sprites and hardware one.

It would avoid to some flickering. 

 

I have checked , it is all sprites. And the flickering is really acceptable.

 

I have just been surprised about the size of the rom , it is very big for this kind of game.

I would expect more something between 8k and 12k .  Here it is 23k , i think.

 

anyway very well done and fun!! :)  I love it.

 

 

Link to comment
Share on other sites

On 11/18/2020 at 8:35 AM, AnalogKid said:

It has been confirmed that it runs on an un-modified console.  I haven't heard back about the Phoenix yet.  

I can confirm it works on Argon. Very nice!

 

Explosion animation is great.

UFO flickers a bit.

With pixel smoothing on, it almost looks like a vector game!

Red flash when you die is a nice touch.

If you pause the game (via "*"), the sound continues (I'd expect a <PAUSED> graphic on screen?)

Hmm... I think that * is actually a bug - I was unable to resume play after hitting *

 

For the title screen/game selection, it would be nice if you had a menu that you could navigate with directions/fire buttons, as that is more convenient from a modern game controller (but we do have a metapad in Argon that lets you pick numbers)

 

Screenshot_20201119-123619.thumb.png.83173d731f4eadc846c3d70ccf6511bf.png

 

Screenshot_20201119-123901.thumb.png.8c89f48ed380e98628c25c644526bd90.png

Link to comment
Share on other sites

Some more feedback...

 

  • Love the font for the score
  • I'll mention again that I love the red flash when your ship is destroyed
  • Feature request -- keep a high score for each of the skill levels
  • Is there any way to get back to the title screen at the end of a game?
  • Would be cool to have some music on the title screen (and could also show the high scores there)

 

Link to comment
Share on other sites

Yeah I added the red flash because I was thinking of ways to really distinguish the ship exploding.  The sound effect is louder and longer and the explosion animation is slowed.  I like games adding extra animation when a character is hit by an enemy because it makes the loss more impactful.  There's one game, I think it's one of the Mario ones, where the character falls over backwards and a little halo appears over their head... fantastic.  I also like games that vary the effects, the sounds and the animations, to avoid monotony, and Asteroids is full of randomness so I did the same.  I was limited to two explosion sounds but I also varied the explosion animation speed.

 

Getting back to the title screen is actually the standard "#" keypad button, but maybe I should throw up text along the lines of * to restart and # to select level.  btw keypad 1 is hyperspace and * pauses


Keeping a high score isn't possible between power-offs/resets (with classic CV hardware) so the best I could do is track them for a session

 

I was planning to add music to the title.  I haven't decided between original music or picking some space-oriented music.  I had thought of using 2000 Light Years from Home on a loop though it might be too obscure for the kids :)  Astronomy Domine or Interstellar Overdrive would definitely be too obscure.  Maybe a tribute to the Star Man, Space Oddity

Link to comment
Share on other sites

On 11/19/2020 at 12:04 AM, Kiwi said:

Very nicely done. I've wondered if you have implanted sub pixel positioning for the ship.


One of my very first Colecovision game I programmed was Computer Space.  My routine for the 16 pulsation looks like,
 


void ShipAccelerate(){
if (rotateme>=0 && rotateme<=15){projy+=-4;}
//if (shipr==0){shipp=0;}
if (rotateme>=16 && rotateme<=31){projy+=-3;projx+=1;}

if (rotateme>=32 && rotateme<=47){projy+=-2;projx+=2;}
if (rotateme>=48 && rotateme<=63){projy+=-1;projx+=3;}
if (rotateme>=64 && rotateme<=79){projx+=4;}
if (rotateme>=80 && rotateme<=95){projy+=1;projx+=3;}
if (rotateme>=96 && rotateme<=111){projy+=2;projx+=2;}
if (rotateme>=112 && rotateme<=127){projy+=3;projx+=1;}
if (rotateme>=128 && rotateme<=143){projy+=4;}
if (rotateme>=144 && rotateme<=159){projy+=3;projx+=-1;}
if (rotateme>=160 && rotateme<=175){projy+=2;projx+=-2;}
if (rotateme>=176 && rotateme<=191){projy+=1;projx+=-3;}
if (rotateme>=192 && rotateme<=207){projx+=-4;}
if (rotateme>=208 && rotateme<=223){projy+=-1;projx+=-3;}
if (rotateme>=224 && rotateme<=239){projy+=-2;projx+=-2;}
if (rotateme>=240 && rotateme<=255){projy+=-3;projx+=-1;}
if (projx>=49){projx=48;}
if (projx<=-49){projx=-48;}
if (projy>=49){projy=48;}
if (projy<=-49){projy=-48;}
}

And I applied the movement to the ships every 3 frames to get around doing subpixel position.  If I have done this today, I would use tables and divide by 16 verse rotation.
 

I think Asteroid would be very hard to do without sprites.  Vector to background with the slow VDP with nmi corruption issue would be issue.  Challenger I did was mostly sprites.  Only the bonus bug was the only bg object.  The game run at 20 fps due to software collision detection 6 shots vs 16 objects(doing 2 shots vs 16 object per delay(1);).

Actually my trick was to avoid using 360 degrees of angles, but rather a 0 to 16 "angle index" that maps into motion lookup tables, rotation lookup tables, sprites, etc.  My goal was to remove as much math as is possible and not calculate anything that can pre-determined.  Every time I removed math I saw the game get smoother after I cranked the on-screen asteroid count up to 20 and on-screen shot count to 3.  There can be a total of 26 characters in motion on the screen so I was definitely "racing the interrupt".  For the sub-pixel motion, again I used lookup tables.  I flip-flop a variable that tells the code which table to use, so for instance for a 22.5 degree angle, for every cycle I add 1 to the X and every other cycle I subtract 1 from the Y.  Yeah it's a rough approximation but floating point must be avoided at all costs :)   I'm working on Missile Command and I have to find the fastest possible atan approximator because I can see the game stutter slightly from that single calculation (I'm using a lookup for cos and sin)

Link to comment
Share on other sites

On 11/19/2020 at 3:52 AM, youki said:

 

Of course not for all  asteroids but just some of them.  Or use char for the ship. 

Or work in "bitmap" mode and use a mix of software sprites and hardware one.

It would avoid to some flickering. 

 

I have checked , it is all sprites. And the flickering is really acceptable.

 

I have just been surprised about the size of the rom , it is very big for this kind of game.

I would expect more something between 8k and 12k .  Here it is 23k , i think.

 

anyway very well done and fun!! :)  I love it.

 

 

A large portion of the ROM size came from the data: sprites for 16 ship angles, 8 shot images, 9 asteroid images, 2 UFOs, the explosion characters, the sound effects, lookup tables, the title bitmap, etc.  The code did bloat up when I started adding AI for the UFO.  That's actually about a quarter of all the code, the figuring out how to avoid asteroids and how to shoot at the ship intelligently.  Had I been able to use floating point calculations it would have been a couple lines to calculate tragectories but floating point is to be avoided at all costs.  The collision detection code is also pretty bulky due to the number of objects to compare and because it's C and all I have is structs, not subclasses, so I can't have a screen object base class or couldn't enhance the sprite class... :)    Also, for the most speed-critical routines, I unraveled loops like an optimizer would and used objects directly rather than references so again, more bloat, but to keep 20 asteroids, a ship, a ufo, and 4 shots animating at the NMI rate, you do what you have to do to make the CPU do as little as possible.

Link to comment
Share on other sites

Release candidate 1 is available for download.  I doubled the number of angles for the ship so the ship is more maneuverable, flight is smoother, and it feels closer to the vector version.  I made the UFO smarter with some quasi-trigonometry but had to work in some inaccuracy because it had deadly 100% accurate aim.  I also eliminated the UFO flicker with a smarter sprite prioritizing algorithm.

 

https://www.dropbox.com/s/jwdj8bcltlsr37c/asteroids.rom?dl=1

  • Like 1
  • Thanks 1
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...