Wednesday, 10 August 2022

Darin Andersen's "Dark Castle" (1984)

I ran across a type-in game listed on the "Giant List of Classic Game Programmers".  It was called "Dark Castle" by Darin Andersen and published in Rainbow magazine. I thought that a program that made it to the Giant List from the Coco was worth looking up, as that list seems more disposed to documenting Atari and Commodore programs. It wasn't a game I'd heard of, but I found a disk and cassette version of it easily enough on the Coco Archive.

The original title screen

It had a really neat hi-res graphic title screen, but otherwise everything seemed to be rendered on the ordinary text screen. So I thought I could swap a Semigraphic 4 image and make a version for the MC-10.  I tried my hand at recreating the feel of the original. I think it came out okay.

New SG4 graphic title page

As with so many of my attempts to port old games to the MC-10, I think I stumbled across a number of bugs in the original.  However, it's often hard to be sure that they are bugs or if the programmer was simply satisfied with the way the game played.  In this case, I think it might be a little of both. Until I made the corrections I found it impossible to win the game, or even get close to winning. I'm not a great game player, but I do a lot of testing when porting and after a while, you inevitably get better at playing.  You also have an intimate knowledge of the code to draw on for play strategies. So when it seemed impossible to make progress, I started to suspect that there were serious problems.

I would typically get killed in the first 5 rooms. The most common reason for this was simply waiting too long to use a "healing" spell.  Part of the reason for this failure was that there was no report of your health on screen.  Instead you had to press a key (I changed it to "R" instead of "I") to get a report (i.e. "information") of your stats.  Your "experience" (XP) was always listed on screen, but from what I could tell, it made no difference in game play.  It was simply a kind of score of the number of monsters you'd killed.  It seemed to make more sense for your health to be listed on screen so you could make a better judgement of when it was perilously low and that it was time to hit "H" for a "healing" (a healing spell?).  Otherwise, you had to continuously interrupt combat/play to check your stats, which was annoying.

Main Bugs

The other reason I died so easily was that all the monsters seemed to do the same level of damage (around 15-20), which could kill you in 5 or so hits. This was despite the fact that their stats seemed to indicate a range of power: hit points and damage done and experience gained.  But when I looked at how the damage done variable (D) was included in the calculation of an attack, I saw that it wasn't.  Instead the value used to calculate whether you had been hit, as adjusted by your armour and shield, was used (R).  So if you had a shield (1) and leather armour (2), an RND 0-19 value was generated, then the armour/shield value was subtracted, an a determination made of whether the value was below 12.  If so, you were saved from being hit. So, if you "rolled" a 19, this would be reduced to 16 from your armour adjustments and you would be hit since the value was above 11.  Then the damage done would also be this value.  So in effect the value of damage for any monster could only be between 12 and 19.  Actually, the math had the shield being subtracted from the armor and then the result subtracted from your random 19, which makes it worse for you to have a shield.  I fixed that.

277 '<><><>< MONSTER ATTACK
278 R=(20-0)*RND(0)     Why (20-0)?
279 R=R-(AC-SH)            Why subtract shield value (1) from armour (2-5) before subtracting both?
280 IFR <12 THEN 86      No hit if number is above 12
281 CLS 4
282 ST=ST-INT(R)          Why use the number calculated to hit as the damage?
283 PLAY "O1L255V30CEDV10O3"
284 IF ST<0 THEN CLS0:GOTO 286
285 GOTO 81

And I changed it so damage is determined by the number assigned for each monster type, which is stored in variable D when each monster is selected for an encounter.  So the more dangerous monsters can cause significantly more damage (Vampire and Beholder), but the weaker ones much less (blobs and orcs).

This also fixed a problem with the "hunger" routine. That routine cycles in colour from cyan to yellow to red (extreme hunger) as you move about and fight.  If you are in the red too long, then a value of 3 would be assigned to D and a call made to the monster hit routine. Since that routine didn't use D, but the last monster "to-hit" value (R)  instead of beginning to languish from hunger, you could die quite quickly.  In fact I didn't even realize that the hunger routine was doing this.  Every once and a while, it would just seem like an invisible monster had started hitting me after combat had finished. Now, hopefully, the player will realize that the red "hunger" light needs to be attended to before the player starves to death.

Another difficulty I faced was that you only run across Markets to replenish items every 15 rooms

139 IF RM/15<>INT(RM/15) AND RM<>1 THEN RETURN

This seemed crazy hard. You also had to make it through 45 rooms in total before branching to the final Gem/completion segment of the game, which also seemed a excessive slog.

134 IF RM=45 THEN 300

It is not uncommon for weapons to break, leaving you completely defenseless early on in the game.  Since the monsters travel one-to-one for your moves, if you lose a sword early and have no backup, which is likely at the beginning when your resources are scarce, you're done for.  There is no way to out-distance all the monsters you will encounter until a Market appears in room 15. It seemed unreasonable, so I shifted it to every 5 rooms for a Market to appear and I adjusted the treasure values earned from defeating the different monsters downward by half to help account for the higher frequency.  I also used the "experience" count to improve your ability (slowly) of avoiding weapon breaks (RPGs should reward experience). And when you buy an expensive "teleport" it will not only take you to a Market, but will jump you forward a room.  So hopefully now it won't be quite a slog.  A win should be within reach of an evening's play.  Perhaps back in the day (when software was scarce) the author and others would have accepted weeks of monumental and perhaps forlorn effort.  Perhaps playing for highest experience would have been reward enough when you were competing with friends around a single home computer.

Such reward might have had to be enough because it also seemed that the instructions for the final gem finding game stage were missing.

134 IF RM=45 THEN 300

The instructions begin at line 296 but no jump is made to that number.  So the player would just be thrown into that final game completion sequence at 300 without any hints about what they had to do, including the critical instruction to press "M" to bring up a map of the location of the gem.  So I changed it so that the instructions are shown and I tried to clarify them.  The sequence involves moving your blue dot across the screen while avoiding a spider (red dot).  You must run off the edge of the room in the appropriate directions to move yourself slowly towards the part of the room where the diamond is located.  Again, since the spider dot moves one-for-one for your moves, it will eventually zero-in on you and then keep hitting you until you are dead (you go into the final screen with your strength from the prior stage).  Again, it seemed unwinnable.  So I changed it to the spider moving 3 out of 4 of a random number of 4 for each of your moves.  So if you move carefully and make good judgments about which edges to head for, you can avoid contact.  I also made the position of the gem and the location of each spider random, rather than fixed.

