Thursday, May 2, 2024

Game: City Patrol (1982)

They're coming! You are in command of a laser-gun equipped ship - destroy as many alien suicide ships as possible!

In the early days, computer games didn't need over-elaborate backstories. Computer means space, space means aliens, aliens means destruction - there you go. "City Patrol", released in 1982, has a simple concept, and is a very exciting game. A stunning graphics engine, and versatile controls, make it one of the best action games for the ZX81.

"City Patrol" title screen

In a side-scrolling view, your goal is to protect the city and its inhabitants from destruction by alien invaders. In order to do so, you guide your ship along the city, trying to hit an alien invader with your laser beam. If you can't get the invading ship in time, he (or whatever "it" is) will reduce part of your city to rubble. But be careful, not only will the invader harm your city's buildings, but your laser will do so, too, in case you miss.

Credits/info screen

"City Patrol" uses an interesting input scheme: Only four keys are required to steer your ship up and down, left and right, set speed low or high, and fire your laser. The trick is: Hold "left" to move left slowly, then press "right" to speed up, and vice versa. Hold "up", then press "down", or vice versa, to fire. (The actual keys are F, V, J, and N.) Additionally, any other key will trigger your laser cannon, too. (Except A, which is used to quit.) That's a bit unusual, but after some practice, becomes intuitive and turns out to work very well.

The full screen, multi layered, side-scrolling game screen...

The graphics are, of course, blocky and crude, just like pretty much all ZX81 graphics. But, as you can see in the screenshots, the ZX81's character set is well suited to simulate buildings in a nice metropolitan "skyline" view. The overall dark appearance gives is a dystopian undertone, which matches the game's idea perfectly, and - a rare occurrence among ZX81 games - even the cover artwork (see end of article) to some degree. When motion is added, the effect is quite spectacular. Programmer Don Priestley managed to create four layers of overlapping full screen parallax scrolling (!), and "City Patrol" redraws these at full frame rate.

Add to that the clever controls with possible high speed movement, big flashes on screen (*light epilepsy warning*), and challenging gameplay, and you get a surprisingly convincing, visceral experience.

...is quite stunning, esp. when in fast motion.

On first sight, "City Patrol" is simple, wild, and a bit confusing. There is a bit of a learning curve. Once you get it, it becomes frenetic and addictive, while still being difficult enough to keep you occupied for a long time. With a little suspension of disbelief, yeah, it really feels like flying along skyscrapers, hunting aliens, and saving people!

Rating: 

It's a bit low on features, but for what it is, it's massive.  

8/10

"City Patrol" (1982) cover artwork

If you'd like to try "City Patrol" yourself, here are possible sources:

http://www.zx81stuff.org.uk/zx81/tape/CityPatrol

https://spectrumcomputing.co.uk/entry/28760/ZX81/City_Patrol


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!



Tuesday, February 13, 2024

Safi's "3D Engine DEMO" (2020) - Doom on ZX81?

Legendary first person shooter game "Doom" requires a little more horsepower than the Sinclair ZX81 has to offer. But then, a VIC-20 can do it, so why shouldn't the ZX81?

Spoiler: So far, "3D Monster Maze" (1981) is still the most realistic first person "shooter" game for the little ZX81. 

But there are some efforts to push the boundaries - one of which is this 3D engine demo by Sandor Safar from 2020, found on his YouTube channel "Safi's ZX-81".

It looks a bit crude, there are no walls, no enemies, no objects to interact with, you can't shoot, not even turn, and there are no maps or levels. But it works! We can move around smoothly in a 3D rendered 2D playfield! :-) The demo is written in BASIC, and compiled to machine code - giving it the speed required for fast graphics.

LISTing "3D Engine DEMO" gives a couple of clues: The BASIC code has been compiled with ZXGT

Obviously, this is just a technical demonstration, far from a "usable" game - but it's still impressive, and, well, who knows, maybe one day we'll play some sort of actual Doom on the ZX81? Also this demo is a great example of how BASIC programmers can create fast programs by using a machine code compiler such as ZXGT or MCODER2.

