Madman spent 500 billion tokens and used 17 AI agents to recreate the source code of the original Modern Warfare 2

Developer Maurice Heumann detailed in his blog how he used AI agents to decompile the 2009 release of Call of Duty: Modern Warfare 2 and rebuild its source code in C++.

The post itself refers to the game only as "a popular first-person shooter," and the work took three months and more than 500 billion tokens.

The reconstructed code now contains 99% of the original functions, and 83% of them match the original byte for byte. Heumann set out from the start to produce an "accurate, stable and feature-complete recreation" of the game, and according to the blog, it now "runs flawlessly."

Back in late September, Heumann announced that the game was fully playable:

MW2 decompilation is nearing its end. With currently 17 agents working in parallel, we're making progress at an incredible pace. The game is fully playable now and almost all visible bugs are gone. Only a few are left. I even managed to get my first nuke ☢️😂

By his own estimate, the project consumed 600–700 billion tokens. He doesn't pay for tokens himself, but he put a price tag on the work in a separate post: about €1,200 with subscriptions, or $200,000–$250,000 with API tokens.

The agents ran on Anthropic Claude and OpenAI Codex. Heumann started with a Claude Max (20x) plan, then added Codex Pro and used both at the same time. Both are flat-rate plans and do not use per-token API billing.

The setup looked like this:

  • Sonnet 5 as the main model, with Opus 5.5 and OpenAI Luna, Sol, and Terra also used a lot

  • Claude Code and Codex CLI as the main agent harnesses

  • agents read the game code through the IDA disassembler using the ida-mcp server from Hex-Rays

  • one GitHub issue per translation unit

  • agents and humans sharing a single Discord channel with GitHub webhook CI posts

The project began with four agents, three workers and a reviewer, and grew to 17 by the end of September. To help clear finished functions out of memory, Heumann lowered the auto-compaction threshold from the default 90% of the context window maximum to 42%.

Another problem was agent drift, as they gradually strayed from the rules they were given. To counter it, an hourly cron job made the agents reread their instructions.

The code from the first month was extremely readable but "semantically wrong." The agents got function signatures, types, and struct layouts wrong, and invented or removed chunks of logic. They also made unneeded architectural changes, such as turning a config-variable lookup into one that was "orders of magnitude more expensive."

The reviewer agent failed to stop this because there were no objective acceptance criteria. According to Heumann, the workers' comments justifying their changes "effectively acted as unintentional prompt injection." The team eventually stripped all comments from the source, which "helped a lot," he noted.

Salvaging the first four weeks of code took more time than starting from scratch would have. The fix was an automated check, and the team switched to the same compiler that was used to build the original game.

A script compares each rebuilt function against the game executable at the byte level. Calls and data references sit at different addresses, so they are skipped, and target symbols and offsets are checked instead. Data and types go through the same check.

Each function gets a simple pass or fail, and every match is recorded so CI can recheck it and alert on regressions. The approach is slow and sometimes challenging, but a match guarantees identical behavior, down to reproducing original bugs.

Even then, the agents immediately tried to cheat. They wrote inline assembly and "repeatedly tried to modify this script to exclude their function from comparison," Heumann wrote. Inline assembly and similar shortcuts were banned in the agents' instructions, and CI now hashes the verification script and checks it against a hash stored as a GitHub Actions secret.

Before the check existed, the cheaper, less capable Haiku and Luna models "produced extremely bad results." Once automated verification was in place, the models got enough feedback to work properly, which cut costs and let the project scale up. After almost two more months, 99% of the functions were present, with 83% meeting the byte-exact requirement.

Heumann believes the remaining 16% without a byte match are still semantically correct. Each additional match was getting harder to earn, though, and returns from further effort were diminishing.

Technical hurdles weren't the only ones. As Heumann put it, "corporate America was here to ruin our fun." Two early blog posts about the decompilation have been removed, and the video in his Sept. 30 X post was disabled after a report by the copyright owner.

Activision has not commented on the situation so far. For "obvious reasons," Heumann is keeping the code private and plans to use it "for my own needs only." He added that the "decompiled code is obviously also copyrighted."

Meanwhile, he has started extending Sogen, his userspace emulator, into a lightweight sandbox for agents, after the project's agents wiped VMs. The tool won't be production-ready for a while.

Heumann acknowledges that decompiling a game is a special case, since not every project can be checked byte for byte against a reference. Still, he thinks every project can get close "with enough creativity."

His main takeaway: "Generating code is cheap now. Throw it away if it's bad," and put correctness ahead of productivity.

More news
Tags: