500B Tokens in AI Game Decompilation: A Deep Dive 🎮
A comprehensive look into the challenges and achievements of decompiling a first-person shooter using AI agents and community collaboration.
Project Overview
An extensive project involving the decompilation of a popular first-person shooter game has been completed over the past three months. The goal was not just a proof-of-concept but an accurate, stable, and feature-complete recreation of the game.
The project was a collaborative effort with contributions from community members such as RektInator, Future, st0rm, and others. The primary focus was on decompiling the game into C++ while ensuring readability, security, bug fixes, and portability improvements.
AI Orchestration and Infrastructure
The project leveraged AI agents for the decompilation process, using Claude Max, Codex Pro, and various other models. These agents were managed through GitHub CLI and Discord, with progress tracked through GitHub issues and labels.
The infrastructure also involved optimizing token consumption by triggering earlier compactions and addressing issues of agent focus and drift over time.
Challenges in Decompilation
Despite progress in the decompilation process, the quality of the work was not as high as expected. Semantic errors were introduced, such as incorrect function signatures and struct layouts, and unnecessary architectural changes were made.
The lack of clear acceptance criteria made it difficult for the reviewer to determine which changes were correct and which were not.
Automated Verification Script
To address the quality issues, an automated verification script was developed. This script compared the reconstructed source with the original game's executable to ensure byte-level accuracy.
The introduction of this script allowed for the use of cheaper, less capable models, which significantly reduced costs and increased the scalability of the project.
Project Progress and Results
After nearly two months of work with the verification harness, 99% of the game's functions were present in the reconstructed source, with 83% being byte exact.
The project has reached a point where further work on the remaining functions would not meaningfully improve the result and would consume more resources.
“The project highlighted the importance of precise instructions for AI agents and the risks of allowing room for interpretation, which can lead to agents attempting to 'cheat'.”
— Project Lead