Wednesday, 13 April 2016

Some Examples of Retro-programming Inspiration from Out of the Blue

Got a message one day from someone from Brazil. Érico had run across some of my videos and mentioned them to some of his mates on a forum for a modern variation of Basic known as GLBASIC. Here's what he said
On a different note, as curiosity, I currently do my games with a variation of basic called GLBasic.Back in our forum, we have a couple tandy color computer users and the subject comes up every now and then. Once we were talking about this mode and how I would like to do a game on this mode on modern computers and we then thought to try it out on a real coco. Matchy did a wonderful semigraphics paint tool in glbasic that would spit coco code and it would work fine on a PC, let me point you towards this: On page 8, you have Matchy´s code for that.I´m not sure you have to be logged to see code or images though. Cheers!  --
The graphics he had created were absolutely amazing.

 A closer look revealed, as he himself mentioned in subsequent e-mail, that the top picture was not really in keeping with the restrictions imposed by the nature of semi-graphics mode 3. There is no attribute clash, for instance, between the orange feet of the two top dudes and the underlying green of the ground. The middle picture is more in line with the quirks of the semi-graphic characters used on the MC-10. You will notice that the feet are surrounded by black pixels, which is the only alternate for any color in one of the 32X16 zones of the screen grid. So I was drawn most directly to that image.

I had been wanting to make a better boxing program than the one I had scrounged up a few years back from the VZ-200/300.  It had been a challenge to convert and I was hopeful that it would be fun to play, but I recall being somewhat disappointed once I had got it working. Here's what it looked like:
I can't recall exactly whether it was the game play or the graphics or both that I found somewhat lacking, but I do recall thinking that something better could be done.

One reason I wanted something better was because I had seen an interesting boxing game on another computer in the MC6847 video chip family, the APF Imagination Machine. Here's what it looked like:
APF Boxing
I remember when I saw these images and also some videos about the APF thinking "Hey I could probably do something like that in regular MC-10 Basic!"

But after seeing Érico's lovely mock-up image of the two karate fighters I realized that something even nicer could possibly be done.  I could make a game with slightly more realism than the clunky boxer figures above, and also supply the MC-10 with a BASIC rendition of the classic martial arts game motif as well.

Making the game was not hard.  First thing I did was fire up my trusty SKETCH program. It is a modified version of  William Barden's "Computer Sketch" program from his book TRS-80 Color Computer and MC-10 Programs. I had modified it to output the screen to printer, which in the Emulator takes the form of an ASCII text file. Then it's a simple task of cutting and pasting the bits needed from the resulting file into Wordpad.  You can use just pieces or even whole screens. You can usually recognize what is there and divide it up into strings as needed. Here's a sample of the kind of output you get from SKETCH:

¯° €€ÿ÷ýý÷ú€ÀÀÀ àç €€€€€€€€€€¯
¯    ðõûÿú€€ÎÍ  àçâ €€€€€€€€€€€¯
¯  À           €€ €€€€€€€€€ ÎÍ€¯
¯ ÎÍ£££££££££££££££££££££££££££¯
¯€ÎÍ            €À          ÀÀ ¯
¯ ÎÍ        ÎÍÀ ÀÀ          ÀÀ ¯
¯£££££££££££ÎÍ££££££££££££££ÎÍ ¯
¯€À€À€€€€€€€€€À      ÀÀ    ÎÍ ¯
¯ ÎÍ££££££££££££££££££££££££ÎÍ£¯
¯ ÎÍ             À             ¯
¯€ÎÍÀ€€€€€€€€€€€ÀÎÍ€€€€€€€€€À€ ¯
¯££££££££££££££££ÎÍ£££££££££ÎÍ ¯
¯ ²                         ÎÍ ¯
¯·»ÐЀ€€€€€€€€€Ð€€€€€€€€€€ €ÎÍ€¯

This is a printout of the screen designed for my KONG program mentioned in my last post.  Here's what the image looks like on the MC-10 screen:
After a while you get used to recognizing the symbols. For examples € is the standard black CHR$(128) character.  You can leave more space around things if you are just drawing single items, which makes cutting things up into strings a little easier.

In the course of using my version of Sketch, I ran across a bug, so I got a little sidetracked for a few days tracking it down and fixing it and also making some nifty changes and updates. I added circle drawing and large text entry. It's just an occupational hazard to get distracted. I have a whole directory on my github filled with unfinished ideas and projects:
I got distracted cleaning up my repository too.

