Thursday, 28 February 2013

ZX81 Homage and Pipe Frenzy Update

My son Charlie also suggested that I find a way to add a little more challenge and variety to Pipe Frenzy. I have responded by adding a special randomly placed "gold pipe" which you get extra points for if you can integrate it into your pipe network.  When the water reaches this section of pipe it makes a satisfying gurgling sound, and slows the water's progress somewhat--giving you a little extra time to plan.
One question Charlie asked me was why I like to make programs that already exist for the Coco (we have one he sometimes plays games on for a "classic 8-bit" experience of the "olden days" of computers).  My reasons are twofold.  First I simply like to program, and some the classic games provide simple compelling concepts that are easily programmed on a 8-bit computer.  Second, the MC-10 is the machine of my heart, since it was my first computer, and as I tell him, it didn't have then, and still doesn't have now, all the programs (nice machine language game programs) that the Colour Computer has.  I'm trying to fill some of the gaps with the best Basic equivalents that I can make.  I get my inspiration from looking at all the great 8-bit era computers to see if I can find simple game ideas that can be recreated using the special Basic techniques I have developed and learned about over the last few years.  One example is the inspiration I received from a game I found on a ZX81 emulator, which is a variation of the classic arcade game "Scramble."  Here's the ZX81 program:
I have generally found that if a program can be made in machine language or Basic using only the ZX81's simple graphics, a version can probably be created for the MC-10 using only Basic.  Here's my variation on Scramble:

Other ZX81 games that I have found inspiration from for creating MC-10 basic games can be found on the Steven's ZX81 classic basic programming website: http://zx81.reids4fun.com/?action=zx81.  His Basic programs, for example, inspired my versions of Joust and Tower Dodge:

Tower Dodge

