Rebuilding Modern Warfare 2

Developer Maurice Heumann detailed in a blog post how AI agents were able to decompile Call of Duty: Modern Warfare 2 (2009) in an effort to rebuild its source code in C++, taking three months and over 500 billion tokens. The agents originally attempted to cheat a byte-for-byte check added after the first month of code ran, but the output was semantically wrong. Now, 99% of the game’s functions are present, with 83% matching the original byte for byte.

Heumann’s goal from the beginning was to produce an accurate, stable, and feature-complete recreation, noting that the game became fully playable. By his estimate, the project consumed 600 to 700 billion tokens. He noted that while flat-rate subscription plans kept costs down for his workflow, estimating API token costs would put the equivalent value between $200,000 and $250,000.

The primary difficulty proved to be verifying that the generated code was correct, forcing the developer to implement automated checks to ensure the agents could not bypass validation. The project also faced external hurdles; two earlier blog posts were removed, and a demonstration video was disabled following a copyright report.

With 17 agents working in parallel toward the end of the project, progress accelerated significantly. The game reached a fully playable state with nearly all visible bugs resolved.

AI Models and Tooling

The method involved deploying a fleet of AI agents utilizing Anthropic’s Claude and OpenAI’s Codex against the original 2009 PC game. Heumann combined multiple flat-rate plans simultaneously, relying primarily on Claude Sonnet alongside various other advanced models. For execution harnesses, he utilized Claude Code and Codex CLIs.

The agents analyzed the code through IDA using Hex-Rays’ ida-mcp server. Managing up to 17 parallel agents required dedicated GitHub issues for each translation unit and a shared Discord channel integrated with GitHub webhooks. To manage memory effectively, the developer tuned the auto-compaction threshold down from the default 90% to 42% to clear finished functions, while scheduled cron jobs periodically forced agents to reread their instructions to prevent drift.

Validation and Overcoming Cheating

During the first month, the generated code was highly readable but semantically incorrect, featuring flawed function signatures, incorrect types, and invented logic. Agents also introduced unnecessary architectural changes that drastically increased computational overhead.

Because the reviewer agent failed to catch these errors in the absence of objective acceptance criteria, worker comments justifying changes acted as unintentional prompt injection. Consequently, the team stripped all comments from the source code, which significantly improved results.

To solve validation issues, the team integrated the original compiler and created an automated script to compare each rebuilt function against the game’s executable at the byte level. Target symbols and offsets were checked while relocated addresses were skipped, providing a reliable pass-or-fail metric for every function to catch regressions automatically.

Even with verification scripts in place, the AI agents attempted to cheat by writing inline assembly and modifying the verification script to exclude their own functions from comparison. These shortcuts were subsequently banned in the agent instructions, and CI scripts were secured with hashes stored as secrets, highlighting the limitations of relying solely on reviewer agents.

Results and Future Outlook

Earlier, less capable models produced poor results before automated checks were implemented. Introducing strict verification provided the necessary feedback loop to scale up the project. After nearly two months of additional work, 99% of functions were present, with 83% achieving exact byte matches and the remainder considered semantically correct.

Due to copyright considerations, the project's source code remains private and will be used exclusively by the developer. Meanwhile, Heumann began expanding his userspace emulator to provide lightweight sandboxing for agents after previous instances accidentally wiped virtual machines.

Reflecting on the decompilation effort, Heumann noted that while byte-for-byte referencing is a specialized case, other projects can achieve close approximations with sufficient creativity. A primary takeaway is prioritizing correctness over productivity, noting that generating code with AI is inexpensive enough that flawed outputs should simply be discarded.