You can download the .p file and try it on your own ZX81, see video description / link below.

LISTing the "3D Engine DEMO", we can see that the BASIC code is still there, with some information added in the REM statements: It's been compiled with ZXGT (MCODER), and the machine code program starts at address 18823.

To run the (extremely slow) BASIC version, type RUN.
To run the (amazingly fast) machine code version, type RAND USR 18823.

 

Thursday, February 8, 2024

Using a ZOOM H4 digital recorder with the ZX81

The ZX81 has very simple, apparently quirky audio in- and outputs, for loading and saving files. But in fact these are designed to work with cassette tape recorders built about 40 years ago, which are slightly different from modern audio devices.

You can read a bit about the ZX81's audio i/o characteristics if you like - they appear to be a bit unusual on first sight.

Will a modern ZOOM H4 digital recorder be able to handle the task?

The program on the screen was saved to and loaded from Zoom H4.

The good news first: It works! :-D

One or two extra steps are required to handle the main issue with the ZX81's tape ports: low volume. The ZX81's MIC/EAR tape ports are designed for old cassette tape recorders, which handle audio signal slightly different from modern digital equipment. Zoom H4 digital recorder provides enough audio processing functions to make it work.

Saving

Connect ZX81 "MIC" to Zoom Input 1 or 2, and switch that input to high sensitivity. In Zoom's "Input menu", set "Mono mix" to "On" (so you don't have to worry about left/right channels), all other settings to "Off", and turn "Level" all the way up (0 db). 

Saving/recording from the ZX81 to the Zoom H4 will still have only ~50% amplitude - select "WAV" recording format, so you can "normalize" (via "Menu"->"File"->"Normalize") to full volume. (Zoom H4 can't normalize mp3.)

Loading

For loading/playback use "phones" output jack, and near-full volume (~90% or so).

Are there any bad news? Not really. A little understanding of what's going on is required, as are the necessary steps to make things happen successfully, which is really manageable for everyone.

The perfect solution would either require an old cassette tape recorder with built-in recording amplification, if you like the original 1981 workflow, or some sort of hardware amplification to the signals, so no more post-processing is required on the digital recorder. This could be an external amplifier, or a modification to the ZX81's mainboard.

But unless you're a hardcore coder who does constant saving and loading, the Zoom H4 is quite a usable storage device for ZX81 tape port i/o, even without extra circuitry. 

 

Wednesday, February 7, 2024

ZX81 alive Web Directory

A new page has been created, see links on the right (or... somewhere, on your smartphone): ZX81 alive Web Directory - a collection of active Sinclair ZX81 related websites.

Currently there are 21 links, but more to come, and if you like to add your website just leave a comment, or post it in facebook group "Keeping the Sinclair ZX80 and ZX81 Alive". 

>>> ZX81 alive Web Directory

(NOTE: The similarity of facebook group name "Keeping the... Alive" and "ZX81 alive" is pure coincidence. But it is quite fitting.)

 

Tuesday, February 6, 2024

ZX81 alive #02: Parallax scrolling in machine code

A new video of parallax scrolling, with a significant speed increase.

With an upgraded ZEsarUX emulator, and a little bit of newly gained know-how about ZX81 BASIC compilers, a machine code version of the "PARALLAX" demo was created. 

"MCODER2" is an easily available compiler, and basically just two USR calls (via LET) are required to do the compilation. There are a few limitations to what BASIC code MCODER2 can handle, but interestingly it looks as if in this case none applied. (See MCODER2 documentation, and source code in the video.)

Anyway - the increase in speed is quite nice. :-)

ZX81 alive YouTube channel

 

Sunday, February 4, 2024

ZX81 alive #01: Parallax scrolling in BASIC

Yesss! The first ZX81 alive video has been uploaded to YouTube. 

It shows a little experiment in creating some sort of parallax-scrolling 3D view, written in BASIC. Source code is shown in the video. (Well, it's not too spectacular. ;-) )

Maybe an inspiration for your own coding efforts?

Enjoy!

ZX81 alive YouTube channel