Other Improvements

I improved the checks to avoid overlapping items on the screen such as where the Monster Portal and the Markets appear.

I got rid of all the redundant LET commands.  Tightened up the code and applied speedup techniques (removed spaces, IFTHENIF rather than AND, shortened variable names, removed redundant variables, packed lines, etc.)

I also tweaked the cost of a few items.  Fixed some spelling mistakes.  Added some "hit C key to continue" prompts.  Improved the movement bounds checking.

I added more detailed graphics for the monsters and other items in the rooms and also the player character graphic.  Here are the new monsters I created:


I think these look much better than the simple blocks and dot graphics used in the original.

Final Thoughts

There are probably many other tweaks and changes I have missed discussing here, but the above are the main ones.  I think I have made the game more playable and winnable than the original.  It is still tough.  You have to pay attention to hunger and your strength and make sure to buy enough food and "health" spells to replenish yourself.  You have to make other good purchase choices, such as getting extra replacement swords and bows as soon as possible. Other strategies include avoiding combat and simply heading for the door.  Use bow attacks to avoid damage. With some luck, you should be able to make it to room 20, where there will be a Market, which you can use to get your health maxed and proceed to room 21, which will trigger the final "Gem Room stage."

I think the original game might have been very frustrating.  I am doubtful that anyone ever made it to the end of the full 45 rooms before the Gem stage. And if they did make it to the Gem room, I imagine that few completed the game without the instructions to help them figure out what to do with the "moving dot" before the spider came and pummeled them to death.  So why did the game make it on to the "Giant List of Classic Game Programmers"?  It might have been based simply on the appeal of that super cool title screen!

Here's a playthrough of the fully updated version:





Tuesday, 26 July 2022

Larry Bethurum's 1966 "Bingo"


I have ported a very early BASIC game program from a Dartmouth-style BASIC to Micro Color BASIC for the TRS-80 MC-10. The source code I worked from required a fair amount of debugging to make sure that the game operated properly.  Although the game is noted in the Wikipedia discussion of the early history for video games, it was very difficult to find source code for it using Google.  Simple searches using the author's name and the game title didn't produce any links to source but only details like those mentioned in Wikipedia, such as:
Larry Bethurum, from the Phillips Exter Academy, submitted the BASIC source code of a bingo game to the DECUS user group. Comments in the code suggest the game was written on January 23, 1966 [gamicus.fandom.com/wiki/1966_in_video_gaming]
It was only when I returned to the mention in Wikipedia that I was able to chase down a reference link to the source code preserved on a Net archive site: http://pdp-10.trailing-edge.com/decuslib10-01/01/43,50110/bingo.gam.html

There were some major bugs in the source that would have prevented proper operation of the game:

1580 REM  THIS IS THE SLANT CHECK (M=-1) FOR BINGO*** 
1590 X=F
1600 Y=F
1610 IF B(X,Y)<>0 THEN 1740:REM FIXED ERROR-- CHANGED TO 1740 FROM 1720
1620 X=X+1
1630 Y=Y+1
1640 IF Y<F+5 THEN 1610
1650 IF Y=11 THEN 1700
1660 PRINT"YOU'VE GOT A   B I N G O * * *"
1670 W=1:WW=WW+1
1690 RETURN
1700 PRINT"I'VE GOT A   B I N G O * * * *"
1710 V=1:VV=VV+1
1720 RETURN

1730 REM  THIS IS THE SLANT CHECK (M=1) FOR BINGO***
1740 X=F+4
1750 Y=F
REM 1750 LET Y=X (THIS SEEMS TO BE AN ERROR)
1760 IF B(X,Y)<>0 THEN 1880
1770 X=X-1
1780 Y=Y+1
1790 IF Y<F+5 THEN 1760
1800 IF Y=11 THEN 1850
1810 PRINT"YOU'VE GOT A   B I N G O * * *"
1830 W=1:WW=WW+1
1840 RETURN
1850 PRINT"I'VE GOT A   B I N G O * * * *"
1870 V=1:VV=VV+1
1880 RETURN

The highlighted errors would prevent the program from jumping to the "slant check" for Bingo (bottom left to top right corner) at line 1740. And the error within that routine of assigning Y=X would have then prevented that routine from operating correctly even if it was jumped to.  Also, the search routines for the other directions used many jumps from out of uncompleted FOR/NEXT loops, which might not have caused problems on the original platform (some kind of DEC minicomputer) and BASIC, but put the Micro Color BASIC on the MC-10 into conniptions.  So I also had to change all those search routines so that proper exits from those FOR/NEXT loops occurred.

When the player chose to "play again" the program returned to a point at the beginning which involved re-DIMing already dimensioned arrays, which causes an error in Micro Color BASIC.  It also did not not zero certain variables like the win checks for each player stored in V and W or RESTORE the READ pointer for re-reading data. The original version of BASIC might have done this automatically, perhaps when re-dimensioning occurred, but in Micro Color BASIC, the process of re-starting had to be fixed to prevent these problems.  

It is possible that some of these bugs may have prevented users from having a particularly happy experience with the program, which might explain why there is so little record of the game on the Net today.  Or these might just have been bugs that entered into the program in the course of someone typing it in from the DECUS newsletter in which it was originally published.

The game was originally written for a system that would have printed its results on paper.  The program makes reference to "Dartmouth" as the location from which the program is being run which seems a reference to Dartmouth College, the original home of BASIC.  So it seems likely that the program was originally meant to be run on a Dartmouth BASIC time-share system using a printer as the primary output device. This would have prevented anything in the way of dynamic interaction between the user and the program. In effect, the program simply runs a virtual game of Bingo, which the user was encouraged to follow along with using "a pencil" and the printout of the two cards (the user's and the computer's).  The user is told to mark both their own and the program's card. Then the program would declare (and print) the winner at the end. So in the course of my debugging I decided to add some new options to increase the challenge of the game in keeping with its new 8-bit home computer environment.

