Matrix Digital Rain on the ZX Spectrum

Some days ago, I decided to take part in the MATRIX Challenge, organized by the Retro Programmers Inside group. The goal of the challenge is to reproduce the well known Digital Rain (also referred to as Raining Code) effect, featured in The Matrix science fiction movies, on 8 or 16 bit machines, using the preferred programming language.
Not surprisingly, my choice fell on the C language, using the z88dk/sdcc toolchain and targeting the Sinclair ZX Spectrum home computer.

The technique I adopted is to initially fill the screen with random characters (at first using system characters and in a subsequent phase designing my own UDGs), making them not visible (black ink on black paper). Then, within an endless loop, I implemented the rain effect by altering the screen attributes memory area. The “drops” start falling at random position and each “drop” leaves a trail with random length. The trail is brighter immediately after the “drop” and becomes darker as the “drop” slides down.

My first implementation of the Matrix Raining Code effect on the ZX Spectrum.

In my next “sprint”, I refactored the code to improve performance and implemented different random speeds for the “drops”. Moreover, I designed some symbols similar to those featured in the movie. Finally, to make it more original, I added the Woman in Red dress. You can watch the result in the video below:

Matrix Digital Rain on the ZX Spectrum, featuring the Woman in Red dress.

I’m glad with the results achieved so far and my Raining Code implementation has been appreciated by the Retro Programmers Inside group members and challenge organizers. However, the challenge deadline is the end of August, so I hope to find some time to improve it further!

Wake up, Neo…
The Speccy has you…

Leave a comment

Your email address will not be published. Required fields are marked *