Jonathan Field developed a first-person 3D game for the unmodified Commodore 64, written in 6502 assembly with assistance from the LLM Claude, achieving smooth performance at full 160×200 multicolour resolution via character-mode rendering. The engine renders 40×25 character cells using a precomputed charset of wall-edge shapes sampled from millions of offline frames. Core optimizations include vertical scene mirroring to halve raycasting calculations, binary-search corner detection hinted from the previous frame, interpolation of wall edges between corners, projection of wall seams instead of casting, and dirty-rectangle caching to skip unchanged screen areas. All entities are rendered as hardware sprites with precalculated zone culling and per-frame occlusion stamps. The codebase employs aggressive 6502 optimization: lookup tables aligned in memory, maximum precomputation, and undocumented opcode usage verified at build time. The game spans ten levels loaded on demand via Krill's fast loader (with a custom 1541 transfer routine) or as an EasyFlash cartridge image (lest-c64.crt) loading in under one second. A two-stage boot detects NTSC/PAL automatically. Music uses a patched GoatTracker 2 player. The Node.js build system (src/build-iray.mjs) parallelizes per-level sub-builds with content-addressable caching (~25 s cold, ~5 s incremental), emitting verified disk (lest-c64.d64) and cartridge images. Playable online via EmulatorJS at the project's GitHub Pages site.
Read original
hackernews