Reverse-Engineering a Classic Game with LLMs: A Two-Week Field Report
This article reports on a two-week experiment that used large language models to reverse-engineer and reimplement a classic real-time strategy game whose original source code was lost. It covers how to frame the task so the model will accept it, why staged milestones with acceptance criteria outperform one-shot requests, how the model handles dependency licensing and "magic constants," and the automated verification stack (static gates, golden-sample regression, property tests, soak tests) needed to handle roughly 400 commits per day. It closes with an honest assessment of where LLMs excel, where they struggle, and a reusable methodology for legacy system modernization.
1. Why Pick a Game Whose Source Code Is Lost
The source code of a classic real-time strategy game was scattered across multiple corporate acquisitions and studio shutdowns. That is an observable fact. Projects like this make an excellent test case for AI coding tools because they have three characteristics:
- Binary acceptance criteria: the game boots, plays the intro cinematic, lets you select units, and lets units fire. Each of these is a pass/fail check that requires no subjective judgment.
- An extremely heterogeneous tech stack: executable format analysis, proprietary video container decoding, map and rules file parsing, sprite atlases and palettes, pathfinding, and network synchronization, spanning a very wide range.
- A huge amount of implicit knowledge: many “magic constants” have no comments and no documentation. They exist only in old code and binaries.
One boundary needs to be stated up front: the goal of this experiment was a technical capability evaluation. It involved no copying or redistribution of copyrighted code, and all output was used for local research only. That premise underlies everything that follows.
2. Prompt Engineering Under Real Constraints: Getting the Model to Engage
The first problem to surface was not model capability but a conflict between safety alignment and how the task was framed. Asking directly to “reverse-engineer a commercial game and rewrite it” gets refused. What works is restating the task in a legitimate engineering context: legacy system maintenance, format compatibility research, or a teaching-oriented reimplementation.
This yields a general lesson: prompt quality does not depend on how elaborate the wording is, but on whether it supplies enough legitimate context and verifiable goals. A reusable template structure looks like this:
Role: You are a senior systems engineer maintaining an undocumented legacy system.Background: The original implementation is unavailable; only binaries and datafiles remain, retained for compatibility research.Goal: Produce a runnable minimal implementation in stages, with acceptancecriteria for each stage.Constraints: Use permissively licensed dependencies only; every constant mustdocument its source and derivation.Output: Directory structure + interface definitions + unit tests + per-stageacceptance checklist.
The model responds markedly better to “staged delivery plus acceptance criteria” than to “finish it all at once.” Staging breaks an unverifiable large goal into small verifiable ones, and each step can be checked automatically so drift is caught immediately.
3. Experiment Cadence and Stage Breakdown
The experiment started one evening and ran nearly continuously for two weeks, averaging about 400 commits per day. At that volume, line-by-line human review is completely infeasible, so verification had to be automated. The stages were:
| Stage | Window | Core Goal | Acceptance Method |
|---|---|---|---|
| Pre-Alpha | Day 1–3 | Binary and data format analysis | Parsers traverse the full file structure and pass validation |
| Alpha | Day 4–8 | UI and interaction loop | Main menu, loading, and unit selection all clickable end to end |
| Beta | Day 9–12 | Combat logic and pathfinding | Unit movement, attacks, and damage resolution reproducible |
| Multiplayer | Day 13–14 | State synchronization | Command sequence consistency verified across two instances |
Day 1 was consumed almost entirely by format reverse engineering. Resource formats in old games are often hand-rolled private structures with no alignment rules, no version fields, and reliance on implicit global conventions, which makes general-purpose parsing libraries largely unusable.
4. Observation One: License Compliance Is a Frequent Sticking Point
A recurring pattern: the model is extremely sensitive to dependency licenses and prefers permissive ones. When a candidate decoder implementation used a weak copyleft license while the project overall was permissively licensed and statically linked, the model refused to pull it in and chose to implement the functionality itself.
From an engineering standpoint this hesitation is not harmful, but it does cost efficiency. A more mature approach is to define the license policy at task initialization to avoid repeated probing:
Dependency license policy:- Allowed: permissive licenses (usable with static linking and closed-source distribution)- Forbidden: licenses with copyleft/viral terms- If the only available implementation has an incompatible license: emit theinterface contract and test vectors first, then implement independently
5. Observation Two: The Boundary of “Recited” Reproduction and Knowledge Transfer
One representative behavior stood out. While implementing a decoder on its own, the model spent a long time stuck on a batch of magic constants with no traceable source. After being exposed to an open-source implementation elsewhere, it did not copy the code. Instead it noted the constant values and then “wrote from memory” an implementation with a different structure and different naming.
Two points follow from this:
- The model’s knowledge comes from public implementations in its training corpus. What it can reproduce is factual knowledge such as algorithmic approach and parameter values, not a line-by-line copy.
- Reproducing factual knowledge is not code copying, but it is still a risk. If the algorithm behind the constants is subject to patent or license constraints, an independent implementation still needs legal review.
So the correct engineering posture is to make “constant source and derivation” a mandatory deliverable, requiring the model to provide verifiable derivation or experimental evidence for every magic number rather than letting it gloss over them.
Deliverable requirement: every non-obvious constant must include- its value- the derivation or experimental path- a minimal reproducible verification script
6. The Verification System: Keeping 400 Commits a Day Under Control
When commit volume far exceeds human review capacity, the only workable option is to shift quality left into automation:
- Static gates: zero compiler warnings, consistent formatting, dependency license allowlist checks.
- Structural validation: parsers traverse every resource file in full; any out-of-bounds access or validation failure halts the run.
- Golden-sample regression: capture a set of rendered frames and the command streams of several recorded matches, then compare frame by frame or command by command.
- Property testing: for pure-function modules such as pathfinding and damage resolution, generate random inputs and check invariants (units never overlap, damage is never negative).
- Soak testing: run continuously for hours while monitoring memory growth and frame-time jitter.
The value of this system is that it turns “did the model get it right” from a subjective judgment into a pipeline signal. Humans only have to handle red lights.
7. An Honest Assessment of Capability Boundaries
After two weeks, a few fairly firm conclusions emerged.
Where it performed well: scaffolding, module interface design, boilerplate code, unit test authoring, exploratory parsing of format structures, and filling in error handling. These tasks have fixed patterns and clear feedback.
Where it struggled: long-chain consistency across modules, reconstructing implicit global state, optimizing performance-sensitive paths, and timing issues that can only be located with real runtime feedback.
Where it most easily went off the rails: goal drift after context bloat. Over a long run the model forgets early conventions, leading to interface regressions and a fractured naming scheme. The mitigation is to maintain a machine-readable project contract file and force it back into context at the start of every task round.
8. A Reusable Methodology
Abstracted into a general process, this experiment applies to any legacy system modernization effort:
- Inventory the assets first: binaries, data files, logs, and any surviving documentation; establish which of them are the sources of truth.
- Define verifiable milestones: every milestone must have an automated pass/fail criterion. Reject “looks about right.”
- Fix the project contract: write the directory structure, interface signatures, license policy, and coding conventions into version control as the context baseline for every round.
- Shift quality left: put gates, regression, and property tests in place before feature development.
- Divide labor between human and model: the model supplies throughput; humans own the contract, review, and risk decisions.
- Front-load compliance: settle license, patent, and copyright questions before work begins to avoid rework.
For workloads of this kind, long-running and highly concurrent, teams typically run the code repository, pipelines, log services, and monitoring and alerting on a cloud platform, use a container platform to schedule execution environments, and use object storage to hold build artifacts and test recordings. This is a common industry engineering pattern and is not tied to any specific vendor.
9. Conclusion
The most valuable output of this experiment was not the still-incomplete rewrite. It was a field record of what AI coding tools can actually do: enormous throughput on tasks with clear patterns, and a continuing need for human backup on tasks that demand global consistency and real feedback. Treating AI as a throughput amplifier rather than a decision maker, backed by automated verification and compliance guardrails, is the workable path for legacy system reconstruction.
