Monday, 27 February 2017

My first machine code game

My first attempt at a machine code game was called Ball Dozer. It was loosely based on Arkanoid, with a number of screens with different layouts of bricks, and various power ups could be collected such as a laser, a sticky bat and extra lives.

Loading Screen. Colour hadn't been invented yet.
Something that still irritates me is that there were a couple of flaws: There were a limited number of directions that the ball would travel in, as I hadn't yet discovered the art of fixed point numbers, and there was a bug in the collision detection. Very occasionally the ball would do strange things like tunnel through the gap between bricks or glue itself to the side of the screen. Much later I would figure out it was because the logic only took action on the first collision detected rather than take into account all collisions occurring at the same time.

First Level. You know the drill.
Even with the flaws, it sufficiently impressed the owner of Kouga Software (John Foster) to publish the game and I had my first title on the market. It was a surreal feeling seeing my game reviewed in Dragon User. It was awarded 4 out of 5 Dragons. Not bad for a first attempt!

Return of the what now?

Demo title screen
This blog is intended to document some of the process of a game I'm creating for the Dragon 32 and 64 computers and hopefully the TRS-80 CoCo 2 as well. It's called 'Return of the Beast', and is a sequel to a game I wrote in the 1980s called --- wait for it --- 'Revenge of the Alien Bongo Beast in the Criss-Crossy Lines Dimension'. Or ROTABB for short as the novelty of actually having to say all those words wears off pretty quickly. Well, it seemed funny at the time.

Screen shot from demo
There is the hope that this will be of use or interest to others and perhaps answer some questions about the game. I think most of what will follow will have a technical emphasis and talk a bit about the solutions I've used to implement the game but initially I think it might help to set the stage with some background. Suddenly I feel a flashback coming on...

Ancient History

I got my first Dragon 32 for Christmas in 1983. My best friend had one so naturally I wanted one as well and had been nagging my parents for weeks. It was the first computer I had really seen in action and there was something about the games that appealed to me. Games that immersed you in an imaginary world such as text adventures and battleships and Star Trek made quite an impact on a 12 year old.

Each month I awaited the arrival of the latest issue of the official magazine 'Dragon User' with great anticipation. I would read it from cover to cover and spend hours typing in, playing with and customising the reader supplied programs. Soon I would begin to write my own BASIC programs.

Of course, if you wanted to play real arcade games, then you would have to go to an arcade. There were a number of coin-ops that I enjoyed playing such as Scramble, Phoenix, Galaga and Astro Blaster, but the one that really reeled me in was Time Pilot '84. It just looked so sophisticated with its huge scrolling bas-relief background, the freedom to fly in any direction and nifty guided missiles that would home in on certain types of enemies after a targeting lock was acquired.

I tried to capture some of that arcade feel in my own games but there was only so much I was able to do with BASIC. Then one day, I was given a cassette copy of the ALLDREAM assembler with a manual. This included a handy getting started section with simple examples and I was soon up and running and writing my own machine code routines. I was immediately blown away by how fast they ran. Stupidly fast. I had no idea something could go that fast without the wheels falling off. Perhaps I could now write an arcade game...