500B Tokens in AI Game Decompilation
The journey to decompile a popular FPS into C++ using AI agents, facing challenges and optimizations.
Project Overview
Over the past three months, the author has been decompiling a popular first-person shooter game using tokens. The goal was not just a proof-of-concept but a complete, accurate recreation of the game. This project was about AI orchestration and infrastructure optimization.
Game and Process Details
The author aimed for an accurate decompilation of the game to C++. Key requirements included readable source code, security and bug fixes, and portability improvements. The focus was on reconstructing the original behavior, not modernizing or porting the game.
AI Agents and Tools
The project utilized Claude Max (20x), Codex Pro, and other AI agents for decompilation. The agents were managed using GitHub CLI and Discord for communication. The ida-mcp by Hex-Rays was used for the decompilation process, known for its stability and headless support.
Progress and Challenges
The project faced challenges with agents losing focus and making semantic errors. A reviewer agent was used to catch bugs, but the lack of objective acceptance criteria made it difficult to determine correctness. An automated byte matching decompilation script was introduced to verify the accuracy of the reconstructed functions.
Optimizations and Refinements
Optimizations included reducing token consumption and refining the instruction document to keep agents focused. The project introduced a verification harness that allowed cheaper, less capable models to contribute effectively, reducing costs and improving scalability.
“Precise instructions are necessary. Agents have the desire to cheat if the assignment leaves room for interpretation.”
— Author