Commodore 64 gets a first-person 3D game written with Claude Code

Commodore 64 gets a first-person 3D game written with Claude Code

Jonathan Field has published lest-c64 on GitHub, a first-person 3D game that runs on an unmodified Commodore 64. The README says the code, the art, the end-scene picture and the level designs are by Field, written with Claude (Anthropic) in Claude Code, and released under the MIT licence.

The project starts from a question: can a stock C64 run a first-person 3D game at full resolution with a decent frame rate? The author's answer is "better than I expected." He notes that many 3D games already exist for the machine, up to and including a port of DOOM, but says they tend to have poor frame rates (under 10 fps) and often very blocky graphics. His goal was something smoother and clearer, and he says the C64 can deliver it. The README gives no measured frame rate for this game, only that comparison.

The README lists the tricks behind it. The screen is drawn in character mode instead of bitmap mode, with a character map built from sampling millions of rendered frames. The scene is vertically mirrored, so only the top half is calculated. A ray cast hinted from the previous frame does a binary search for corners only, wall edges are interpolated between corners, and wall seams are projected instead of cast. Caching means unchanged areas are not touched even when the player moves. All entities are hardware sprites, culled with precalculated zones and occluded with per-frame occlusion stamps. The author adds that there was aggressive profiling and optimizing, pass after pass, using every 6502 programming trick, precalculating as much math as possible and aligning tables in memory. The screen itself is a 40×25 cell framebuffer drawn from a charset of wall-edge shapes, giving 160×200 multicolour pixels.

There are three ways to play. The game runs in a browser at needlestack.github.io/lest-c64, which plays the cartridge by default; adding ?disk loads the disk image with its 1541 load times, and ?dvorak loads the Dvorak build. It also runs in the VICE emulator from the disk image lest-c64.d64 or the cartridge image lest-c64.crt. For VICE the author says to use x64sc with true drive emulation enabled, because the fast loader runs its own code inside the 1541. The same disk runs on NTSC and PAL machines (it detects which at boot) but plays slightly better on NTSC. The cartridge is an EasyFlash image for an EasyFlash 3, Kung Fu Flash, Ultimate 64 or 1541 Ultimate, or any emulator. It needs no disk drive, so it is the way to play on a machine whose drive is an SD2IEC, which the disk's fast loader cannot talk to. It loads in under a second.

The README also covers the engineering. Levels load from disk on demand, through Krill's loader, into one slot, and each level brings its own code, so a feature used by one level (level 8's failing light, level 10's ball lightning) costs the others nothing. Boot is a two-stage loader adapted from Michael Steil's fastboot1541 idea: the drive reads its own small transfer routine off the disk, so almost nothing crosses the slow bus before a fast loader is running. Drives that are not a 1541 take the stock route. The cartridge carries the disk's files byte for byte in EasyFlash banks, plus a 251-byte loader that stands in for Krill's resident at the same address.

Building needs a recent Node.js (developed on 26), ImageMagick 7, and for the music GoatTracker 2 (v2.76) with the project's patch; MUSIC=0 builds without music. The assembler (src/asm6502.mjs) and the disk-image writer (src/d64lib.js) are part of the project. The command node src/build-iray.mjs builds the whole game, levels 1-10, in about 25 s cold and 5 s when nothing has changed. The build checks page alignment, memory overlaps, zero-page ownership, unreachable code and the preconditions of the undocumented opcodes it uses. The test tools need VICE 3.9. Third-party code keeps its own licence: the loader by Krill (Gunnar Ruthenberg) under BSD 3-clause, and the Exomizer decruncher by Magnus Lind.

Key facts

  • lest-c64 is a first-person 3D game for an unmodified Commodore 64, released on GitHub under the MIT licence as a disk image (.d64), an EasyFlash cartridge image (.crt) and a browser version.
  • The README credits Jonathan Field with the code, art, end-scene picture and level designs, written with Claude (Anthropic) in Claude Code.
  • The author says earlier C64 3D games, including a DOOM port, tend to run under 10 fps with blocky graphics, and that his game does better. No measured frame rate is given.
  • Techniques include character-mode drawing, a vertically mirrored scene, ray casting hinted from the previous frame, hardware sprites for all entities and heavy precalculation. The screen is 40×25 cells, giving 160×200 multicolour pixels.
  • The cartridge version needs no disk drive and loads in under a second; the disk version uses a custom fast loader that needs true drive emulation in VICE.

Why it matters

It is a concrete, playable example of an AI coding assistant used on a very constrained target: a 6502-era machine with hardware sprites and aggressive profiling and optimizing. The author's claim is that a stock C64 can do full-resolution first-person 3D at a smoother frame rate than earlier attempts, which he puts at under 10 fps. The README credits the work to Field, written with Claude in Claude Code, but does not say how the work was split between the human and the model.

Who it affects

Retro computing fans and C64 players can try the game in a browser or in VICE. Owners of an EasyFlash 3, Kung Fu Flash, Ultimate 64 or 1541 Ultimate can run the cartridge image directly, and the cartridge also suits machines with an SD2IEC drive. Developers interested in 6502 rendering can read the technique list and docs/RENDERING.md, and those curious about AI-assisted low-level programming get a public repository to inspect.

How to use it

Play online at https://needlestack.github.io/lest-c64/, which runs the cartridge; add ?disk for the disk image or ?dvorak for the Dvorak build. In VICE, use x64sc with true drive emulation enabled, ideally set to NTSC, and load lest-c64.d64, or start the cartridge with x64sc -cartcrt lest-c64.crt. On a real C64 the joystick works in either port. To build it yourself, run node src/build-iray.mjs with a recent Node.js and ImageMagick 7; music needs a patched GoatTracker 2 (v2.76), or set MUSIC=0. The project is MIT-licensed.

How solid is it

The project is public and playable, so the result can be checked directly. The performance claims are the author's own and are stated loosely: the game is "better than I expected," set against "under 10 fps" for other C64 3D games, which the README does not name. No measured frame rate for this game is given. The README does not say how much of the code Claude wrote, or how many prompts, sessions, tokens or hours were used.

Risks and caveats

The disk version depends on a fast loader that runs code inside the 1541, so it needs a real or truly emulated drive and cannot talk to an SD2IEC; the cartridge avoids that. The game plays slightly better on NTSC than PAL. Testing on real C64 hardware is not described; the stated setups are VICE, the browser (EmulatorJS) and compatible cartridge or drive devices. A HEAVYSID build option exists for real machines whose 6581 SID filters more of the top than VICE's reSID, which the game is tuned for. Building from source needs several external tools, including a patched GoatTracker.

“And the answer turned out to be: better than I expected.”

— the author, lest-c64 README