I added MC-10 graphics around the bingo cards.  I added a display of the numbers on the cards being marked in reverse video.  Then I decided to add an arcade element.  The user must spot and "mark" the numbers of their own card under the constraint of a time limit. This was meant to recreate the tension of real Bingo players trying to keep track of all their cards and marking them with their dabbers as the numbers are called.  I added a very minor ability for the computer to also occasionally "miss" marking the number being called when in this mode.  I added a report at the end of the game of how many games the player wins and how many the computer wins.  Finally, I added a game level element which simply adjusts the speed of the delay for the player to hit the row number (1-5) of the number on their card for the number being called.  If they mess up and hit a wrong number, they fail to mark the number on their card.  The level also effects the degree of possibility that the computer will miss marking a number on its card.  However, if the user selects "no" to the "prompt mode" at program start-up the game will play like the original program.

The source for my version of the program can be found here:

https://github.com/jggames/trs80mc10/tree/master/quicktype/Casino/Bingo

The game can be played on GameJolt. Choose "Play Game" then the "Classic 8-bit BASIC game" menu option.  Select "BINGO" from the cassette menu and then type RUN.

https://gamejolt.com/games/jgmc-10games/339292

Friday, 24 June 2022

Jim Menick's "Draw Poker"

I already posted about Jim Menick's BASIC text adventure game "Space Derelict."  That program was an example program from his book BASIC Adventure and Strategy Game Design (1984). Jason Scott mentions that there was a version of the book for the Apple, but I worked from a scan of an edition for the TRS-80 Model IV computer. I have now cleaned up the scan of his example listing for the "strategy game" component of the book, which is a variation of Draw Poker. The "house rules" for that game are:

  • Each player starts with $100
  • $1 Ante
  • Minimum of (pair of) Jacks for opening
  • 3 raise limit
  • $5 bet limit
I don't know if these are standard rules, or idiosyncratic to this 5 person (including you) computer version of the game. The most interesting aspect of the game is that the other 4 A.I. players are apparently designed with unique playing strategies/styles.  They each have names:
  • Marvin
  • Gerry
  • Walter
  • Betsy
It's a very detailed variation of Poker in BASIC.  It seems to handle betting, passing, dealing around among the players, raising, dropping out, etc.  If you drop out, the other players continue to play without you.  I'm not sure if the players are good players, but they are certainly good enough to beat me and my meagre card skills, including the occasional bluff.  

The program was very large.  I had to engage in another of my monumental "shrinking exercises," which involve the following steps:
  1. Remove all spaces between commands and variables.
  2. Eliminate single command lines and pack multiple commands on lines as much as possible.
  3. Change as many multi-character variables as possible to single letter variables.
  4. Scan the code for redundant/duplicated code and then shift that to a subroutine.
  5. Shrink and streamline messaging, which had to be done anyway to shrink a 80 X 24 game screen down to a 32 X 16 screen of the TRS-80 MC-10.
  6. Omit <>0 references in IF statements.  The variable by itself, if a non zero, can simply trigger the if.
Before any of that could be done, I had to chase down all the typos and bugs from my transfer/typing of the game listing from a digital scan.  There were also some apparent errors in the listing, including a missing line at 28070 with a needed NEXT. This was for the winner determining subroutine. I think it just got dropped from being printed in the book.  There was also a reference to variable S5 at line 2642, which I think should be a reference to S5(X), since there is no other non-array S5 references in the code, and all the other references are to S5(X).  I switched it, hopefully it doesn't break something.

It is strange that there seems to be no preservation of the game on the Net.  Like Frank DaCosta's BASIC programming "How-to" book for the TRS-80, I think the listings were simply too long for many people to have had the fortitude to actually type-in and fully debug the game back in the day.  Perhaps, this coupled with the minor printing errors, simply drove people insane, and so beyond Menick himself (and De Costa), few might have ever obtained working copies of the game.  It would seem that neither author distributed/published working copies of their games by way of other media than in book form for typing-in.

I'll continue to bug test and see if other errors emerge.  I have yet to fully test the routines triggered when players lose all their money and drop out of the game and what happens when the human player runs out of doe.  That will simply take some time of test play.  Of course, if there is anyone out there who wants to contribute to game testing, the 5CARD can be played here (at least for the testing phase):

https://archive.org/details/@james_gerrie

Just select the game from the cassette menu, and then type RUN.

Please let me know if you find any bugs or have any comments on the abilities of the 4 A.I. players.

I got a Full House!


Bug Addendum:

I have been intensively testing the game. In addition to a bunch of problems introduced by me in the process to get the game working and pared down to fit in an MC-10, I've found what I think are some existing bugs in the original program:
  1. There was an error in the routine that examines 2 pair hands to find the highest card.  Instead of looking at the cards in the hand and comparing which was higher, Menick compared the pointer array variable values to the positions of the first cards for each pair. Those values needed to be put into another array holding the values of the cards themselves to obtain their actual values as cards.  Pointers within, pointers within pointers!  He only went 2 levels deep when he needed 3-- easy to do in such a massive program with massive lines of these multiply embedded pointers.    This happens in my program around line 2901 which is a little subroutine I carved out so that it could also be used by the "Untranslated Player hand" routine latter in the program.  I also unpacked some of the "pointer within pointer" analysis to a subroutine to make the lines shorter, since those kinds of lookups happen a lot and have the same general format.
  2. The card replacement routine was really messed up.  If you didn't pick correctly and then simply hit N at the "Replace" prompts, it would realize that you hadn't selected enough cards to replace and take you back to start at the top of your card list again.  But it already had replaced the cards you selected and wouldn't turn them back to what they originally were. It also would not re-wind the cards drawn counter!  This meant that if you repeated hitting "N" and kept "restarting" your selection you could effectively eat through the entire remainder of the deck and blow the lid of the array holding those cards! That would cause a catastrophic "out of bounds" error.  So I revamped and stored your (up to) three selections, and then only change them after you have selected the cards you truly want.  So if you make errors, just hit N until it restarts the process as many times as you need.
  3. There are places where INPUT is used, such as for "Bet?" and ""How many Cards? selections.  But a numeric variable is used for input, which means if you happen to enter a letter, you get a new line and the message "Redo" and then a newline with a new prompt, which would cause the screen to scroll. Needless to say this really messed up the screen real-estate. So I switched the input to use a string variable and then assign it using VAL to the original numeric variable. So if you enter anything that is not a number it just assumes it's a zero.
  4. Minor issue with the game ending.  If you had exactly $1 left at the end it would let you ante up and enter the game with $0.  Then it would keep telling you you were trying to make an illegal bet in an endless loop.  I added logic to terminate the game if you had 0 after your ante.  I also made it so that if you get the pot up to over 480 it reports your "winnings" and thanks you for playing and ends the game. The other players are made to drop out if they have less than $5 each so if you have $500-16 there could be no players left for you to play with.  I don't know how the game would handle only you entering into the actual game play without other players. Menick doesn't seem to have considered this eventuality happening.  I guess he just thought his A.I. players were that good!  Anyway, the game now has a (hopefully) functioning win routine.
  5. This one is not really a bug, but it allowed me to push the memory needs down enough that I had enough space to put back in some of the more elaborate game messages. Menick used three string arrays for presenting the cards: One for holding the card's value, one for the suit and one for these two strings combined for the whole card.  E.g. 7  ,  H  and  7H.  This was done for each of the cards. These arrays were for 40 items each: 5 cards for each of the five players, and then up to 3 cards for each player's replacement cards.  Each time these were changed Menick had to update each of three string arrays: Value, Suit and Combined Value/Suit. The combined Value/Suit would used when a card needed to be printed on screen.  But since they were always changed together it seemed redundant to manage a separate "combined" string.  I just stripped it out and simply printed the Suit and Value strings together in the few places needed. The removal of an entire 40 item string array really freed up space, and broke the back of my memory woes. Menick didn't need to worry about such things since he was programming on a TRS-80 Model 4, which I believe had 128K (and at least 48K for BASIC), and not a measly 20K like the MC-10. Such luxury.
  6. At the beginning of the subroutine that checks for a straight flush in lines 2630-2647 a variable IN(X) is set to 0. Then a check is made after a search is made in the initial part of the routine for a straight to see if the value of IN(X)=1.  If it is then the subroutine is exited and the program moves on. If not, then the values for aces in the hands (14) are shifted to 1s and the whole routine is run again. I can only surmise that this is to check for a straight in the order A1234.  If straight is found for either the first search or second a branch is made to elsewhere. But if the second search occurs, no change is made to the value of IN(X) to indicate that the "second check" has occurred but no straight of the A1234 type found. So the routine just keeps being run in an endless loop. So I added IN(X)=1 after the first check for a straight is made, so that the branch out on S(X)=1 occurs after the second check.
  7. In testing the winning and losing subroutines of the game it became apparent that Menick must not have ever got to that point in his own play testing (or perhaps only on the Apple version).  I created the win and lose conditions by breaking out of the program during the Ante screen, and then changing the banks of each player stored in R(X) and then entering CONT. I was able to figure our that there was something wrong with the dropping out part of the program for "busted" players.  A variable P(X) had to be set to 1 after the "busted" message gets printed, but wasn't. That variable then triggers the awareness that the player is not able to Ante and is also used to prevent printing the player onscreen and skip them for dealing duties, etc.
  8. There was a problem with the routine that reexamines your hand after you make card replacements. Menick didn't re-initialize the variables storing your hand values before re-starting the hand analysis subroutine (starting at line 130). So if you had a hand with 2 pairs, and then selected new cards that left you with no recognized hand type (pair, 2 pairs, 3 of kind etc.) that routine wouldn't find anything to report about those recognized hands, so it wouldn't change the reporting variable, effectively leaving your hand with the type of hand identified from before making your replacements.  So if you started with a pair, and then replaced one of those cards in a way that left you with zilch, it would report that you still had a pair. It's possible that this might be a result of something that I changed, but I tried very early version of my edits of the game (I keep a succession) , and the problem was there, so I think it's original. Menick simply didn't test like I did by entering crazy entries again and again with the emulator cranked to the max speed.  It would be very rare (except for Betsy who seems to be a little rash) for players to smash up their own existing hands and then stay around (bluff) to the brutal end just to lose and see their hand described. They'd normally fold. So it's likely Menick wouldn't have noticed this bug. But by playing many games on high speed I noticed this first in my own hands (I was just replacing cards at random and sticking around to the end to make sure I could see all the hands to check them).  Then I noticed it happen in one of Betsy's hands too.
  9. I changed the annotation of how hands are reported. It now takes the form of "Full House 6's",  "Four T's" or "Three A's" etc. The subroutine at 32000 finds the value of the highest card for 4-of-a-kind and full house hands.  At line 3410 and 3440 I added a S$ before the GOSUB32000-- The S$ stores the apostrophe and S characters printed after the card number of the highest card in the hand. This annotation was missing from the determination of four-of-a-kind hands (except for one instance). The 32000 subroutine (now relocated to 85) would not work unless this annotation was present like it was for Full House hands.  I adjusted the 32000 routine to deal with the apostrophe and streamlined its operation. 
Challenge

What are the different "playing styles" of the 4 A.I. players?  I haven't examined those routines in depth or read Menick's book in detail. I might do. If so, I will come back here and add an addendum to my addendum and let you folks know. Otherwise, if you want to examine the code yourself, it can be found here:

Final updates can be seen here:



Wednesday, 15 June 2022

"Star Command Sigma" by ASCII 1982

I had noticed several screen shots of a game called "Star Command Sigma" for the NEC PC6001. It looked like a BASIC game-- a rendition of the vast family tree of Star Trek games-- But since it was by ASCII, a major software company in Japan from the early days of home computing in the 80s, I expected that it would be especially well done. So when I finally got an emulator working for the NEC PC 6001 and located a huge repository of software, I went looking for it. I was able to list it to a file and get the source code. It was not hard to translate.

I have done other games from the NEC PC-6001 using James the Animal Tamer's Virtual NECTrek PC, which was a short lived North American variation of the PC-6001. The BASICs are similar Microsoft variations and the fact that they both use the Motorola MC6847 video chip makes things fairly straightforward.  The NEC uses LOCATE instead of PRINT@, but I just switch its two X and Y arguments to PRINT@X+32*Y, and get the same results. The NEC has some fancy graphics modes, such as the ability to define a virtual console/window on part of the screen, and some super sound generation. But I was able to translate most of this stuff in a downgraded way. One advantage of the MC-10 is that its screen printing and BASIC generally run faster. There is a speed sacrifice to be paid for all the NECs fancy abilities.

