Mudlark on the River Thames foreshore by day, then hunt vampires at Carfax Abbey by night. A new game written in APL on the Commodore SuperPET for the River Thames Game Jam of September 2023.

Why use an interpreted array language from the 1960s on a vintage Commodore computer? Because APL is fun and easy to learn, and the language’s unique character set can be used to represent mudlarking treasures. Two APL workspaces are used, one for the mudlarking section and another for the vampire hunting section.

The mudlarking main game function ‘G’ sets up an array holding the 23 treasure values with TSET. The River Thames foreshore is then painted with MUD. The main game body loops 200 times, reading and processing joystick input with JOY, with WAVES uncovering or washing away treasures each iteration. JOY moves the player to the Carfax ABBEY immediately upon completion of the mudlarking goal. If too few unique treasures are collected, the game ends.

The main game loop ‘G’
TSET creates an array of 23 mudlarking treasures, displayed at the top of the screen with SHOWT

MUD paints the foreshore, represented by commas, tildes, and semicolons. MUD calls FILL which fills in areas of the screen that MUD doesn’t paint. The sides of the screen can’t be fully painted using strings that are quoted in lines of code, so the right margins are addressed with pokes of the comma character byte to the screen memory locations. The top line of the screen is also painted due to text scroll. Some initial treasures are scattered around the foreshore.

Presenting the River Thames Foreshore
FILL in the rest of the unpainted foreshore area
MUD paints the foreshore

The JOY function checks if user input came in from the joystick or keyboard joystick, moving the player character right, left, up or down. If the player moved, CHECKSCORE will determine if a treasure was collected from the foreshore.

JOY handles joystick movements, or in an emulator, a keyboard WASD joystick

CHECKSCORE peeks at the screen memory location the player character is moving onto, and calls SCORE unless the screen location is a comma, tilde, semicolon or a blank space. SCORE determines which treasure was picked up and adds it to the player’s inventory of treasures, and then checks if ten unique treasures have been collected. If so, the mudlark’s inventory is saved to disk file ‘LARKINV’ and the Carfax Abbey workspace is loaded to continue playing at the abbey.

A technical detail of note when determining how many unique treasures the mudlark has currently collected, FinnAPL library idiom 277 was tried initially, but became noticeably slower as the mudlark’s treasure list increased. Idiom 205 was tried instead and found to be much faster and was used instead.

WAVES is used to sweep away treasures and uncover new treasures. It uncovers one new treasure each turn. Add some code to skip line 5 based on a random number roll if a less generous foreshore is desired.

WAVES covers up and uncovers treasures

The SAY, SAY2 and SAY3 functions display the names of the treasures as they are collected. They map the value of the character peeked at the treasure screen memory location to the treasure names. These could all be written as one long function, but it’s easier to edit when everything fits on a single screen.


Sometimes the player doesn not collect ten unique treasures, and the game ends here in that case.

Only 8 unique treasures

If ten unique treasures were collected, the Carfax Abbey workspace is now loaded, and it automatically runs a latent expression ‘G’ to run the main game loop. The main vampire hunting game body ‘G’ function loads in the player inventory from the save file ‘LARKINV’ as stored in the previous Mudlark workspace run. Then the Carfax ABBEY is painted. The main game loop repeats 400 times, taking joystick input and repainting Dracula’s position each turn.

Main game loop of Carfax Abbey game workspace
Carfax Abbey along the River Thames

HANDLEJOY allows for movement left and right of the player position and for wooden stakes to be launched at Dracula with SHOOT. SHOOT keeps track of how many times you’ve hit Dracula. The CRYPT is entered after five hits on Dracula sends him fleeing to the crypt. If the five hit goal isn’t met, the game ends here.

MOVEDRAC uses an orderly “Space Invaders” march to the side then down for screen movement, combined with random jumps downward and upward. This could be improved with a better movement AI, or adding an array of multiple flying vampires.

Upon successful completion of the abbey entry, CRYPT paints the coffins in the crypt and then calls CH to display the player’s choices.

Now is the time to find the courage and strength to do the terrible things that must be done. Lord Godalming helps you steel your resolve. If you did not collect a hammer and stake, a Medieval pilgrim badge, and a crucifix, you won’t be able to win the game.

GROW a holy garden if a crucifix was collected. Use the SIGIL if a pilgrim’s badge was collected.

HS paints the grim hammer and stake outcome.

This game was a lot of fun to write and it was a delight to use the APL symbols in a game.

A quick playthrough of the whole game

Read More