Thursday, 7 January 2016

January 2016 Retrochallenge 2: Road Race Ported to Coco and Dragon




Well I've got one more program ported from MC-10 to Coco and Dragon. Took a little longer than it might because I'm using a new computer, a broken-screened laptop from my eldest daughter salvaged by hooking it to a monitor, mouse and keyboard, which runs Windows 10. Thanks Maddie! Had to clean that up and get all my old software installed, including some VB basic macros for MS Word to modify the code from the MC-10 (mostly to put spaces back in where Coco Basic needs them).

Road Race is a program I wrote a few months back. It's your topical overhead race track game. I saw a version for an Atari 10-liner game contest. It had a track which you basically manoeuvred a dot representing your car around while random dots appeared on the track making it harder and harder to avoid a collision.


The game play didn't appeal to me very much (although the sound is very nice), so I wrote a little routine to record all the coordinates of a dot which I manoeuvred around the track I had made, which I then recorded into DATA statements and load into an array at start up. I arranged my trip so that you could add an offset in the X or Y or both for each point and end up with a slightly different "route" for each lap. Then I just replayed each of these with random offsets and starting points for three competing cars. For speed I just randomly choose for each iteration of the main loop from either moving through the array coordinates by jumps of 1 2 or 3. Since I choose for each iteration the average "speed" is about 2 for each car for each lap as a whole. When the cars reach the end of the array a new random offset is chosen and a new lap is begun.

Now my dot was racing against three competing dots going around the track. My speed is similar. My dot either moves by jumps of 1, 2 or 3. Three is really hard, so it's only really good for straightaways. Speed 2 is good for general driving and speed 1 is useful if you need to back off from other cars, because collisions with anything including them or the walls ends the race. The result is a game needing a lot of careful "gear changing" and steering. I hope you like it.  Here's a YouTube video of it. Needless to say, the authentic race car sounds are not coming from my MC-10 but are courtesy of YouTube.


This is my second post for the month long 2016 January Retrochallenge. My hope for my next activity is to move on to the Civilization-like simulation "Ministry..."

No comments:

Post a Comment