500B tokens later: Letting AI agents decompile a first-person shooter
momo5502.com
momo5502.com
Side projects can be cool and fun even if they have no points to them. Sometimes it's even better when there is no point.
But 500B Luna tokens, that's about 15 SF -> London round trips, or the average CO2 equivalent emissions of an american for about 15 months, based on napkin maths assuming average US energy mix to power the DCs.
Was it really worth it? Should we all start burping 18 tons of CO2 just because we came up with a fun little prompt idea? Should a side project really pollute as much as your neighbor's entire life for more than a year?
I know worrying about climate change is not trendy anymore but there as to be a limit to the amount of not-caring one can have, surely?
Congrats, i guess.
I don't even know how to react to this. Pretty sure farming one almond uses a little bit less energy, and farming all the almonds in the world a little bit more, yes. I think you can also eat those almonds, but am not sure either.
> the fridge in your kitchen
I feel like if my own fridge in my own kitchen was consuming on the order of 50MWh over a period a 4 months, I would have noticed, given that that would be over $20,000 at my current residential PG&E rate in SF, or about $60k per year for a fridge.
The human brain runs on ~20 Watts (last time I checked). I suspect we’ll find some energy efficiency gains in regard to this technology in the next couple of decades. Computers have a lot less vacuum tubes in them lately, after all.
Progress can be great. It's often used as a weapon against people. See the story of the luddites https://en.wikipedia.org/wiki/Luddites
Should I leave my AC at 65 while I’m on vacation for a month just to save myself the trouble of pressing a button, then tell anyone who calls me out that it’s society’s fault for not producing enough clean energy and I bear no responsibility whatsoever?
Burning 500B token for a fun unsharable side project is a simple choice someone made with (presumably) no gun to their head.
Population is growing plus electrification of transport plus more energy for compute plus we want to phase out fossil fuels.
> assuming average US energy mix to power the DCs.
This is an order of magnitude approximation, but it is enough to conclude that that 18 tons number make sense.
The unknowns are the energy per token but 1 joule per token should get you in the correct order of magnitude. If you want to verify it independently, run a local LLM, measure the power at the plug (in watts), divide it by the number of tokens/second your LLM runs at and you get a rough approximation of the energy use per token in joules. Luna is smallish model, and there is some caching going on, so it may be less, which may explain the 18 tons number GP gave instead of my 50 tons.
The second unknown is the tons of CO2 per MWh. Some datacenters claim they are near zero, because they use renewables or nuclear, but that clean energy they are using is clean energy that is not used to reduce CO2 emissions elsewhere, so I prefer to think in terms of averages.
From there, I estimated 80% cached, 2% decode, and the rest pre fill from tool calls inputs. That gave me 50MWh total, probably conservative since this kind of project will have very long context length on every pass. then take average energy mix in the US. It's definitely wrong by some factor in either direction, but I would personally feel the same about this experiment if it was 9 tons of CO2 or 36t.
There are uncountable things I don't value such as fast cars or college football that people drop billions of dollars on. I also bet you spend money on certain things others consider not worthy of the CO2 footprint.
The price system is the best mechanism we have, for all of its faults, to regulate whether something is "worthwhile". The best we can do here is make sure externalities are priced in.
By taking advantage of "unlimited" plans, he paid way less than what his usage has cost OpenAI and Anthropic. Someone, somewhere paid for the real cost of it.
Anyways, is it worth it? Don't know. He wasn't alone on the project, he made a blog post out of it, and others got interested in his experiment. So instead of thinking "15 round trips from London to LA" as someone going back and forth, think more about "15 people going on a round trip from London to LA". Since you mentioned football, we can think of it like a sports team attending an international competition.
But this is about ~100x more polluting, for what? I don't think they had fun doing it since they didn't do anything besides a few prompt. Nor does it provide any value or fun, if you want to play the game they remade byte per byte, it's 15 bucks on steam. This is literally like putting 2000 gallons (8000 ltrs) of gasoline on fire just because you can and proudly making a blogpost about it to show how awesome you are for doing it. This is truly mindblowing to me.
I've found this to be robust for decompiling games, while giving the agents enough freedom to write code that is readable and not waste a ton of time making sure e.g. instruction ordering, register assignments, etc. are all exactly the same. For me, having byte-matching decompilation is only one way to produce a decompilation I know is faithful to the original. This "high-level decompilation" process I just described is something agents can do much more quickly.
(For example, your approach would not necessarily catch all the same overflow behaviors; the OP expressly claimed that "replicating all bugs" was also important, and many bugs are caused by certain overflow behaviors)
That said, I would probably follow this same approach if I were to do this, but with extensive randomized testing as well.
1. Solver is great at the bugs tests miss (overflow, off-by-one, empty inputs...), its output can be used by the agent to fix it.
2. Solver struggles where you'd assume: loops, non-linear arithmetic and pointer aliasing blow up solve time, floating point is painful.
So your step 2 would cover some of it well, but since the game code is a lot of floating point, SMT would probably have a hard time (get stuck/timeout).
So you're looking not just for functional but also dysfunctional equivalence %)
Also, it feels like just fuzzing the function is slow, compared to simply checking bytes. Fast feedback allows agents to iterate much faster. At some point I wrote a tool that simply proves semantic equivalence, while ignoring irrelevant changes, e.g. register selection or stack slot changes. Turns out it was way too slow as a harness. I still used it to verify some of the remaining functions.
It turns out that getting functions byte-matching is actually not that complicated. Most functions are small and can be one shotted, and over time, agents figured out rules how to control code generation for more complex functions. They wrote down techniques and tricks on how to control register selection for example, or how certain control flow operations may impact basic block ordering, etc. Super insteresting what they figured out. So the further we got into the project, the easier it was to get functions exact.
Call of Duty: Modern Warfare 2 (2009)
https://web.archive.org/web/20260925153118/https://momo5502....
https://web.archive.org/web/20260925153131/https://momo5502....
Come at me, corporate America.
The agents would have had to mess around with compiler versions, optimisation options, and the phase of the moon as well.
If you just went for functional equivalence, it would probably cost 10x or 100x less tokens.
Another false economy was using Sonnet instead of a more intelligent model like Sol 6.1 (1), which would have cost more per token, but is 100x or so better at reverse engineering and coding and therefore can chew through the source code much quicker and make fewer mistakes, meaning less work needing to be scrapped.
In my testing doing a similar task, I ran multiple sonnet for weeks and burnt through ~$1000 in tokens to get 20% completion and output that was pretty bad. After switching to Sol 6.1, it finished the whole task in around 2 days, cost around $50, and it did it with zero supervision and a single /goal.
(1): struggle to use Opus for reverse engineering, too many safeguards. OAI has virtually none, and uses way less tokens so is more economical.
No one is going to use it if it’s a kind of close but not really reimplementation.
Testing functional equivalence is also pretty much impossible. How would you for example test the new one has exactly the same bugs which haven’t been discovered yet. Or doesn’t introduce new ones? This stuff matters for speed runners.
Yet the C code can’t pick what registers to use, so the poor agent is probably shuffling the code around randomly for hours or days until it matches.
That’s probably why the agent dropped down into inline assembly in the first place (the author complained about this), because I bet it’s thinking trace was that this is futile.
Compilers themselves are not even deterministic and running them multiple times creates different assembly.
Humans too do that for matching decompilation. Or at least I imagine so, given that I personally refuse to do that.
People have different goals and will use different techniques to achieve them. The video game reverse-engineering/decompilation community isn't a hive-mind, I went ahead and created ghidra-delinker-extension because I had my own ideas on how to do that.
Due to this strict harness, we were able to use extremely dumb models efficiently. I think at least 200-300B of tokens (maybe even more) were processed by Luna.
Given that Astra for example is 100x more expensive per token than Luna, a high token consumption doesn't necessarily mean high cost. So these 300B Luna tokens would equate to 3B Astra tokens and roughly 15B Sol tokens.
Unfortunately a huge part of the logs is lost, so I can't do a detailed analysis on which models were used, how much they cost, etc.
With all due respect I seriously doubt that. What are you doing that's different? Almost every test between just Opus and Opus conducting cheaper agent swarms ends up with Opus getting better results at a lower cost. People set up harnesses just like yours and see this.
Do you have any links to these tests? I've had a hunch that this was true for a while but haven't found any benchmarks showing it.
I tried giving glm 5.3 ghidra. I found that it frequently did better just reading the actual assembly, where needed writing decompilers in real time, in the terminal.
The reasoning showed that it was able to write ghidra as needed and indeed where necessary simply read assembly tokens.
Trying to think about ghidra probably confused it.
I also think that there is a gradient of losing intelligence in refusals, opposed to a simple boolean refuse. I suspect that using an abliterated model would boost the intelligence way up.
Total Opus 5.5 token usage on OpenRouter last week is 5000B, presumably not counting cached input.
Edit: Here's a possibility.
The future of software is agent only software. We ask for a result, agent asks questions from us, agent uses the specialized software, user gets result. We subscribe to an AI assistant and specialized agents. We are almost there,at least the start. The future of PC's as we know them are numbered. OSs,CLI,compilers and whatever will melt into AI assistants. Say goodbye to writing software for people.
You could just have the LLM agent use the software itself and then duplicate the functionality it finds, don't even need the screenshots or video.
Unless the software is doing something extremely novel, the LLM can just do this all itself after you point it toward a url for the software with instructions to clone what it finds there.
It'll be interesting to see if SaaS companies and/or providers of internet services like Cloudflare try to stop this sort of agentic cloning of SaaS products.
Like, obviously they would kinda want to if/when this sort of thing becomes commonplace, but how do you do it while allowing your software to be agent-friendly for non-cloning uses, and who is going to want to tell their customers they can't use agents with their SaaS for fear of their software being cloned? Kind of a bad situation with either option.
Someone has vibe coded the entire Adobe suite btw: https://getartcraft.com/apps
https://www.reddit.com/r/ReverseEngineering/comments/1vxig19...
If you make a program with a simple logic, anyone can vibe-copy it in a day. You cannot sell it.
If you make a program with advanced algorithms and complicated math, anyone can clean-room reverse-engineer it (by 2 different AIs) and vibe-copy. Furthermore, reverse-engineered data, such as algorithms and secrets, will be embedded into weights of a next LLM version.
Yes cloud won't work when you have unstable Internet due to certain events, but having a program sometimes not working is better than having a program anyone can copy. Am I wrong?
Also, vibe-copy is a made up word.
...or competitors will just burn their own tokens on reinventing the same thing from scratch. It's going to get really hard to come up with some secret sauce that can't be replicated by a swarm of agents that never sleeps.
BTW, GPL is also totally screwed by vibe-copying.
But I'm not mad that we can reverse engineer stuff (well, reverse engineer is too nice, in a way: we can sort of clone). In fact, I love it. A friend recently shared that it feels illegal, but I find it to be a dream. The teenager in me who loved open-source would be celebrating intensely for the fact that now we can "open-source" other software. Or modify it. I've got mods in one way or another for almost every game I've been playing recently, it's truly a dream come true. I haven't open-sourced most of it, but mostly because I imagine the world is filled with vibed stuff.
I may make money by building software, and that certainly has included keeping things proprietary, but I don't ideologically love that. If the world progresses towards this, I think we're better off.
(But I'll admit I think I'm in the minority here).
I just don't think this is true. People have had the option to Pirate for many years, but many don't. Balatro was in Love2D, so it was effectively open source. But it was one of the most successful indie games in recent memory. Someone made an entire recreation of the the World of Warcraft back end up to wrath of the lich King, effectively letting you play on custom servers for free, and yet people would rather pay for wow classic
Most people don't want to download a random exe outside of the steam store, and even less people will try reverse engineering themselves. Maybe if one of the modifications is really good, or somebody makes it extremely convenient.
I could see one of these engineers getting a lot of attention in the media, and then maybe a company will step in and insist that anthropic put some restrictions on this type of work. But I don't think Activision is going to see this as humongous threat to their bottom line.
Even the cloud won't save you, though: some SaaS companies are far too easy to replicate internally. It kind of sucks, because these used to be small companies with a couple of use cases in mind that nobody ever wanted to "reimplement internally" and they did give work to real people. But now, throw some agents at it, and a few 100s $ later you have replicated their product and can run it in your (internal) network.
https://github.com/ValveSoftware/halflife/blob/master/pm_sha...
The LLMs have presumably already consumed information like this as part of their training sets. Converting between Hammer and Unity scale is a fairly trivial linear operation. You can dump the BSPs to recover geometry and rapidly accelerate map development using timings that are already known to work.
Attacking the raw binary directly is certainly impressive, but it's totally unnecessary.
One of the few problem is that the decompiler is not always reliable. That forces you to go read the assembly, and it is not apparent to decipher the right kind of feng shui, not even from human before the LLM era. I used to play CTFs and my conclusion is exactly that.
This is extremely apparent when there are self-modifying code (e.g. JIT) is involved. You need a stepping debugger to read the right control flow, because the code will diverge based on the instruction pointer and regions you jumped into. At this point static analysis like IDA and Ghidra stopped working.
> There are no noticeable bugs and all features of the original game are present.
>
> The remaining functions have been reworked repeatedly. While they still don’t match byte for byte, we believe their semantics are correct.
As there are no way to confirm this outside of ”believinh”, what you are left is with a end product that might contain thousands of micro changes that essentially make the game something else than it was intended to be.
Since even Fable 5.1 cannot reliably remember what it wrote into "memory" files before the last compaction, why would we trust it to not forget about some side-effect when handling assembly that is so verbose it'll surely exceed the context and, hence, necessitate compaction.
So, if you reverse-engineer game X and post reverse-engineered code, what exactly do you infringe, how and in which jurisdiction? What changes if it is done via LLM?
(I understand that LLM decompilation is absolutely out of hand right now and something surely will come to trample the fun. But what and when? I suppose american LLMs will have their system prompt updated to forbid any reversing help and report suspicious activity straight to legal hotline)
In 1986 there was a federal court case, Whelan Associates Inc. v. Jaslow Dental Laboratory, in which it was ruled that the "structure, sequence, and organization" of a computer program was protected by copyright, and thus independently produced software could be found infringing if it copied these elements, even if the code were not copied (or mechanically translated) verbatim. This led to a six-year period in which computer software enjoyed generous copyright protection, such that "clones" of copyrighted software were effectively infringing. It wouldn't be until the early nineties that other court rulings would tighten the rules again, notably Computer Associates International, Inc. v. Altai Inc.. The 3-step "abstraction-filtration-comparison" test has been used by most courts since 1992 to determine whether nonliteral parts of program code are eligible for copyright protection, and whether another, independently written program is infringing.
HOWEVER, the Whelan standard was never actually overturned or stricken from U.S. law due to legislation or litigation! And companies have sued and won under the Whelan standard! Most notably, Oracle in their copyright and patent case against Google regarding Java APIs in Android. Google ultimately prevailed, but only because the Supreme Court ruled that Google's use of the APIs was fair use; they did not overturn the Federal Circuit's finding that the "structure, sequence, and organization" of the Java declaration code was ineligible for copyright! And I doubt that the Supreme Court would similarly smile on a reverse-engineered complete video game!
I believe that these reverse-engineered projects infringe copyright, under the Whelan standard and perhaps under the stricter Altai standard as well. You do not get a free pass because the original code was in C and yours is in Rust; or because you created a slightly different version of each function in the original code.
And let's say there's a future where an AI model could zero-shot the game itself. What then?
How can one prove that X is a copy when none of the source code match original? Clean room re-implementations are not illegal after all, if we go that way (yeah, yeah, I know about clean room argument).
While I personally do not think it would be different, but a lot of LLM folks are, and even some companies (rushing to blatantly clone and de-compile stuff). Kinda strange feeling sitting and looking around in the midst of it, y'know.
It reminded me of this: https://malus.sh/ "cleanroom as a service" - which I guess was kind of a joke, but looks pretty serious now.... (discussion back then: https://news.ycombinator.com/item?id=47350424)
But this seems to hinge on the "clean room"- is this a separate set of case law or is it related? As in, if they had been more judicious about the way the game was implemented could they have claimed it was not under copyright?
PIF owns EA, when they invite you to a meeting you might start to worry about foil lined room and carpentry tools lying around
Yes, that's the main problem I'm having with agentic workflows. Sometimes you don't care about architecture of something if it just works, but more complex stuff can't work well without good architecture. And currently it seems that there is still no substitute for good human taste.
Even after building whole infra for that and not pursuing identical byte output it's been pretty token hungry process
- please someone do it
I am using Qwen 3.8 27B-8bit in oMLX and Pi agent with GhidraMCP on my MacBook M3 Max. So far it ran for like 10 hours total and I haven't checked in on it much but it seems to have extracted the audio assets successfully and wrote a whole bunch of helper scripts for Ghidra to extract YYC functions which took several hours to run. I put the project on hold cause I didn't want to keep running it at 100% fans for hours every day. It blew through ~200k context of the model 3 times by now. I am not confident in this project, especially because I have very little experience doing grown up reverse engineering that isn't decompiling a C# or Android apps so I can't really guide it.
0 - https://manual.gamemaker.io/lts/en/Settings/YoYo_Compiler.ht...
Normal development isn't so lucky, you do care about code quality. So you have to review the code the agents write and handle the testing yourself. The agents will not do what you want, they'll do what they think you want, and you're the only person who knows what you think.
Obviously matching functions byte-byte is not it, but I think with enough creativity, you can have guardrails and oracles almost everywhere.
E.g. before diving into feature development, you can have agents generate a test suite based on your implementation first. Then, when developing features, this test suite shows what broke and agents can double check if that was intended.
How that test suite looks like obviously highly depends on the environment.
they (normaly) contain Source mapping: Links machine code addresses back to original source file names and line numbers.
Symbols: Lists names, addresses, and types for functions, global/local variables, and public exports.
Line numbers: Maps compiled instructions to specific source code lines.
and PDBs can exist also for Release builds but more pointing to a debug build - which in itself is way easier to reverse
Maybe companies will ask anthropic to crack down on it at some point.
But from what I understand, Bevy doesn't come with those things and they did not use something like Havoc, so AI had to translate them as close as it could to match the movement correctly.
To answer your question, it seems like these decompiled game engines are not humongous by themselves. So I wouldn't be surprised if it could be done with Assassin's Creed. But a Youtuber did mention the games they are doing this with (MW2, Skate 3, Minecraft) are ideal starting points.
The compilation recompilation and automatic porting represents such a quantum leap in terms of software, preservation and software freedom.
Almost like every single piece of software written in the last 50 years can be repurposed by the end users for what they need, not the oppression copyright laws and judgements handed out by a corrupt judiciary and legislative branch
That would reveal the quality of the Windows OS codebase.
My bet is the result ain't gonna be pretty.
>At current 2026 API rates, 500 billion AI tokens would cost roughly $100,000–$750,000 depending on the model, with most flagship models in the $150–$400 per million input tokens range
Yet, it is now profitable.
The bet is that people realize how valuable these services are, and despite complaining, they still would pay the higher price. This realization would not happen without this initial subsidy from investors.
It isn't too different from drug dealer's first sample free...
Taxis were an established profitable business model and the uber subsidisation wasn’t anywhere near as much as AI subsidies.
????
Uber and Lyft were paying drivers $X but charging users way less than $X so they were literally burning investor money to get market share.
Why does this point come up over and over again, pretending that you can truly separate training and inference costs. Yes, they are separate things but the value OpenAI and Anthropic are presenting to the world is "we're the absolute best, no one else comes close." Well, to keep that up you can't just not train for extended periods of time. You have to keep that engine going non-stop when there's free Chinese models nipping at your heels. You can be profitable on "just inference" all you want but if training expenses dwarf that, you're not going to be profitable overall, and that's the bottom line.
So my conclusion is that it only works because the majority of users doen't fully utilize their allowance. Last month I used almost nothing of my Claude 20x plan (did use Codex though).
You think developers won't/don't stretch subscriptions to the absolute limit? The AI subscription model is like the gym model except a large percentage of the customers work out 24/7/365.
The price these companies charge per token is irrelevant to a discussion about subscriptions. You're comparing two selling prices, when what matters is the actual cost. It's like those ads saying, “Normally $20 million, but today it's only $99!” for something that costs $10 to make.
Sure, they're losing money now. But the question is whether the tokens you use through your subscription will eventually cost them less to generate than you pay for that subscription. Their per-token selling price doesn't tell you that.
Also, Uber was peak ZIRP + COVID, money was cheap and growth was easy. I think the mountain to climb is a lot steeper now.
Reading between the lines:
"The avid reader of my blog might have noticed that I had previously written two posts that have since been removed. Everyone else might now be wondering which game I am talking about. To both of you I can only say that corporate America was here to ruin our fun."
Keeping it private likely wasn't the original plan...
The tone of the blog suggests they are using the game to build out tooling and expertise; the capability to decompile large projects on the scale of AAA games is not worth nothing, e.g. security or "competitor analysis" that lays trade secrets bare.
AI is a great at laundering code, I thought open-source software was the prime prey, but I should have thought bigger.
https://developers.openai.com/api/docs/pricing https://platform.claude.com/docs/en/about-claude/pricing
OpenAI and Anthropic are both 10/mil in.
https://openrouter.ai/z-ai/glm-5.3#providers https://openrouter.ai/moonshotai/kimi-k3#providers Other frontier models are like 1-3/mil in.
Also, 500 billion is 500,000 millions. At the lower end of your 140/mil estimate that's 70 million dollars. Even at my 2/mil lookup for Chinese frontier models that's one million. Show your math for 100k-750k, please.