Monday, 13 May 2013

"Fest Quest:" Pit With Monsters By Jim Ennes Becomes Something New

Allen Huffman, the videographer and Fest reporter for Glenside Color Computer Club's Annual Last Coco Fest contacted me after the "last" Chicago Coco Fest to see if I might be interested in programming a game based on a Fest motif.  He had seen my port of Pitman and thought that I might be able to create a similar puzzle/adventure game, but somehow using Fest locations  He thought it could possibly be used as fundraiser for Glenside or perhaps to help promote next year's event.  I started thinking about the project, but in the meantime I had been working on another port of a classic game from the ZX81 called "Pit with Monsters" or PM for short.  In this game you are presented with three panels representing left, forward and right, each containing a brief description of a what you see in those directions (see above).  You choose which direction to go based on what you see there and each of the various kinds of structures (passageway, room, door, stairs up, stairs down) has different attributes that influence their optimal navigation (up and out of the pit).  Also you run into a range of monsters (1-100) with varying strengths that you must take account of when you choose to fight them.  You can fight monsters using your strength and weapons, which are all represented by your "hit points," or with magic using your "magic points."  You can find various items throughout the pit that can add to your supply of these different kinds of points.  You can also choose to retreat, but this option has its own dangers.  It is a very simple game in its elements, but they all combine to create a game that is actually quite complex and interesting to play.

The port of the code from the ZX81 went quite well.  The two machines share a 32 column screen, which makes things a little easier.  ZX81 Basic is a little unique, but not overly weird.  The primary difficulty is dealing with the fact that the ZX81 has 24 rows of text, so messages have to be shortened or blank lines removed to fit information into the 16 rows of the MC-10.  This was somewhat simple for PM because many of the messages used double spacing, which could simply be removed (or replaced by the use of my handy word wrap routine for printing messages).  Other than that, it was just a question of removing redundant code, such as repeated IF statements that do the same test but only one operation per IF.  Instead I just use colons.  I suspect that the lack of colons in the source indicates that the ZX81 doesn't allow multiple commands per line.  To save space I pulled together many such lines into single lines of code containing multiple commands separated by colons.  As sometimes happens since I have a "word-processor-eye" view of the code it is easier for me to spot mistakes or minor oddities in the operation of the program that probably eluded the original programmer simply because they were stuck with the clunky line editor and the awkward LIST command.  Once again I came to appreciate EmuCompBoy's VMC emulator with its quicktype of text files saved from WordPad.  A quick change to the source in Wordpad, then type NEW and Enter and then quicktype in the new source code.  Then type RUN and see the results.  Takes about 10 seconds.

As I did the conversion it struck me that it might be nice to use some simple VDG graphics for the three panels, then it struck me that instead of just doing that, I could perhaps simply nudge PM into a slightly different story premise based on the Fest motif instead of monsters in a dungeon.  As usual, I sat down with my son Charlie and we quickly settled on a "battle with geeks" theme.  Instead of "hit points" we would use "geek cred".  Instead of "magic" we would use "floppy trading".  The items would come from the Coco Fests as would the "monsters" aka "geeks", who would, like in the original, come in a range (1-100) of power when it came to their geek cred.  Here are some screen shots of the new game:
I based the various geeks on names mentioned in Glenside newsletters over the years (more mentions roughy higher in the list) and some classic names from Color Computer magazines for the most powerful geeks.

Finally I thought it might be nice to add a trivia component to the game, that would celebrate Coco lore and act as another way of judging the "geek cred" of the player.  I asked people on the Yahoo forums to send me multiple choice questions and a few did, such as Allen, John Mark Mobley and some others.

Allen Huffman Wrote regarding this aspect of the game:
I was actually thinking more about memory usage. I created a simple word tokenizer in C for my day job when I was out of room in a small project, and I think it could be used on the CoCo as well. I wrote a test version in BASIC via Xroar yesterday, and will finish it up and make it available in case it is of interest to you.

Basically, it will scan thought all the strings (from a text file, or from data statements) and then create a dictionary of words, and tokenized strings. I have a method that will be ultra efficient, but not human readable (it would be legal BASIC, but not something you could LIST or type in), and another one that is not quite as efficient but completely typeable.

For instance, it might look like this:

1000 REM Token dictionary
1005 DATA 8,bacon,eggs,and,really,like,i,pancakes,too

