POLF is a small game I’ve written for the Commodore PET, more or less on a whim. Watch the official trailer below.

I wanted to write a proper 3D game for the Commodore PET. Given that the PET cannot actually display graphics, this seemed like a pleasantly futile task.

I originally wanted to use block graphics, which would have allowed a 80x50 graphics resolution, but it actually turns out that given the usual small-computer angle representation of 256 b-radians in a circle, then a comfortable field of view of 56° corresponds to 40 b-radians. This controls the highest possible resolution, because the program can’t represent smaller angles than that. This is probably a good thing, as the rather feeble 1MHz 6502 processor produces a small enough frame rate as it is.

To draw the maze, raycasting is used, following Lode’s Computer Graphics Tutorial. The demo directory contains a considerably hacked version of Lode’s demo program, ported to use 8-bit fixed point graphics. POLF’s number representation is 3.5 fixed-point, which allows numbers to be represented from 0 to 7 31/32 at 1/32 intervals. This is why the map is only 8x8, which is uncomfortably small.

In fact, this isn’t really enough precision, even switching to 16-bit precision for a few operations. I’ve managed to special-case most of the graphical glitches but there are still some. Entertain yourself by finding them!

It should be easily portable to any other 6502 platform with a 40x25 text-mode screen and 16kB of RAM.

There’s about 2.5kB of actual code, and 6kB of lookup tables.

You can get the source code from the main POLF repository on github. Or, download the .prg file below:

POLF precompiled binaries binaries 6 kB

A .prg you can directly run on your Commodore PET (or emulator thereof). Instructions are included.