However, it didn't really take all that long to get a working game going. I had to sketch out some variations of the Érico's figures to provide animations for punching and kicking. I don't how well they turned out, but they'll do for now (unless Érico sends my some better variations). The tough part was refining the fighting routines.  It's a very simple game. If you step close enough to your opponent, your character strikes out with a random move and knocks the other character backwards out of the hit zone. That is to say, they get knocked back unless they are already too far back (i.e. with their back against the "wall").  It doesn't pay to push your opponent to the point that his back is against the wall because then both player's just end up equally exchanging blows until the attacker steps back. In other words, the game is about trying to dart quickly into the middle area of the screen, strike a blow, and then hop back before your opponent strikes a return blow. Since the AI of the computer player is randomized, with slight variation according to level of play, it gets more and more difficult to achieve safe blow and retreat in time. The algorithm of the AI is more predisposed to attacking than it is to standing still or retreating at all levels, so basically it becomes more aggressive as you go higher in level. It works pretty well I think.  The computer obviously can be very quick (since its continuously checking whether to attack, stand still or retreat), but you have the advantage of being able to think carefully about when to strike and how much to retreat (two or three paces is pretty much the most you can get). The best strategy is to always try to replay any blows and avoid pushing your opponent into a corner. Other than that its pure reflex speed and ability to button mash with gusto. Here's a vid:

I've slightly tweaked the AI since this video was made and fixed up some other things. For instance, I added multiple randomly occurring grunts from the the two players, instead of distinct one's for each. I watched some videos of real karate competitions, and I would have to say that many of them are darting duels of quick blows and retreats, interspersed with flying kicks.

I would like to thank Érico for sharing his ideas and his experiences as an Brazilian Color Computer clone user. It's nice to see a growing presence in the forums of people from this Brazilian aspect of the Color Computer family. The history of the 8-bit computing phenomenon there is fascinating and quite unique. I've really enjoyed learning about it over the years, including browsing some of the magazines such as the Brazilian version of Input magazine.

Érico also sent me an image of his recollection of a game he had made on his computer. He also described a little how it worked.  Based on his recollection, I came up with another game, which I was able to cram into 10 lines in the hope of entering into the NOMAM 2016 competition, but I was too late for this year.  Oh well, perhaps the "Monteiro Challenge" will make it into next year's comp:
Anyway, I don't know if any of these game are any good as games, but they're sure a lot of fun to program. So if there are any folks out there reading this blog (and I don't know if there actually are), and you have any ideas for games (or other types of programs), then please send them my way.

I was also contacted recently by Matt of of the MC-10 Facebook and invited to join. I unfortunately had to refuse, as I have tried to draw some lines in regard to the number of social media I will use (and types).  He mentioned that some of the folks there are trying to create a better joystick mod/add-on for the MC-10. I told him I would be happy to fix any games to work with it when it comes to fruition. I hope that it does (the Matra Alice had one). But I should have also told him to convey my willingness to respond to suggestions for games from anyone on that group. So if there are any such folks reading this, feel free to send me suggestions by way of this blog, or plain old e-mail and to tell others on Facebook that I am open to such suggestions.

And please, testing my games and sending bug reports or suggestions of any kind will be much appreciated. Although I like making games, I'm not much of a player, so beyond some basic testing, many of them have not been tested to their limits. I'll try to acknowledge any such inputs here. Recently, for example, someone commented on my port of the TRS-80 classic, Atlantic Balloon Crossing, that the way the display worked seemed a little confusing. Notice the list of items at the bottom of the main display. The first line displays the title and the line below it displays the value:

Such an arrangement works fine on 63 character wide screen of the TRS-80 Model 1/3, but is too cramped for the 32 character wide screen of the MC-10. I should have realized this, as I have had lots of experience converting TRS-80 games to the MC-10. Such experience has taught me that there is almost always some way of arranging information using shortened messages, acronyms or taking advantage of the reverse characters available on the MC-10, to convert a display from the 1024 character screen of the TRS-80 to the 512 character screen of the MC-10 without much loss of clarity. So with some prompting from teddybearharv I got off my duff, and cleaned up the display a little more. Very helpful. Thanks teddybear!  And thanks Érico and Matt!  And thanks to Jim McGinely for his video about the gaming on the TRS-80 which inspired my port of ATLBALN.

Here's the updated version of that program:

Next post, some of the tricks used to convert the MAP screen and other graphics from TRS-80 to MC-10.


  1. Great updates Jim! Keep up the good work :)

  2. Thank you. Some more soon on my implementation of Galaxy Trek #2 by Howard Batie

  3. I'm always impressed to see what talented people can do with the resources at hand -- in this case, namely, the semigraphic modes of MC6847.

    As for an idea for a game... A long time ago I saw an arcade game by Taito called Gladiator -- -- where you control an ancient Greek-styled warrior. You have a joystick for moving the warrior left and right, and for moving his shield up and down (or leave it centered) and three buttons for brandishing forth his sword at three heights (head, abdomen, legs). The warrior walks through halls using his shield and sword to protect himself from hazardous objects thrown against him.

    If he fails to protect himself, an object hits his armor, and a piece of it falls off. Another hit on the same point will cause his death.

    Sometimes a new shield or sword will fall to the ground, and then he can grab it, because the old ones can break after a certain amount of blows.

    After some hall walking an opponent appears, and a fight ensues. Opponents get faster and somewhat smarter as the game progresses.

    Eventually the warrior arrives to the end of a level, and then points/bonuses are counted, and the armor is restored. And so on until the finale.

    Overall the mechanics is kind of simple... Maybe it's something that could be transported to a MC6847 semigraphic screen. :-)