Here are some comparisons screenshots of the game working on the PC-6001 emulator and the Virtual MC-10.  They show some of the differences in how the two computer systems implement the MC6847:

NEC PC-6001
MC-10
The NEC allows all the possible character colour layouts provided by the VDG, whereas the MC-10 can only easily access black on green text. The NEC also has an extended character set with lowercase and special symbols, such the degree symbol (little raised circle), which is used in the game.

You'll notice that the Klingon's are called "KLIMZONs" in the NEC variation. However, ASCII provide a variable for storing the name, so you can easily change it to Klingons. I guess they had to worry about copyright infringement, but they wanted customers to be able to easily switch  to full copyright infringement mode if they desired. You'll notice though that they still use an "E" for your ship (I wonder what that stands for?).

ASCII also embedded some strange characters at the beginning of each of the main menu item titles as they were listed in the DATA statements. These weird characters are processed when the titles are read in and combined in a single variable that reads "by ASCII." I guess they were a little worried about copyright infringement of their own. It's kind of like Bill Gates multiple Easter eggs hidden in Microsoft BASIC, such as in the original Commodore BASIC for the PET, that can print out "Microsoft." If any one tried to pirate the code, Bill could just hit a few keystrokes and reveal the Easter egg message and claim ownership!  I thought of switching it to "JimG2022" or some such, but in the end, it's their program.  If they come gunning for me they can happily sell my version to the massive legions of MC-10 users out there!

The music is a bit of a mess.  First of all I don't read music.  Second, the MC-10 only has a simple SOUND command, and not the fancy PLAY command of the NEC.  Still I have butchered the notes listed in those PLAY commands to get some meagre semblance of the original musical refrains for the intro, win and lose screens. I had to be somewhat creative in the implementation of sound effects, but sometimes the program also used the simpler SOUND command, and in other cases I tried to take clues from the notes listed in PLAY commands.

The scrolling "window" allowed for by the CONSOLE command of the NEC had to be dispensed with.  Instead I went with a system of the top of the bottom half of the screen being used for commands, the middle for messages and help info, and the bottom line for combat messages. No scrolling is allowed.  Instead, as messages roll in, a small left pointing arrow appears in the bottom right corner.  When it does, you can hit a key to skip directly to the next message/event. Otherwise a brief pause will occur to allow the player to read the message before it is replaced or erased.

The game is very feature rich. There are options that I have not seen implemented in any other variation of the classic Super Star Trek game. I wont go into complete detail here, but it is a very well-thought out set of command options that will make for a challenging set of tactical decisions as you try to destroy all the Klingons, Oh, I mean Klimzons. The enemies even occasionally shoot torpedoes back at you, which you can launch a counter measure against using the
QWE
  ASD
   ZXC
direction keys.  The NEC used the STICK command to read a direction from the joystick, but I switched it to this keypad arrangement. Hit one of these keys just after the enemy launches a torpedo (or when the left pointing "continue arrow" message is displayed) and you might get lucky in destroying the incoming torpedo. The enemies even move during combat (and other times) so you will find that occasionally they warp out of the way of danger or new ships can arrive to complicate your life.

Below is a playthrough. I lose. I didn't realize that a feature that allows you to get energy from a star is "paid for" by sucking time off of your countdown timer.  If I hadn't been so greedy (and ignorant of how all the features are interconnected) I might just have won!  See if you can spot the moment of my fateful decision...


While investigating the game I also discovered that ASCII went on to make a fancier graphic character version for the MSX line of computers:



So the MC-10 now has a neat little game recovered from the early 1980s to help it to keep pace with the "big boy" systems of the 8-bit era. I wonder of Mr. Godai (listed in the title screen above) is the same programmer who made the version for the NEC?  If so, thank you Mr. H. Godai for a wonderful game.


Addendum

I modified the title page to make the sigma look more like the original:


I also fixed up some of the more awkward "Engrish" phraseology, such as "Torpedo is breakdown."  I changed this to "torpedo damaged" and modified "Klingon" to plural "Klingons" (etc.) on the status screen.  I still don't know what "Offensive cycle" means and what the number attached to it represents.  It's probably something like "threat level" or possibly, the number of combats you have had with Klingons, or something like that. If anyone has suggestions, I'd appreciate hearing them. Perhaps I'll change it if I figure it out.

I added plurals and gender neutral terms to the status report


Addendum to the Addendum

Curtis Boyle mentioned the program on the Cocotalk web show and commented that it was good to see a nice version of Star Trek on the MC-10.  However, it is actually an addition to a number of other Trek variations that I have ported to the MC-10 as part of my efforts to collect up classic BASIC programs for preservation purposes.  It's not Curtis's fault that he wasn't aware of these wider efforts on my part, although I might have made him feel that way when I made a video to bring these other Trek programs to his attention. I didn't mean to offend (Sorry Curtis).  Just goes to show how much tone is lacking from the quick messaging that forms such a part of digital life today. Much thanks to Curtis for the great job he does presenting the details of the projects and activities of the community. In any case, here's the vid with a run down of some of the other Trek offerings on the MC-10:


For an "all Trek" themed game list for the online MC-10 emulator on the Internet Archive just search on "Star Trek" here: https://archive.org/details/@james_gerrie

Addendum to the Addendum Addendum
Noticed some spelling mistakes in the "Encounter in the Near Tholian Sector" game while reviewing my video. Don't know if those are mine from the porting process or from the original, but in any case I've fixed them up.

Saturday, 11 June 2022

"Kagelien" from Micom BASIC Magazine Aug 1985

 Beware the "ShadowAlien!"


The following is what came out of Google translate when I downloaded and translated the Readme file that came with a program called "multi-game" for the NEC PC6001:

5. KAGERIEN (instructions)
Move yourself in 4 directions with the cursor keys so that you do not hit an enemy or a bomb (*).
Please take all the unpleasant. Enemies and bombs are displayed only on the left screen, and diamonds are displayed only on the right screen. It will not be. If you press the space key when the score is 100 points or more, you will lose 100 points and the enemy's movement
You can pause it. When the score reaches 500 points, one person increases, and after that, 1,000 points. One person will be added each time. In addition, there is a time limit for each surface, and even if this becomes 0, the number of people will decrease by one.
I will. When all of you die, the game is over. 
Restart
In any game, if you press the space key, you can play the same game and return.
Press the key to return to the menu screen.
At the end
At first, I intended to make everything original, but in the end, more than half were transplanted.
It has become. Next, I challenged the limits of N60BASIC !? Send the game I would like.
Reference
Micon BASIC Magazine August 1985 issue JR-100 "Four-handed Kannon" God Warriors, MSX
"KAGERIEN" Hiroshi Uwasawa, July 1987 issue Family computer "Rurumoppe"
Scramble Uko, February 1988 issue PC-8001 "Yanmo STONE" Minoru Yamamoto
<< Table 1 >> Main variables
S ..... Score
T ...... Time, number of times
R ...... Number of faces
X, Y .... Coordinates of the main character
V, W .... Move destination, move direction
I, J .... Loop
A$, D$, A, B. General purpose

My attempt to clean up these instructions resulted in this:

Use WASD keys to avoid enemy "@" or bombs "*", which are displayed only on the left side of the screen. Collect "$"s on the right side. When score is 100, pressing space clears bombs. 500 points = bonus man and after that, 1000 points is needed. There is a time limit for each round. You lose a life if you exceed it.

From what I can gather from the information provided in the Readme file, the game was originally made for MSX computers and published in Micom BASIC Magazine August 1985 (p. 83) under the name "Kagelien.  I think this was a combination of some Japanese word with "alien" since you can see the English word "alien" in the text and the MSX version uses a sprite that is clearly meant to represent an alien figure. The game seems to have been translated in 1988 to the NEC PC6001 and combined with 3 other programs to create the "Multi-game" program.  In the course of that translation the program seems to have been renamed "Kagerien" for reasons that escape me (or this might just be a tanslation error from the Japanese text file encoding). I separated the source for "Kagerien" from the other programs and renamed my version back to "Kagelien." I added a title page reference to the original 1985 Micom BASIC article, since I wanted to credit the original author of the game. However, that author's name is not apparent in the article.  Perhaps I will have my son Charlie try to decipher it from the Japanese characters.  He might also be able to provide something of the back story.

The game is very clever in its use of a split screen to provide greater tension and difficulty in what otherwise would be a relatively "slow BASIC game," although I did manage to speed it up to a point that I could add 3 levels of play using a slowdown loop. The necessity of having to split one's attention between two different screens means that despite the relatively slow movement of the enemy, you can easily become distracted and allow yourself to be killed.  The sound is minimal, but there must be something about the Japanese education system that produces a good level of basic musical awareness.  Most Japanese games I have translated don't just use indiscriminately selected sounds to indicate major in-game events, but always melodic tones.

Here is a video of the game before I renamed the program:


Charlie's Note:

I'm gonna guess the author's name is those 3 characters floating as a pair and a single up in the top left grey patterned area, 上沢   è£•. According to https://culturetour.net/japanese-last-names/uesawa4557 and https://en.wikipedia.org/wiki/Yutaka that's probably pronounced Uesawa Yutaka.

Uesawa(上沢) Japanese Last Name Meaning and Origins

Then that top left paragraph has the backstory: "in XXXX year, a certain astronomer discovered a star covered in diamonds, XX star (Japanese sci-fi is really big on these blanked out names/dates for its settings). A <something> was sent to the planet (probe, mission, colony?). Doctor D, the man who 'developed' the <something> (this word is used in the sense of software, but also of a nation. It might just mean he just develops i.e. works at a facility on the planet?), even though he had a map that could see anything, somehow there was... a shadowy ('KAGE', this is where the name must come from) gorilla-like alien...!"

I wish I could figure out that <something> character. It's a complex character that comes out blurry in the scan.

Addendum to addendum:

Or yea, that something is you. I see that now in the next paragraph. So whatever you are; a robot?

PLAY

The game can be played here under the "Classic 8-bit BASIC games" menu item:

https://gamejolt.com/games/jgmc-10games/339292



Monday, 7 February 2022

"House Adventure" by Anonymous: A TRS-80 Model 100 Game


Similar to my last post about "Space Derelict" I recently converted another interesting and obscure text adventure program, but this time as a response to a request from someone who had wandered into my text adventure page:
Jim, I've got one more random game request that one of my cousins remembers playing. We believe we found the code here - http://www.ifarchive.org/indexes/if-archiveXgamesXtrs80.html. It's under the first section on the page, and is called "House Adventure". Any chance it's an easy one to post for play on your emulator?


I converted this program to Micro Color BASIC from source from the Club 100 Library of text adventures link mentioned above.  As in my conversion of Space Derelict, I ended up making a lot of modifications to the program to make it more coherent. But for this one I also made changes to make it more forgiving/winnable/playable.  I think it had an excessively brutal level of expectation of a player's willingness to restart a game after losing or being put in an unwinnable position. This level was only justifiable in a time when programs were rare and hard to come by. It also simply had some bugs. Both of these reasons were possibly why my contact's cousin had been so frustrated/fascinated by the game to want to return to it all these years later.  But also, there was a swan of a game waiting to emerge, which I think must have also been a part of his captivation. So I don't feel bad about altering this old program from its original form.