I really think what my MC-10 retro-computing programming hobby re-creates for me is some of the magic experienced by the people, like Steven, who were first introduced to home-computing on  machines like the ZX-81 that required the user to learn a bit of programming.  I have tried to pass some of this interest on to my son Charlie, and he seems to have taken it up.  He has developed quite an interest in C, Java and Python programming, which he experiments with using his laptap, which he has "purified" of Microsoft products (This is something we agree to disagree about, as I quite like Bill's version of Basic).  Instead, his laptop has multiple partitions containing multiple versions of Linux and GCC etc.  Way to go Charlie, you are truly a "Master of the Bash!"  And you've definitely helped inspire my ongoing interest in classic 8-bit Basic game programming.


Attack of the A-Holes

Well I've been trying to make my game "Tunnel Jumper" more challenging.  As usual my son Charlie was very helpful through his role as chief "Beta Tester."  He was able to master the game very quickly, and win through to the end.  In fact, it only took him about 15 minutes to figure out all the nuances of the first version of Jumper and then another five to get to level 10.  Based on his experience, he gave me a long list of "improvements."  Here they are:

1. Make the "A-holes" (as he dubbed the alien "A"s) more deadly
2. Make the A-holes "protect" the rare elements 
3. Make the dirt or rock layers less available or thinner
4. Add deadly "lava" to make for more dangers on the screen
5. Add levels of difficulty
6. Add better music and sound
7. Make the levels harder as you progress upwards
8. Have music at the end when you win

I think I have been able to deal with all of these requests.  I've tightened the code and reordered the declaration of variables to increase the speed of the program.  I changed all the prints@s to pokes for the aliens and the player.  This has allowed me the speed to add another alien.  Now you can choose between levels of difficulty.  On level 1 there are 5 aliens, on level 2 there are 6, and on level 3 there are 7 for each screen.  You also can no longer run straight into aliens without dying, although you can still jump on top of them without dying (this can be useful for jumping up to platforms that are usually out of reach).

I didn't add deadly lava, but now I randomly sprinkle red blocks throughout the levels.  These blocks can only be destroyed by a direct hit from your upward digger, so this adds further complexity to choosing where to shoot in order to create workable "stairs."  More red blocks are added on higher levels of difficulty.  Now the amount of blue rock that is laid down is diminished the higher number of screens you complete.  And this is amplified on the higher levels of difficulty.  This means that on higher levels, it is more likely for screens to be created with gaps that can only be bridged by use of spike gun ladders and selective drilling.  So now there is a real need to collect and save these objects for possible use on later screens (Charlie found it easy to complete the earlier version without having to use these special tools).


Charlie used his musical skills to transcribe a snippet of the "Fanfare for the Common Man" into sound statements for the victory sequence.  It only plays if you collect the secret plans, which now appear less frequently (only on level 3 and level 7).  These plans are now displayed as "@" symbols.  I also shortened the timer for each screen before the aliens "gas you," which forces you back a level.  The time limit also varies according to difficulty level.  The higher the difficulty level, the shorter the time delay before you are pushed back.  This really forces the player to move quickly to try to make it to the top of each screen before time runs out.  To create the music, Charlie used the musical score program that I modified from one created by William Barden Jr.  My version allows editing, saving, playback and conversion to sound statements for output to a text file options, to name a few of the additions.  It allows Charlie to compose using a regular range of notes and then to output his work as a string of SOUND commands that I can use in my programs.


I was also able to fix a number of infrequently occurring, but none-the-less annoying bugs. For example in the screenshot to the left you can see the "X" character has been able to drop into the score area of the screen (Thanks Charlie!).  That no longer can happen.  Scoring has been modified so that it is adjusted relative to the level of difficulty.  Rare elements (except for 4 per level) appear under where aliens spawn.

I hope you enjoy the new version for the MC-10 which is available on the Yahoo site.  I hope to have  the code converted to Coco shortly for submission to the Cococoding contest.

Monday, 18 February 2013

New Game Tunnel Jumper



I've made a new platform game for the MC-10 and Coco called Tunnel Jumper.  I'd always wanted to make a platform game, but using VDG low-res graphics characters seemed likely to leave too little room for any really significant action or complex maps.  I was able to address this issue by reverting to old ASCII text graphics.  The "X" is your a character.  It is animated by rotating between the X and Y character, which gives a slight illusion of a man walking.  I've used this character in other games such as "Romp in the Garden."  The character can fire upwards (he has taken some kind of vertical drill from his captors), which destroys three character wide sections of the roof.  This allows the character, using carefully placed shots to carve "stairs", which will aid him/her in ascending through the mine to reach the top.  You can see some examples of such stairs in the following image.

The character can also jump by pressing the up arrow.  The jump is in the last direction of movement, or by pressing the "," or "." keys one can turn, without moving, to face a specific direction to jump next.  The character can scale up to two levels, if positioned correctly.  Sometimes parts of the ceiling will have to be blasted to make room for the arc of a desired jump.  Careful planning is required to carve stairs.  If one blasts incorrectly, it is possible to remove parts of the ceiling that are necessary for carving a path to the top of the level.   Since the levels are randomly generated, it is also possible that some will not provide enough ceiling material to carve stairs to the top.  To mitigate such possibilities you are also armed with a "spike ladder gun" which can create a four character high ladder to aid you in your climb and some drills for selectively removing sections of floor.  Pressing "G" fires the ladder gun straight up 4 characters high.  Pressing "D" drills down one character.  Don't drill too much or you can drill yourself into a hole too deep to jump out of.  You can also resign from a level by pressing "R", which will bump you back a level.  A number of additional drills and ladder guns are sprinkled throughout the mine.

There is a time limit for completing each of the 9 levels, so don't dawdle.  On levels 4-5 you can find copies of the alien's secret plans for destroying the human race.  If you can collect these, you will get a big point bonus.  If you complete all 9 levels of the mine, you also get a bonus.  If you escape and have collected one of the copies of the plans, you save the earth.  If you escape but do not get one of the copies of the plans, you merely save yourself.  Here's the final screen (i.e. level 10):

The game can be found on the Yahoo groups for the MC-10 and the Coco and on my personal web-page.  Any comments are much appreciated.
TRS80 MC10 Club
ColorComputer Group

Friday, 8 February 2013

New Coco Coding Project "Night Blitz"

Okay.  I'm thinking about doing another Coco Coding contest entry.  As usual I'll start by coding it on the MC-10 and then make the conversion to the Coco if it seems worthwhile.  The idea I have is a for a looping plane shoot-em-up, which I'm tentatively calling "Night Blitz."  You will fly a blue plane which can loop and shoot in any of the 8 directions:
The title page will display a UK roundel.  The scenario I am thinking of is the night blitz on London.  The red planes (2-4 of them) will move back and forth across the screen bombing the cyan city buildings at the bottom of the screen.  You, in the blue plane, will have to pursue and shoot down the red planes while avoiding sporadic anti-aircraft explosings (white) and collisions.  You'll score points for each plane shot down.  Here's a sketch of the title screen:
I recently made some changes to one of my older games "Rainbow Asteroids" to try to make it a wee bit faster. I changed the order of the declarations of the variables to put the most frequently called variable names at the front of the list. It should be a bit faster now and a little bit more challenging.  Please take a look at RROID3.TXT in the G-Soft software folder on the Yahoo group:

You can join the MC-10 group on Yahoo at:


Friday, 25 January 2013

Converting Programs from MC-10 to Coco

Converting MC-10 Basic source code to Coco Basic requires paying attention to the following special instances where Coco Basic requires spaces after variable names and the following commands (the version of MS Basic for the MC-10 seems to have eliminated these possible confusions and thus allows complete packing of all lines):
ONT_GOSUB
FORT=D_TO
IFA>B_THEN
A_AND_B
A_OR_B
FORA=1TOB_STEP
All screen pokes have to be changed to reflect the change of the start value for the MC-10 screen (16384) and the Coco screen (1024).  The MC-10 does not have an ELSE command, so all cases of the use of this must be modified.  If the last command of an IF preceding an ELSE  statement is a GOTO, than all one must do is move the subsequent commands to the next line.  If not, then a GOTO will have to be added to jump over this new line. 

I add a routine (10000-10004) to handle the high speed poke of the Coco.  The MC-10 runs its basic programs about 10% faster than a Coco in regular speed, so some of the basic programs I have written really require the use of high speed.  But in other instances, high speed makes them a little too fast.  For the latter instances, I make using high speed optional so that people can use the lower speed as a difficulty level option, or learning mode. Otherwise, the routine (which someone on the Dragon Archive forums kindly gave me--Zephyr?) automatically pokes high speed for the Coco 3, but always prompts for Coco1 and 2s (and Dragons) just in case one's Coco 1 or 2 can't handle high speed. 

Any orange text screen use must be switched from the MC-10's POKE49151,64 to the Coco's SCREEN 0,1. Also, all the peeks to sense the keyboard rollover tables must be changed, because these are handled very differently between the two machines.  Here's the difference between how I continuously sense for key input on the MC-10
20 ONK(PEEK(17023)ANDPEEK(2))GOSUB1,2,3,4,5
These two peeks will return the value of whatever key is currently being pressed on an MC-10 keyboard and then consult array K to branch to the appropriate subroutine for that key.  K is a 255 unit numeric array in which the elements represent the ASCII values and what is stored in those values represent which subroutine to jump to.  Typically the arrow keys get assigned 1,2,3,4 and the space bar gets 5.  On the coco you must consult a sequence of peek locations to check if keys are being pressed and then consult a peek location for the ASCII value of the key being pressed.  For example the following will accomplish the same as the MC-10 code above:
19 ONK(PEEK(135)) GOSUB8,9,10,11,12:RETURN
20 ON1-((PEEK(345)ANDPEEK(344)ANDPEEK(343)ANDPEEK(342)ANDPEEK(341))=255) GOSUB19
In most of my programs the main loop (along with input like that above) is usually located in the 20-25 line range.  So I just have to go and change the MC-10 code for the above.  This is not usually a problem as the Coco allows 256 long character lines (versus the MC-10s 128 character limit) and with the speedup poke's slightly higher speed, no appreciable loss of speed occurs.  I have discovered that Coco 2s with Extended Basic versions  1.2 and above need to have the peek addresses (345-341) in the rollover table poked with 255 before consulting them, as they are not reset when the key stops being pressed.  Even with this large number of pokes, the speed typically only drops back to the level of the MC-10, which was as I said, about 10% faster than an un-double-speed-poked Coco.  I learned about this problem from Zephyr on the Dragon forums and from Arthur Flexser.  Zephyr noted:
The truth is that Tandy modified the keyboard routine slightly for v1.2, and added the following extra code at the start. This was done in an attempt to speed-up BASIC when no keyboard input was required. They quickly realised that this caused problems for existing BASIC software that read the keyboard by peeking the rollover table. The extra code was then removed for the CoCo 3.
Other than such changes, the machines are pretty much the same if one is not using high res graphics or any other Extended Basic commands not available in the MC-10 such as PRINT USING, ATAN, STRING, etc.  But most of these functions can be recreated in Basic.  The old Coco manual "Getting Started With Color Basic" provides some useful subroutines, such as one for ATAN, which I needed when I ported the classic  8-bit astronomy program SKYSCAPE:


Available at:
https://github.com/jggames

The Doctor's Adventure on Scaro: Intro and Program Notes

Doctor

INTRO TO THE DOCTOR'S ADVENTURE ON SCARO

You’re an inveterate tinkerer.  Because you have a Ph.D. in Physics, and also because this is a fact you never hesitate to remind people about, your friends call you "the Doctor."  Because of your advanced knowledge of physics you have managed to invent a time machine.  Using your time machine you have begun to travel through space and time.  Unfortunately, during your travels you uncover a plot by the evil species, known as the Darlecs, to gain control of the entire universe.  They have managed to capture the "Infinity Device" which will allow them to destroy a whole star system, if they should so desire.  They plan to use the threat of this device to extort untold wealth from the other civilizations of the universe.

INSTRUCTIONS

You were in the midst of attempting to recover the device when you were captured, but now you have managed to escape and continue your mission.  You must collect the Infinity device parts (Purple) while avoiding the Dalecs (Red).  Your advantage is speed.  Dalecs are a somewhat sluggish robotic race.  When not actively following orders they tend to shut down into an energy saving mode from which it takes a moment for them to recover.  You can use this to your advantage when exploring their lair.

To move use:
  W                                                    Y
A   S                     OR                 G   H   J
  Z

Pressing space will cast an "energy net" (orange) in whatever direction you were last moving.  When Dalecs run over this net they will be destroyed.  Beware, you cannot cast a net directly onto a Dalec.  You are able to pick nets up by running over them.  You have managed to collect 3 by the time the game begins.  Another 4 can be found at random locations throughout the base.

There are also nuclear reactor energy stations (yellow) spread throughout the complex.  These can be modified to explode spreading a deadly pulse of energy, which will destroy all the Dalecs in a particular area of the complex.  However, they can be tricky to adjust, so you might have to work a little while at getting them to go critical (by running into them).  When they do go critical, a countdown from five will begin.  You have that much time to get to the next area of the complex to escape the energy pulse.

Collect the yellow keys to open the locked doors of the complex.  There are enough keys for all the doors, but sometimes they will be protected by Dalecs. Pressing the 'K' key will display the number of keys you currently have.

After having collected all the Infinity Device parts (12) a message will flash indicating it is time to go to the time machine.  When you get to the time machine you will be presented with your score, which reflects the number of Dalecs killed and other aspects of your skill at getting through the maze.  You will not be able to get into the time machine until you have collected all the parts.  Pressing the 'P' key will display the number of parts you currently have collected.

If you run into a Dalec you die.  If the Dalecs touch you, they will shock you with their electrical prods. You can receive 3 such hits before you die.  Use the Dalecs literal machine responses against them by luring them into different areas of the complex in order to get around them or destroy them more easily.

Don't assume anything about the maze of the Dalecs. Some mysteries and anomalies exist in how it is structured, that you might be able to use to your advantage.

To download the MC-10 version of the game go to:
http://rsp.retrocomputacion.com/games-the-doctors-adventure-on-scaro/
or to the following link for the latest Coco version:
http://rsp.retrocomputacion.com/games-a-romp-in-the-garden-ported-to-cocodragon/


Jim Gerrie, Cape Breton Island, Nova Scotia, Canada             17 October 2012


P.S.
I would like to thank my son Charlie for his contribution of the 8-bit music intro to the game and his work as beta tester and the rest of my family for their patience with my programing hobby activities.


VERSION HISTORY

DOCTOR1.TXT
Preliminary coding

DOCTOR2.TXT
End Game routines

DOCTOR3.TXT
Tweaks to the Maze and bug fixing. Added the ability to call up # of keys and parts.

DOCTOR4.TXT
Fixed rare but major bug in maze read routine involving confusion of variable 'O' and digit '0' in FOR/NEXT loop of that routine. Tightened code of main loops.  Added alternate G,Y,H,J key input.

DOCTOR5.TXT
Fixed a rare problem with key pickup routine, when key is on the edge of the screen between two areas.

Thursday, 24 January 2013


Here is a screen shot from the Coco version of my latest programming production--"PipeFrenzy."  I'm hoping that this is the definitive version.  I have switched the key input to using the INKEY function to make the game a little more challenging.  I have also changed the way the starting and ending positions  are chosen and have added the placement of some random "blocks" in the centre of the screen grid.  I should mention that one change I also made at some point over the last few weeks, is to randomize the direction that water flows when it hits a "T" junction of pipe.  This can be used to a player's advantage.  If you're in a circumstance where the type of corner pipe isn't coming up, you can opt to throw the dice on a "T" junction, which might do the trick instead.

I have found that level 1 is good for getting the feel of the game.   Level 2 is the level I use for regular play, but I'm starting to feel an urge to try to move up to level 3.  Levels above that are probably beyond the ability of anyone to play, but I have left them in with the vain hope that someone out there might find the game interesting enough and challenging enough to work at mastering them.  Pipe Frenzy can be found on my website in the "JGGAMES5.DSK" zip file, which can be found by clicking here:
https://github.com/jggames