Digital 80’s III: Home Computer Programming for Fun and Profit
Päivitetty: tammi 7
Prelude: Saving Knight Arthur
Friday the 20th of November this year was a special day for me. Due to a series of lucky coincidences I now have a chance to return to an old home computer game project. The game is called ’Little Knight Arthur’, it was originally developed from fall of 1985 to early 1986. Its target platform? None other than the good old Commodore 64.
With the support from the Finnish Game Museum opening in Tampere in 2016, and with awesome skills of specialists from Kasettilamerit, a group of friendly retro-spirited people who have transferred countless kilobytes of data from obsolete and arcane storage media to current computers for proper archiving, the full master of Arthur C64 game was retrieved from my 30 year old floppy disk and I got a brand new copy of the old files onto my USB stick.
You can take a sneak peek at the gameplay from this Youtube video, kindly recorded by Dome.fi.
Little Knight Arthur (Commodore 64, Machine Code, 1986)
As you can see, the game is rather difficult, but hey, have you tried other platform games from that era? Manic Miner, Lode Runner, Tales of Arabian Nights, Monty on the Run, Hunchback, Thing on a Spring, all games requiring some zen-like concentration combined with relentless reflexes. If you know those games, you have some idea how unforgiving the gameplay in Arthur C64 is. Well, may be even little more unforgiving than those other games...
Since the game is complete, I’m planning to release it on this blog, for anybody with Commodore 64 or compatible emulator to play. But now, let me take another walk back down the memory lane, to the year 1984, as that was the year when my little game hero, Arthur (or Arttu in Finnish) was born.
Coding and Competing
In 1984 I was a young, enthusiastic computer hobbyist and had just learned BASIC programming on my first microcomputer, Oric-1 (see previous posts on this blog). My parents had recognised my interest with technology and had subscribed Tekniikan Maailma magazine for me. As domestic computer press had not quite yet started, TM, a magazine that since the 1950s had covered cars, motorcycles, boats, engines, electronics, mechanics, and other popular technology, started articles on microprocessors and home computers. I remember that TM had specialised supplements for various topics and one of these was home computing.
In February issue, a home computer programming competition was launched in TM, by Eskoensio Pipatti, an editor who would later become editor-in-chief for a number of well known computer magazines in Finland. I was very fond of platform games, also chronicled in this blog. So I decided to participate in that competition with a platform game that I was working on, drawing inspiration from number of existing games, most notably Donkey Kong, Jumpman, and Hunchback.
The design of the game started when I drew, pixel by pixel on a graph paper, my first ever original game protagonist, a little cartoony knight in cyan armour. Cyan, because that was one of the colours in the pretty limited colour palette of Oric-1. There were total of 8 colors: black, white, red, green, blue, yellow, cyan, and magenta. Really primitive and primary, but that limited palette is part of the charm of old 8-bit era computer graphics. Arttu had just single color, since Oric-1 text mode could only use one foreground and one background color per character drawn on the screen. And, as was very common in platform era of that time, the background color was chosen to be black to give the best contrast .
Arttu, the 8-bit hero in his cyan armour from Oric-1, 12x16 pixels, 2x2 Oric-1 6x8 bitmap characters
Making a Character with Character Using Characters
To have enough pixels for knight Arttu, I used 2x2 custom bitmap font characters, each defined with 6x8 bits. Using techniques that I had practiced with my Space Invaders clones and other small programs, I created two frame animation cycles for Arttu, for walking left and right, and for swinging a sword and putting up a shield using two additional font characters right next to the base grid of 2x2 characters. All this was done by writing and combining small subroutines in BASIC. Once I got Arttu prancing around the screen I constructed the game environment where the action was taking place: a castle that was built by replicating a single stone tile font character to form walls, floors, platforms and corridors.
When I had the castle, and basic walking movement, it was time to add code to check if there were floor tiles underneath Arttu. If not, I would have the code drop him through gaps in the floor tiling until there was again at least one stone under his feet. In the opposite direction I created a jumping procedure that would move Arttu up to the floor above the current one and one step forward, so that he would not drop back to the floor from where the jump started. All logic for jumping around was about the simplest possible.
Perils, Enemies, and Programming Flow
Now I was completely immersed in the flow of game programming and having a great time figuring out how to add more things to the game. it was time to make playing a bit more challenging. I created the first enemies for the little knight: spiders and snakes as long strings of redefined text characters. I made the strings rotate left and right one character at the time. At the same time, I used again the two-frame animation technique to make snakes wiggle and the spider moving its legs. If the font characters of Arttu and the snake head or the spider wold overlap on screen, the code would now detect it and switch to animation were the hero would die.
To help him survive, I added code to detect if swinging the sword would hit snake or spider, and if timing and position was right, kill the enemy - actually, remove a text substring from the string that was being used to represent the creatures. Each new gameplay feature I managed to get working was really rewarding and kept me coding and adding stuff to the game.
As soon as I had some interactivity, I also added simple sound effects for main actions of the game: jumping, swinging sword or holding shield, and managing to hit an enemy. Again, very simple, but I was quite surprised by how much the sound effects added to the game. Even though the gameplay did not change at all, it felt much more engaging when there were a few sounds enhancing the action. The melodies I used were based on old English and Irish folk songs.
For the final challenge of the game I had an ambitious idea: a massive dragon (that is, 5x3 font characters) that was facing right in the middle of the castle and would wake up and start breathing fire when Arttu reached a corridor that the creature was looking at. It took a while to get right, but eventually I had both the dragon, as well as the shield that Arttu could collect from another end of the castle, working. As soon as the dragon’s deadly breath was released, only quick press of the shield button while facing the flame would save the hero.
Shamrock, the fiery dragon in Arttu (Oric-1, BASIC, 1984)
The more action I added to the game, the more I noticed I was actually playing and testing the game instead of writing new code. I had already noticed that trying to keep the separate subroutines for separate things and then composing the complete game by using these little pieces was the key to make progress without breaking the code that was already working. Typically I added things when it was good time to do so, for example, as soon as I had created sword and shield that could be picked up, I added score display and increasing of score when player managed to get the weapons. Later when I worked on the snakes and spiders killing routine, it was easy to call the score update routine to allow player to score points from the kills.
The game was finalized with an animation of collapsing pile of stones, triggered by hitting a key stone on the top floor. This was ultimate goal in the one and only level that I could fit within the maximum number of program lines allowed in the TM competition rules. I did squeeze in a simple startup screen which just listed the keys player should use for controlling Arttu, a fanfare for slaying the dragon, and a tune that would play synchronised with the game loop.
One level, with multiple gameplay phases in Arttu for Oric-1
After a few more rounds of play testing by my siblings, I decided that my game was ready. I saved it on a C-cassette, and put in an envelope, mailed it in, and carried on. In fact, I did not expect to hear more from the competition before the winners would be announced in a fall issue of TM that year.
I was quite proud of the game, though. I even designed a cassette casing for its master tape.
Do-It-Yourself game packaging for Arttu
(Jipsoft was my own unregistered game label designed to give authenticity for home brew games)
Unexpected Telephone Call
In summer 1984 a key event happened that probably shaped my professional life more than anything before or since. I was working on the hayfield of my parents farm. Hay for cattle was collected typically in the few sunny and hot days soon after midsummer. I remember my father coming to get me from the field to the phone in the house. And yes, those days we still had a good old wired telephone with the curly cord connecting handset to the main apparatus with the rotary dial and a true ringing tone for an incoming call. My dad said that I would need to come to the phone to talk to a person calling from Tekniikan Maailma magazine who had said I had won their programming competition.
I remember both my mother and I were not believing what my Dad was saying at first, but he insisted. I went to the phone and whole thing turned out to be true. It is hard to describe what I felt, but I admit the feeling from this victory was extraordinary. I’m sure most people who have just found their field may have felt something similar. It is a sort of internal recognition that this may very well be what I’m best at, or at least that I have some talent for, therefore and something I should pursue further.
Even more rewarding in this case was that in addition to the price money from the competition, Tekniikan Maailma offered a payment for the rights to publish the program in the magazine later that year. Sums combined would be almost as much as I had paid for my first computer, so with a single BASIC program I had mostly recovered the money I had spent on my home computer hobby so far.
Arttu was published in the computer supplement of the issue #14 in 1984. Here is the first page of the story:
Story featuring Arttu in Tekniikan Maailma 14/1984
From A Hobby To A Semi-Profession
So I had learned that there was opportunity to earn money from computer programming. In my case, it was hobby programs published for the enjoyment of other hobbyists in print form. The magazine publishers and budding computer section editors in Finland had recognised that there was growing audience that would be interested in reading a specialist magazine on home computing. The first two Finnish computer magazines for amateur hackers, Printti and MikroBITTI, started publication the very same year.
I started submitting my BASIC programs for these magazines in the hopes of getting more game programs published. In time, one of my Space Invaders clone games, Galactic Guard, was published in MikroBITTI issue 3/84, and Numberbumber, a computer version of plastic slide a tile game, in issue 9/86.
My final game project worth mentioning for my Oric-1 was still a BASIC program. Again I took the techniques that I had used in previous games, most notably, Arttu, and expanded upon them. The result was 'Huimapää Jake & Kadonneet Luolat' (’Daredevil Jake & Lost Caverns’, hey, clichey, eh?). Jake was only one bitmap font character in size, but instead of one level, this game contained three levels, with different challenges. This time the setting was a cavern where pixel hero would need to collect a number of fruits. But first he’d need to reach a bell at one end of the cave and ring it.
Isn’t it funny that in video games, especially in these early ones, you don’t need any reasons or much explanations or storytelling on why you need to do the things in the game that you need to do? As long as its fun and challenging, and interactive, it is good to go in a video game.
Screens from 'Huimapää Jake & Kadonneet Luolat' (Oric-1, BASIC, 1985)
I think I submitted Jake game to Printti magazine but they did not publish it, possibly because the number of lines readers would have to type in order to get the game into their were just too many. So Jake ended up as another game of mine that was not published until now. If you happen to remember Oric computer, own one, or still have Oric-1 emulator, you don’t need to type the whole program into the computer or emulator to try it. You can find Huimapää Jake as well as Arttu for Oric-1 as TAP files in the files section. If you do try the game, let me know. It tends to be rare to find people that still play with Oric software these days, so I definitely want to hear from you.
Farewell Oric-1, Welcome Commodore 64 - and Arthur C64
Back in 1985, it was time for me to upgrade. I bought Commodore 64 and 1541 diskette drive with the money earned from Arttu and other published programs. Very soon after getting Commodore 64, again by mail order, I started learning how to create programs in machine language instead of interpreted BASIC. This meant programming the computer using native operation codes and registers of its processor directly.
This was much more primitive than using a higher level language such as BASIC. For example, there were no operations for doing multiplications and divisions for floating point numbers or even large integers, one had to write small machine language subroutines to accomplish these feats. If I remember correctly, for the mathematical computations the processor had just addition and subtraction of 8-bit integers with a carry bit, increment and decrement by one, and division and multiplication by two by shifting bits. But, machine code program execution was much faster as time consuming interpreting of BASIC to CPU’s native instruction set was not needed.
Also, one could do really neat things by writing bits and bytes in the right memory locations, as the Commodore 64 had video and sound chips that were capable of better graphics and sound effects than in Oric-1. The graphics chip called VIC had more colors, higher graphics resolution for bitmapped and font graphics — and sprites. Sprites were a special feature of the C64 video chip which allowed large graphics objects be defined and moved on screen independently of other graphics such as texts or bitmaps in the background. Sound chip known as SID was also quite special at the time, it had three independent sound generators and programmable waveforms. Both chips were well suited for game programming graphics and sound effects.
Even more important was the fact that Commodore 64 had a technical manual that was very complete in explaining how to program all these features in the machine language. This manual was called Commodore 64 Programmer’s Reference Guide, and it was hundreds of pages longer than the manual that I had available for Oric-1.
The weeks that followed getting a C64 were similar to my learning BASIC programming with Oric-1, just to the power of two. There were a lots of new things to learn and new tricks to try. Gradually I started to master this new machine. And I had a great goal to aim for with my Commodore: a new and enhanced version of Arttu, with multiple levels and many more enemies, subgoals, and gameplay elements. This time I was programming it directly in the machine code, allowing smooth and fast animation and commercial quality gameplay. The year 1985 went on, I was in high school, and spent my spare time developing Little Knight Arthur. Eventually I completed the game in early 1986.
Arthur C64, 30 Years in Making - Coming in January 2016
Thanks to Kasettilamerit and people behind Finnish Game Museum, In the final episode of my Digital 80’s blog series, after 30 years of waiting in a cardboard box, it is finally time to publish my Arthur C64 game. In its full glory and gore, with all seven levels, all remaining bugs, untuned gameplay, amateurishly arranged music, and all. I’m planning to use a Creative Commons license, and let anybody who is still into some Commodore 64 hacking to play and/or modify the game as they see fit. Maybe someone will find it interesting enough to fine-tune the gameplay, or add some fun features...
While waiting for Little Knight Arthur's Awesome Anniversary and Publishing Day, I have a related project waiting to be started. I’m calling this new project ’Arttu Retrogame*Recycled*Resurrected’ or simply 'Arttu Re^3’. I’m hoping to share this project on this blog very soon.