It was only after a lot of bug fixing and conversion work and lots of frustrating hours trying to solve the game (using peeks at the code garnered from the conversion process) that I discovered via a comment by Strident on the CASA Adventure forum, that Gaming After 40 had done a walkthrough of the game: "Adventure of the Week: House Adventure (1983?)".  I had already fixed many of the oddities that he also had noticed, but his post put me on to a few more. Here's a list of the main changes that I made (and can remember):
  • I fixed the strange illogical wrap arounds in the map. They didn't seem to add anything to the game play, and if they were there as a way to create a surreal atmosphere it didn't work for me. It just made me feel like there were errors in the map info.
  • I also changed the game so that the player has 60 moves with the flashlight, not just 40, which would allow for a fairer exploration of the basement. Also, if you end up in the dark, you die less quickly, providing you with some possibility of making it out from memory after the lights go out.
  • Bugs relating to floating-point numbers being generated by the random number calls are also fixed.  This and the weird room wrapping makes me think this may have been a botched conversion.  Also, the messages seemed to be formatted for something like a 32 X 16 column screen and not the 40 by 8 screen of the Model 100, which makes me think it may have started life as a TRS-80 Coco program (or possibly for the C64 or Atari game). But I couldn't find anything like it in the 4 Rainbow Adventure books. One thing that speaks to it being a Coco or TRS-80 Model 1 conversion, is that the RND calls typically take the form of N=RND(1)*4-1 for floors (0-3) or magic words (0-3) and N=RND(1)*9-1 for one of the 10 rooms (0-9) on each floor.  On a Coco you'd get such numbers by doing RND(4)-1 and RND(10)-1. There is also one instance of RND(1)*10-1 for random room assignment.  I think the programmer didn't really understand the nuances of Microsoft's various random number generation conventions, which were different between the version of BASIC on the Model 100, and that of the Coco and Model 1. The programmer really shouldn't have kept the -1 in there, since, for example, RND(1)*4-1 would only result in integer values between 0 and 2, thus omitting the last magic word as a possibility. Instead, I changed these references to generate consistent 0-3 and 0-9 ranges where appropriate.  In certain instances, 0-8 was needed, such as to omit the possibility of  assigning monsters to the elevators (room 9 on each floor).
  • I corrected a few spelling errors.
  • Now when carrying the aluminum dime into a phone booth you are guaranteed to be transported to one of the other booths in the house, and therefore notice the magical effect. I think "phone nook" or "phone vestibule" might be a more accurate description of these rooms (old mansions have these), but I left it as "phone booth."
  • You now have a 5 item carrying limit, instead of 4, which means the game is no longer an endless slog of to-ing and fro-ing. You have to keep hold of the flashlight and its batteries (for the basement), which eats two items and later the dime (for using the phone booths to get to the 3rd floor), which only left 1 item space under the 4 item limit. Since you must usually also carry one item to complete a task, and there might be multiple tasks and sometimes multiple items in an area, you would have to make multiple tedious trips into an area just to bring items out after solving a puzzle to gain access to them. Seemed ridiculous, especially when some items (like the batteries) go inside another item.  Even the crazy map wrap arounds made little difference in regard to this problem. In terms of possible shortcuts they might save you one or 2 moves at best.
  • The awkward formatting of the final victory message is fixed.
  • The monsters can sometimes be relocated to the Foyer, which is where you can drop items before getting the key and transferring them outside for your points. Sometimes you can lose simply because a monster gets shifted to the Foyer and then it prevents you from picking up any of the items, including potentially the item that allows you to banish the monster if you didn't notice the monster before dropping that item; or if you carried it directly outside (where items disappear at random). It seems a real shaft that you can inadvertently take items outside and then lose access to them (are people stealing them?) and then realize you need them again because a monster got shifted into a room with another item in it and starts protecting everything there. This forces you to store things in the Foyer, just in case, and then once you do this and are hauling items there (all the to-ing and fro-ing) only to realize that a monster shifted in, and you are now stuck because you have just dropped an item needed to banish that monster.  Also, the fact that the items can create a list so long that they actually scroll the screen adds to this infuriating possibility.  So I added a scroll pause routine when the item list for a room gets long.  But I wonder whether it would be better to simply prevent monsters being shifted to the Foyer. The author certainly seems to have delighted in finding ways to foil the player's (tedious) efforts to collect treasures. 
  • Now the 3rd floor phone booth will always transfer you to another phone booth, even without having the dime, so you can't get trapped on the 3rd floor before getting the dime. This can happen if you get there by discovering and testing out the magical words, which can zap you to random rooms. Text adventures shouldn't just be about meticulously recreating movement patterns learned after continuous arbitrary failures. They should be about figuring out clues and solving puzzles while exploring.
I was tempted to correct the use of a garlic clove to scare the Werewolf away, but I did find a single reference online to Eastern European beliefs about garlic warding off all manner of evil creatures including werewolves. So perhaps this is a clue about the ethnic background of the programmer.  But as Gaming After 40 suggests, this is not "canon" in terms of broader popular culture.  Garlic and sunlight  (and flashlights?) are for vampires, wolfsbane or silver are for warding off werewolves.

I also did a bunch of alterations to the arrays to consolidate them into one single multidimensional array to make the game save feature work on an MC-10.  So if you want to use that feature you will have to use Tamer's VMC10 emulator rather than the online MC-10 emulator, which doesn't support file saving.  Here’s a link to the VMC10 repo:

https://archive.org/download/vmc-10-073-i_202405/VMC10_073I.zip

It contains all the MC-10 programs including all the text adventures displayed on my rare text adventure page:

https://archive.org/details/@james_gerrie?and%5B%5D=subject%3A%22text+adventure%22

It also includes HOUSE.C10, in the JimG directory in the “Cassette” directory.  You can just launch vmc10.exe from the directory that you unzip the repo to and then can play any of the files in the Cassette directory.  Type RUN to launch the game after CLOADing it.

My version of House Adventure should be more coherent and forgiving than the original, but it is still a  tough adventure. I have played it to completion (see the video above--spoiler alert), so I know that it can be resolved. If you need help, then the Gaming After 40 walkthrough on his blog will get you through. He also outlines many of the bugs and weirdness that you need to remedy to get the original program to run on the TRS-80 Model 100.

I'd like to thank my informant for putting me on to the game. Strident and the other archivists over on the CASA text adventure site realized the the game wasn’t catalogued when I posted about it, so his suggestion was helpful for bringing it to their attention.

HOUSE can be tried online here, although you won't be able to use the helpful game save feature (saving is not supported by the online emulator): 

Jim Menick's "Space Derelict" (1984)


Strident over on the CASA Text Adventure archive was doing a little research into Jim Menick, an author of a type-in how-to book "Basic Adventure and Strategy Game Design" from 1984. He mentioned that the book was published for the Apple II and TRS-80, but that there didn't appear to be any playable version of the game on the archive or anywhere out there on the Net. There was also supposed to be a version for the IBM PC Jr. but the demise of that machine apparently took that edition with it.

Strident posted a place to get a scan of the TRS-80  version of the book:

https://archive.org/details/Basic_Adven ... lications/

