LLM writes first-person 3D game in Commodore 64 assembly
A developer has released LEST, a 3D first-person game for the Commodore 64 written using assembly code generated by an LLM. Discover how it works.
Source: Hacker News — front pageA developer has successfully used a large language model to write a first-person 3D game specifically for the Commodore 64 using assembly language. This project, titled LEST, demonstrates that AI can navigate the highly restrictive and complex constraints of 8-bit hardware to produce functional, high-performance software.
What is the LEST game project?
According to the developer's repository on GitHub, LEST is a pre-release first-person 3D game designed to run on unmodified Commodore 64 hardware. The primary objective of the project was to determine if the C64 could support a 3D experience with a smooth frame rate and clear graphics, moving beyond the blocky visuals and low frame rates (often under 10 fps) typically seen in existing C64 3D titles or ports.
The resulting game manages to achieve a higher level of visual fluidity than previous attempts by utilizing a variety of low-level programming optimizations. The project is available as both a disk image (.d64) and a cartridge image (.crt), allowing it to be played via emulators like VICE or on real hardware using specific cartridges.
How does the game achieve 3D graphics on 8-bit hardware?
To overcome the extreme limitations of the 6502 processor and the C64's hardware, the developer implemented several sophisticated rendering tricks. According to the project documentation, the game does not use standard bitmap mode for the entire screen. Instead, it uses a character-mode framebuffer where the screen is composed of 40\times25 cells. Each cell is drawn from a custom charset of wall-edge shapes, which allows for a resolution of 160\times200 multicolored pixels.
Other technical optimizations include:
- Ray casting enhancements: The ray casting process uses a binary search for corners and is hinted from the previous frame.
- Symmetry: The scene is vertically mirrored so the engine only needs to calculate the top half.
- Interpolation and projection: Wall edges are interpolated between corners, and wall seams are projected rather than cast.
- Caching and Culling: The engine uses caching to avoid touching unchanged areas during movement, and hardware sprites are used for all entities, which are then culled using precalculated zones and per-frame occlusion stamps.
What role did AI play in the development?
While the repository focuses heavily on the technical implementation and the assembly-level optimizations, the project's premise is rooted in the capability of large language models to generate assembly code. The developer utilized an LLM to assist in writing the assembly language required for the 6502 processor. This is a significant milestone because assembly language is notoriously difficult to write, requiring precise memory management and an intimate understanding of hardware registers, making it a rigorous test for AI-generated code accuracy.
How can you play LEST?
The developer has made the game accessible through several methods. It can be played directly in a web browser via a GitHub Pages site using EmulatorJS. For those using emulators like VICE, the repository provides a disk image (.d64) and a cartridge image (.crt). The developer notes that when using the disk image in the x64sc emulator, users should enable true drive emulation to accommodate the fast loader, which runs its own code inside the 1541 drive.
How does this relate to modern AI development?
This project highlights a shift where AI is no longer just generating high-level Python or JavaScript, but is being pushed into the most granular levels of computing. For developers working with specialized or legacy systems, the ability of an LLM to produce valid, optimized assembly code suggests new workflows for hardware prototyping and retro-computing.
If you are interested in exploring how AI can assist in complex coding tasks or managing low-level logic, you can experiment with Grafy Code. While LEST is a specialized retro project, the principles of using AI to generate, debug, and optimize code are central to modern software engineering workflows.
Frequently asked questions
Can the Commodore 64 run this game without modifications?
Yes, the LEST project is designed to run on unmodified Commodore 64 hardware. The developer specifically set out to answer whether a standard machine could handle a first-person 3D game with decent frame rates and clear graphics using clever programming techniques.
What programming language was used to create LEST?
LEST was written in assembly language. The developer used an LLM to help generate the assembly code required to interact directly with the 6502 processor and the specific hardware components of the Commodore 64.
Does the game support modern computer peripherals?
The game supports both keyboard and joystick inputs. In emulators like VICE, users can map cursor keys or a gamepad to the joystick ports to control movement, turning, and strafing within the 3D environment.
Source: Hacker News — front page — C64 3D first person game written in assembly by an LLM


