Reverse-Engineering a Classic Game with AI Coding Tools: A Two-Week Experiment
This article describes a two-week experiment in which an AI coding tool was tasked with rewriting a classic real-time strategy game whose original source code has been lost, using only the executable, resource packs, and a staged set of goals. It explains how to model the rewrite as verifiable engineering layers, build a format archive for undocumented legacy binary formats, enforce license compliance before dependencies are introduced, and apply prompt and context engineering so long-running automation stays on track. It also covers observability metrics for managing hundreds of daily commits, common failure modes such as goal drift and license contamination, and the five conditions that determine whether long-cycle automated development produces usable, verifiable results.
1. Why Rewriting a Game with Lost Source Code Is an Ideal Testbed
The industry often laments that the original projects behind many classic real-time strategy games have been lost, leaving only the shipped executables and massive resource packs. This creates an almost ideal engineering problem: the target behavior is fully determined (veteran players can tell right from wrong at a glance), but the implementation path is entirely missing and must be reverse-engineered from binaries and resource formats.
So someone tried assigning this long-cycle task to an AI coding tool: no source code, only the executable, the resource packs, and a set of staged goals, running continuously for two weeks to observe the output. The value of such an experiment lies not in “replacing human engineers” but in testing the real capability boundaries of current AI coding tools on unfamiliar codebases, ambiguous requirements, and very long task chains.
It should be emphasized that this article does not discuss any specific third-party product, nor does it review or recommend any tool. Every stage below is described in terms of general technical capabilities (code understanding, cross-language rewriting, test generation, logging and monitoring), so teams can map them onto their own technology stacks.
2. Task Modeling: Breaking “Rewrite” into Verifiable Engineering Problems
Telling a model “rewrite this game” will almost certainly fail. The workable approach is to layer the task first, so that each layer has a clear acceptance artifact.
- Resource and format layer: executables, animations, maps, audio, and video container formats all parse successfully and produce a unified intermediate representation.
- Presentation layer: UI elements such as the main menu, sidebar, unit selection, and path indicators are pixel-aligned.
- Logic layer: pathfinding, combat resolution, damage types, and build and resource-gathering rules match.
- Multiplayer layer: state synchronization, reconnection after disconnects, and deterministic replay.
After layering, write “executable acceptance criteria” for each layer. For example, the format layer’s criterion is: given any batch of original resources, the parse success rate reaches an agreed threshold, and the parse results can be verified by checksum comparison. Tasks without acceptance criteria should not be handed to a long-running automated pipeline.
A simplified task description structure:
goal: Replicate the client behavior of a classic real-time strategy gameconstraints:- Use only permissively licensed dependencies; no copyleft licenses- Every reverse-engineered constant must include its source and derivationacceptance:- Resource parse success rate >= 99%- Key UI elements differ from original screenshots within a threshold- Combat results are reproducible under a fixed random seedmilestones: [format parsing, UI restoration, combat logic, multiplayer sync]
3. Stage One: Reverse-Engineering and Parsing Ancient Formats
The hardest part of old games is the proliferation of proprietary formats: animation containers, palettes, map layouts, and voice indexes were often ad hoc binary structures defined years ago, with no public specification and no mature parsing libraries.
An interesting phenomenon shows up in practice: when you ask the tool to “copy a certain implementation,” it often refuses; but when you say “a public algorithm description already exists in the industry, please implement according to that algorithm,” it consults public material and then writes the key constants into the new code from memory. This suggests prompt design should focus on describing algorithms and constraints rather than requesting code itself.
The more robust engineering practice is to build a “format archive” that records each format as a structured document:
- File header and magic number;
- Chunk structure and offset table;
- Compression or encryption scheme (many old formats use only simple XOR or run-length encoding);
- Palette and pixel layout;
- Frame rate, frame offsets, and audio synchronization relationships.
format: animation containerheader: magic(4) + version(2) + frame_count(2)index: per-frame offset(4) + size(4)payload: run-length encoded blocks, high bit indicates transparencynotes: palette comes from a separate resource, load by index
With the archive in place, implementing a parser changes from “guessing” to “filling in.” At the same time, enforce one rule: every magic constant must state its source and derivation, and no unsourced number may enter the codebase, or maintenance will spiral out of control later.
4. License Compliance: Where Long-Running Automation Most Often Fails
The biggest hidden risk in an automated pipeline is dependency introduction. Permissive and copyleft licenses impose completely different constraints on static linking, dynamic linking, and distribution; a single violation may force a full rewrite of the project.
So the policy should be fixed at the start of the process, and the tool should self-check before introducing any dependency:
- Dependency allowlist: only license types explicitly on the allowlist are permitted.
- Dependency review record: each new dependency generates a review note covering purpose, license, and linking method.
- Criteria for preferring in-house implementation: when licenses are incompatible or size/performance is not worthwhile, implement it yourself based on a public algorithm description.
- Periodic scanning: continuously check the dependency manifest and third-party notices in binaries.
This mechanism targets no specific tool or project; it is a guardrail any long-running automated development should have.
5. Prompt and Context Engineering: Making Two Weeks of Uninterrupted Running Possible
Running continuously for two weeks with hundreds of commits per day means no human can review line by line. What actually matters here is context management and front-loaded constraints.
- Fix the goals: write non-negotiable constraints (licenses, directory structure, naming conventions, testing requirements) into a project description file that stays in effect long-term.
- Decompose and read back: before each stage begins, require the tool to restate the current goal, completed items, and risks to reduce goal drift.
- Small commits: each commit does one thing, and the commit message states the motivation, scope of impact, and verification method.
- Recoverable failures: any failed step must leave a reproducible minimal case rather than an overwriting rewrite.
A schematic stage progression logic:
for stage in stages:brief = load(stage.brief)while not stage.accepted:patch = agent.propose(brief, repo_state)result = run_tests(patch)if result.passed and review_lint(patch):commit(patch, reason=stage.reason)else:brief = brief.append(result.failure_min_case)
6. Pace and Observability: Managing Hundreds of Commits a Day
The first problem high-frequency commits create is “you cannot see the progress.” The solution is to shift focus from lines of code to observable metrics:
- Resource parse coverage;
- UI restoration difference;
- Combat result consistency (replay comparison under a fixed seed);
- Crash rate and memory growth trend;
- Dependency license risk count.
When deployed in the cloud, these metrics can be carried by a combination of general capabilities: object storage holds replay samples and screenshot baselines, a message queue smooths out commit event spikes, a container platform runs parallel test jobs, and logging and monitoring with alerting handle anomaly detection. This way, even without line-by-line review, you can locate the problematic stage the moment a metric goes abnormal.
7. Common Failure Modes and How to Avoid Them
- Goal drift: stage goals get quietly rewritten. Avoid it by forcing a read-back of acceptance criteria at every stage.
- Unsourced constants: unexplainable magic numbers appear in the code. Avoid it by requiring every constant to include its derivation.
- License contamination: an incompatible dependency is introduced for convenience. Avoid it with a front-loaded allowlist and continuous scanning.
- Over-rewriting: one change covers many modules, making problems impossible to localize. Avoid it by enforcing small commits.
- False passes: tests are written too loosely. Avoid it by introducing baseline comparison and fixed-seed replay.
8. Conclusion: What This Experiment Actually Proves
What the game finally looks like after two weeks of AI-assisted rewriting is not the point. The genuinely valuable conclusion is this: when the five conditions are met—front-loaded constraints, layered tasks, executable acceptance, dependency compliance, and observable metrics—long-cycle automated development can stably produce runnable, verifiable intermediate results. Conversely, if any condition is missing, the faster the output, the higher the rework cost.
The lesson for engineering teams is direct: invest effort in defining constraints and building the verification system, rather than agonizing over whether a single generation is impressive. Whoever can write acceptance criteria clearly is the one who can truly turn automated capacity into deliverable quality.
