Saturday, April 20, 2024

DevLog001: Parallax scrolling in a game

My attempts at horizontal parallax scrolling turned out to be somehow usable - so why not create a game?

After some experimentation with BASIC, strings, MCODER2, and z88dk, and having some experience with C code, I began rewriting my efforts, gradually adding game-like functionality. So far things went along nicely, the code generated by z88dk doesn't seem to be as efficient as that generated by MCODER2, but good enough to create some fast loops, esp. for graphics. The huge advantage of z88dk and C code is its usability - meaning you're using ASCII text files in a Linux environment, with all its proven tools like vim editor, git version management, diff, make, networking, etc., and you have all the power of a C compiler, meaning #define, functions, labels, pointers, types, etc., to write proper code. Of course some extra work is required to transfer the results of a Linux cross-compiled C program to your real ZX81 machine - but during development, using an emulator, the workflow and turnaround-times are amazingly smooth and quick.

A title screen with instructions / info

Creating graphics on a ZX81 is always a bit of a peculiar challenge, unless you're a very experienced machine code wizard, able to use hi-res graphics. The fixed character set doesn't give you much to work with, but when time and motion is added, the illusion of a "big" arcade game is actually quite enjoyable. 

So currently this little shoot-em-up game-thing is called "Nemezys 2081", has pretty much the parallax scrolling as shown in the BASIC/MCODER2 tech demo videos, and you can actually do something with it: move around and shoot a bullet! :-)

Game screen: ship, enemy, bullet - it's a shoot'em-up!

I have a ton of ideas that I'd like to put into the game, but I also have zero idea if it'll work out. A C compiler potentially generates more code than strictly necessary, and CPU cycles are tight on a ZX81. But it's great to just add features and see the progress, even if memory runs out, or it becomes just too slow - it's a fun learning experience, thus a win-win situation in any case. 

* * *

Thanks for reading, see ya next time!