Garry, another frequent contributor to the Classic forum on CASA and a typer-in and fixer of games, already had the game in progress.  He noted that there weren't any copies of the Apple version of the book available in scanned form online, but that he had started converting the TRS-80 listing into working code.  It was specifically programmed for the TRS-80 Model 4, which presented some problems, as that was a rather unique later version of the TRS-80 Model 1 line.  For example, it had an 80 rather than 64 column screen.

I decided to take a look at the TRS-80 scan, and realized it was pretty clear. Most of the source code listing could be easily copied from the PDF without too many errors, so I undertook to convert it into an MC-10 program. But first I had to get it back into a readable form for its original TRS-80 Model 4 form as printed in the book. For those interested a fairly bug free version can be found (DERELICT1.TXT) on my Github.

https://github.com/jggames/trs80mc10/tree/master/quicktype/Text%20Adventures/Derelict

However, if you want a fully debugged version, it would be better to dig up Garry's conversion.  Also, my version had to condense some of the descriptions in order to get it all to fit in 20K.  I don't think anything critical has been omitted and in some cases the descriptions are perhaps even a little clearer and more elegant (a conceit on my part, I'm sure, but hey, it was a lot or work converting the program).  However, I did make one stylistic change that actually takes a little more space, which was to get rid of all contractions in the robot's responses.  Real robots and Androids, as commander Data teaches us, don't use contractions.

Garry notified me of a couple of bugs from his early notes. "In line 13130, '3180' should be '13160'. In line 6570, '5760' should be '6760'." I had already found the 6570 bug but not the other one. I also found an error in 5950, where it should print the A$(19) message instead of the one listed.  Garry also found another bug he notified me of later on, which  prevented you dropping anything: "In line 6570, '6950' should be '6590'."  I had already fixed this bug in the midst of my rationalization of the code to shrink its size to fit in 20K for the MC-10.

We both ended up tearing out our hair because we couldn't get past one of the first puzzles.  You get fried going into a room in the early stages that you clearly need to get into (you can see into it from a prior room).  Turns out that you have to be carrying a pentagon and a crystal, which together form a telepathic device for opening doors.  You have to "think open" in rooms with locked doors while carrying both items.  This includes the room you get fried going into.  But by using the telepathic pentagon and crystal doors will open (or in the case of that room, disengage whatever safety device that is frying anyone who enters.  In other cases you must "click" the pentagon.

I realized there was a walkthrough provided by Menick on pages 21-22 of his book that describe this, but it was not entirely clear. He also provides a map, with numbered rooms.  To get into room 5 (the frying room) you have to THINK OPEN or SAY OPEN in room 11 (the one where you can see into 5). You have to be carrying the pentagon and the crystal you can get from room 7 (by clicking the pentagon) for this to work. Menick admits in his walkthrough that this "mind trick" is a bit of a devious puzzle, although there are some clues.  For example, when you carry the crystal into the hologram you get a subliminal message saying "THINK HUMAN."  But I think there might be an error with the messaging in room 11. Menick's walkthrough description indicates that the player should be able to LOOK OBJECT and see that the burnt metal thing in room 5 is a fried robot. I think this is supposed to be your warning to stay back, but it didn't work on my version. But I can't be sure if that was a result of my conversion hacking or not.  In any case, I fixed it in my version so that you can LOOK OBJECT and see the fried robot.

Despite its relatively small size as an adventure there are lots of puzzles in this game and (as was typical) more than a few sudden deaths.  Menick tried to provide many synonyms (some of which I had to remove to save space) but there are still a few guess-the-verb situations.  There is a lack of abbreviation for things like INVENTORY and the non-standard directions like NORTHEAST. 

There were a few elements of descriptions that Menick mentions in his walkthrough but which don't appear in the actual game, such as the climbing ropes in the exercise room. They're not in the description, but if you CLIMB ROPE, you die (clumsy robot?).  CUT ROPE will allow you to get piece of rope if you have found the knife, but all this serves no purpose, as the rope element is a red herring.  I added the ropes to the gym description in my version.

It was like Menick was still tweaking the code when it went to press, or perhaps he only hurriedly converted it from Apple BASIC. Strident mentioned that he found biographical info on Menick that indicated that he was primarily an Apple user. This seems likely as the TRS-80 code is quite simplistic, and as a result, a little bloated. It was tough getting it down to under 20K. I had to convert the room messages being loaded from disk, which relied on creating a special data file, and simply make them all into DATA statements.

But on the whole, I quite liked the creepy space derelict story and the robot-at-your-command idea that Menick uses to allow you to explore the ship at a distance. When the robot dies you just get a chilling repeated "END TRANSMISSION" message. The bugs were not of the game breaking type, just annoyances that somewhat spoil an otherwise neat little game. For example, you could press the green button to open the door into the ship without having pressed the black button to close the outer door without triggering explosive decompression. Menick sets a variable AL=1 for when the outer airlock door is closed, but he doesn't use again. I changed that. Now its black before green and you're keen, green before black you ain't coming back. I know the ship has air because there are footprints in dust on the floor and things aren't floating in a vacuum, etc.

The book is a little turgid, but having written some turgid pedantic books myself I'm not going to be overly critical.  And most of the how-to books of the time were like this. The code was very simple, which is perhaps justified for its pedantic purpose. Multiple repeated IFs for everything, including the handling of every movement. I've seen games with 3 times as many rooms and messages but about the same byte count because not all of it was eaten up by program commands (so many IFs!). Still, a neat premise that actually works out well for a little 8-bit BASIC adventure of the time period. However, I think Menick is a better fiction author than an elegant coder, although he gets the job done.  And he does suggest in the book that it is up to the reader to take the programing further.  I think I've fixed most of its annoyances in my version, so I took his advice.

Thanks to Strident for the original suggestion and to Garry for all the debugging tips.

Now I might take a crack at his five person poker game in the second half of the book, which is a demonstration of the "strategy" part of his title.  Converting "Space Derelict" was a fun little exercise in bringing an old program back to life from digital oblivion.  Perhaps his poker program might demonstrate some interesting elements of early AI programming.  He does mention that he tried to give all of the opponents playing styles from different people he actually knew.  I'll keep you posted.  In the meantime if you want to help bug test/try out DERELICT it can be played online using an MC-10 emulator here:


If I can get hold of Menick, I will hopefully be able to arrange permanent access to the program from my site.