Above, that might represent an 8 word dictionary. Then the strings would be encoded and might look like this:

2000 REM Tokenized strings
2005 DATA "FDEACD"

Assume "A" is 0, etc. So that represents those full words. This is a simple example, limited to the number of single characters you could put in a string. If I built those strings mechanically, I could use non-typeable characters and get maybe 128 tokens. But, a decent compromise is to use two characters. Instead of using numbers, which take more BASIC space:

2000 DATA 2,42,3,25,5,1,23,51
It is our shared hope that over this coming year we can add a much larger library of questions than the current 40 (please still send me any you think of), which will likely require integrating something like Allen's tokenization routine.  Unfortunately, this will likely only be available on the Coco version of the program and not the MC-10.

There are several aspects to game play beyond the trivia component. These are a legacy of PM. The object is to explore and gather the right kind of items that will increase your geek cred. Other kinds of items add to your “floppy” supply.  One must learn to recognize the differences between these two kinds of item. The opponents have different levels of geek cred (1-100). If you run into an opponent who has more geek cred than you, they will defeat you. If you have more geek cred than them, then you will defeat them, but you “use up” geek cred to do so (i.e. the amount of geek cred of your opponent is subtracted from your geek cred). So you must sometimes avoid such combat by using floppy trading (at least as long as your “disks” hold out) to overcome more powerful opponents. However, I added the trivia question component as a randomly occurring “save” feature (you only get asked a question half the time when geek combat occurs). If you meet up with someone with higher geek cred and you answer the question correctly, then you beat them no matter how much cred they have, but just barely, so your cred goes to 0.   If you meet someone with higher cred, but flub the question, then you lose.  But if you meet someone with lower cred and get asked a trivia question, but flub the question, then your geek cred goes to 0.   If you battle someone with lower cred, and get the question, you beat them in the usual way (your cred is reduced by the # of their cred).

So, in brief, navigating to the top floor takes a bunch of strategies. You need to collect floppy trading stuff (or equivalents, such as the coco CD or drive-wire cables). You also need to collect other items, which increase geek cred (manuals & cool hardware). You need to avoid combat with people with higher cred unless you feel you have enough floppies for floppy trading  to defeat them, or you are confident enough that your trivia knowledge can save you in geek combat no matter what their cred. You also have to try to keep building up cred and floppy supplies, so sometimes careful exploration of rooms (and strategic retreats) can be more prudent than simply trying to move forward and upward via passages stairs and combat. Use the “s” option to see the status of your cred and floppy supplies at any “what direction” prompt. I should also mention the “q” can be used to start the game over.

There are also some completely random elements of the game that can knock you back down a few levels (the object of the game now is to get to floor 20 of the hotel where the "no minimum bid auction" is going on).  A geek squad can abduct you, or you can accidentally wander into a elevator.  These events add a kind of "snakes and ladders" element to the game.

I will probably post the 40 question MC-10 version soon.  I will hopefully be followed next year with a more full-blown trivia Coco version.  Whichever version you might try, I hope you enjoy "Fest Quest."

Tuesday, 30 April 2013

Retrospectiva Win!


Pablo Roldan of the Retrospectiva Contest has e-mailed and informed me that Penguino has won.  I would like to thank all the people on the various forums (Yahoo, Dragon, Alice) who helped out either by voting, or programming advice over the years.  I'm already looking forward to next year's contest, where I hope to submit my WeatherWar and NightBlitz programs that I have sketched out and started working on (a little).  If anyone out there has any other suggestions for classic 8-bit Basic games they think could possibly be done on the MC-10 (or Coco or Dragon) please let me know.

Wednesday, 17 April 2013

Time to Vote for the Retrospectiva Contest

Okay. It's time to vote in the Retrospectiva Basic Games contest. Please consider sending your support to my entries in the contest: Penguino, Romp in the Garden, Crawl, Doctor's Adventure on Scaro, and Battlbots. The link to the voting site is:
http://rsp.retrocomputacion.com/retrospectiva-2012-voting-phase-basic-games/
Thanks to all those who helped along the way.

Sunday, 14 April 2013

The House of Seven Gables Port

Well I've ported yet another of Greg Hassett's classic text adventure programs from TRS-80 Model 1 Basic to the MC-10.  As usual this required sifting out all the ELSE commands and replacing them with calls to subroutines to process the different branches of the IF/THEN/ELSE.

It also required shortening some lines.  I find the best way to process such long lines is to make my Wordpad Window a size that I know when I have roughly passed the 128 character limit.  Then I just make jumps to subroutines (because Hassett had programmed with very tight line numbering I couldn't simply add lines).

Another quirk of TRS-80 Model 1 Basic is the ability to drop the "THEN" command from IF statements.  Hassett did this quite a lot in this program.  I had to systematically go through and put THENs on all the IF statements.

Finally, I had to switch all the PRINT commands with messages longer than 32 characters to put their message into an M$ variable and then GOSUB my word wrap routine (lines 1-4).  If such messages contain numeric variables, these variables have to be put into a STR$() command and these have to be concatenated with the M$ string using a "+" symbols rather than the  ";" symbol normally used in PRINT commands.

I also had to convert the tape cassette save and load routines.  For the MC-10 the only way to save and load to tape is to use the CSAVE* and CLOAD* commands which can only save and load the contents of a numeric array.  So you need to expand one of the arrays (usually the largest one being saved) to accept any other single variables that are also being saved.  In this case the OB array is the bulk of the saved file data, so I simply expanded its size by 6 elements to contain the 6 extra unique variable elements.  The result is that the original load routine which looks like this:

74 CLS:INPUT"PRESS <ENTER> WHEN CASSETTE PREPARATIONS ARE MADE ";XX$
75 FORI=8TOLO:IFOB$(I)=""THEN77
76 INPUT#-1,OB(I,0)
77 NEXTI
78 INPUT#-1,CP,FF,ZZ,T,P(5,0),DF

must be converted for the MC-10 to look like this:

74 CLS:INPUT"PRESS <ENTER> WHEN CASSETTE     IS READY FOR LOADING";XX$
75 CLOAD*OB,"GABLEDAT"
76 CP=OB(41,0):FF=OB(42,0):ZZ=OB(43,0):T=OB(44,0):P(5,0)=OB(45,0):DF=OB(46,0)

For doing saves you simply reverse the process, so for example ZZ=OB(44,0) becomes OB(44,0)=ZZ, which you do for all the single variables before issuing the CSAVE*OB command.

There were also a number of places where Hassett used FOR/NEXT loops with IF statements that would break out of the loops without completing them.  I don't know if this can cause any real problems, but it strikes me as inelegant. I always take something like this:

10 FOR C=1 TO 10:IF P(C)=5 THEN F=C:GOTO100
20 NEXT
30 ...

And  change it to something like this to make sure FOR/NEXTs are always completed:

10 FOR C=1 TO 10:IF P(C)=5 THEN F=C:C=10:NEXT:GOTO100
20 NEXT
30 ...

If anyone can tell me if such finickyness on my part is pointless I would appreciate hearing from you.
Anyway, as usual all my programs can be found in the Emulator .c10 format at: https://github.com/jggames

Wednesday, 27 March 2013

Scrabble Helper Final Version (Hopefully)


I've released the final version of Scrabble Helper for MC-10, Coco and Dragon.  It can be found on the Yahoo MC-10 group site, the Yahoo Coco site, the Dragon Archive Forums and my own site.  I think I've got rid of most bugs and added all the features I can add, given memory restrictions.  Recent additions include adding a bunch of 2 letter "killer" Scrabble words.  Now the word look-up function ("H") does not just provide a list of the first five words found, but continues rolling over the list of five until you hit a key or until it reaches the end.  If it reaches the end of its dictionary, it then prints a list of the five longest words found.  I got rid of a few lingering proper nouns from the dictionary and cleaned up the display when the game ends.  I also added a total point calculation so that games between multiple players can be assessed in terms of the overall level of competition.  You can also now choose to play as a single player for playing games of "Scrabble Solitaire."  I should mention that the key in the bottom right lists the letters not only in order of ascending point values, but descending order of the number of tiles.  In other words, "E" comes first because the largest number of tiles are "E"s followed by "A"s and then "I"s, etc.

Friday, 22 March 2013

Scrabble Helper Beta


I have a working version of a Scrabble game/simulation for the TRS-80 MC-10.  It's not single player, but with the [H]elp function you can have the computer search for up to 5 word suggestions.  It searches the tiles (or those in front of the left arrow, which is what I call the "terminator" symbol).  It can only search real letters and not "blank tiles."  Its dictionary is about 1750 words long, and includes some of the killer Scrabble words like "aa" (which is a form of scoriaceous lava).  Hitting any key cancels the search.

There are two modes for using the game.  If you enter [Y] to the prompt about "using a real game" you can input the tiles you wish to play.  If you have any blank tiles you will have to bury these between other letters and then re-arrange the tiles to get at the blank tile.  For some reason the INPUT command in basic doesn't take single blank spaces as input.  I have too little time and inclination to do away with this limitation.  If you make a mistake, just have the next player hit [F] to forfeit her turn, and then re-input your tiles.

The other mode is regular play.  You are given 7 tiles from a virtual bag.  When you play tiles, your compliment is restored to 7 from the virtual bag, until the bag is empty.  Once the bag is empty, up-arrow characters are used to fill out your shelf.  These up-arrow tiles cannot be played, so keep them behind the terminator symbol.  The game is completed after six [F]orfeit commands are issued by either or both players after the bag has been emptied.  So, once you both can't make any more words, or someone has played all her last tiles, just keep hitting [F] until the final score card comes up, or hit [*] key to end immediately.  The score card represents the scores of each player after subtracting any tiles remaining on the players' shelves.

Another command is [E]xchange, which will swap any of your letters before the terminator symbol for ones in the virtual bag.  This option only works if there are at least 7 tiles left in the bag.  The number of tiles left in the bag are listed in the bottom right corner of the screen in the score "key" description space, just above the double letter score DLS information.  The key also contains information on the values of the letter tiles and the other bonuses (triple word score TWS, double word score DWS, triple letter score TLS).


Manipulating the 7 tiles and terminator symbol on your virtual "shelf" of tiles is accomplished by using the [A] and [S] keys to move a cursor left and right through the tiles.  It wraps when it reaches either end of the shelf.  You can move any letter under the cursor left or right by using the [,] and [.] keys.  These also wrap at each end.  When you have a "word" you wish to place on the board (the letters in front of the terminator symbol on you shelf) just hit [ENTER] and your cursor will switch to the game board.  Move your cursor to where you wish to begin the word and hit either [D] or [R] to place the tiles down or to the right.  If there are any existing tiles on the board these will be jumped over until your entire word is placed.  If there is not enough space on the board, or if your word is not touching any existing words, or you start on top of an existing tile, then your word will not be placed.  If your word can be placed, your potential score will be displayed along with a prompt "OK?".  Press [Y] to place your word and take your score or [N] to return to the board.  If you hit [ENTER] while on the board, you will be taken back to the shelf.

If at any point you wish to complete the game and have the final scores computed, just hit the [*] key.  See my previous postings for information about the scoring algorithm.  As far as I can see from testing and playing few games with my son, it seems to work.  Please let me know, though, if you find anything fishy, or would like added features.  The beta is called "SCRABBLE13.TXT" and it can be found at the Yahoo MC-10 site:
http://tech.groups.yahoo.com/group/TRS80MC10Club/

Sunday, 17 March 2013

Scrabble Update


Well, I have a somewhat working scoring system in place.  At least I think so.  If any expert Scrabble players out there, for instance, could tell me whether the arrangement of tiles above should work out to a score of 47, it would be much appreciated.

I also have a functioning "tile re-arranging" routine that allows you to move tiles easily and to select the word by moving the terminator character (the left pointing arrow in the above).

What remains to do is to add the multiple player stuff (up to 4) and to design the right hand side of the screen.  I would like to add a little "key" for the different values of the letters and one for the meaning of the colours (i.e. DWS, TWS, DLS, TLS).  I also will add the ability to choose between using the program simply to keep score for a real game and actually playing the game just on the computer.  In the former, you will input your tiles each turn, whereas for the latter, the computer will provide you with tiles for each turn till the virtual bag of 100 is empty.  Which reminds me, I still have to add provision for 2 blank tiles...

I'm taking this project a littler easier than I have of late.  I had quite a rush there for a while getting projects squared away for the Restospectiva and the CocoCoding contests.  Now I'm back to simply programming for the fun of coding.  My wife finds games like Scrabble, Sudoku, and Mahjong relaxing.  I finding making computer versions of such games relaxing.  But playing... not so much.  So if there is anyone out there willing to do a little beta testing like my son Charlie, please let me know what you think of my games.  Critical comments or bug reports are much appreciated.