Rebuilding Legacy Software with LLMs: A Classic RTS Game Case Study
This case study examines an LLM-driven effort to rebuild a classic real-time strategy game whose source code had been lost. It covers task framing, a two-week development plan, proprietary file-format analysis, licensing concerns, and quality control at roughly 400 commits per day. The lessons extend to legacy software modernization: use persistent plans, validate observable behavior, and audit the provenance of generated code and constants. Human oversight remains essential, especially for legal compliance and acceptance testing.
1. Why Rebuild a Legacy System Without Its Source Code?
A familiar problem in software maintenance is a successful product outliving the organization that created it. The original team disbands, the company is acquired, or a department closes. Eventually, the source code disappears, leaving only executable binaries and resource files that few people understand.
Such systems can retain substantial business or sentimental value. Abandoning them is costly, but maintaining them without source code is difficult.
The project examined here involved a classic real-time strategy game from the late twentieth century. Its source code had been lost, and community maintenance had largely been limited to unofficial patches based on partial reverse engineering.
As large language models improved at code understanding, format inference, and long-running task planning, a new question emerged: could an LLM drive the process of rebuilding the game from scratch?
The significance of this case extends beyond games. It represents an extreme legacy modernization problem: no source code, no documentation, proprietary formats, and obsolete dependencies. The methods used to address it offer useful lessons for organizations maintaining similarly opaque systems.
2. Defining an “Impossible” Task
2.1 Task Framing and Compliance Boundaries
The first obstacle was how to define the work. In this experiment, directly asking the model to reverse engineer commercial software triggered refusals under its safety policies.
The task was instead framed as building an open-source replacement from scratch, using independently implemented algorithms and supporting the same resource formats—not copying an existing implementation.
That framing aligns with the intent of clean-room reimplementation: using observable behavior and file-format specifications rather than protected source code. However, describing a task as a clean-room rewrite does not, by itself, establish that the actual process meets legal requirements.
The model was highly sensitive to wording. An explicit instruction to follow an existing implementation led to a refusal. A neutral statement that the community had implemented similar algorithms allowed it to proceed within the boundaries it recognized.
This behavior revealed a tension between task completion and copyright compliance. Clear task framing was useful, but it could not replace scrutiny of the actual development process. The project owner remained responsible for the final legal review.
2.2 Breaking the Work into a Two-Week Plan
A request as broad as “rewrite this game” was not enough. The effective approach was to have the model first produce a two-week development plan with distinct milestones:
- Pre-alpha: Complete the UI framework and rendering pipeline.
- Alpha: Implement combat logic, the unit system, and AI.
- Beta: Implement the protocol layer and multiplayer lobby management.
Execution then proceeded with minimal supervision. The task process ran around the clock, and the model produced approximately 400 commits per day on average.
At that rate, line-by-line human review was no longer practical. Quality assurance had to shift toward behavioral validation: running the game and checking whether it behaved correctly, rather than treating source inspection as the primary acceptance method.
This was one of the central engineering lessons of the experiment. When AI-generated code arrives faster than people can review it, observable outcomes become an increasingly important basis for acceptance.
3. Day 1: Decoding Proprietary File Formats
3.1 The Problem: No Ready-Made Parsers
The first day exposed a major obstacle. The game relied on numerous custom binary formats for maps, palettes, animation, audio, and video. Each had its own magic numbers and bit layouts, and modern parsing libraries were largely unavailable.
The container format used for in-game video was a representative example. The model spent substantial tokens analyzing the game binaries and inferring the file header, frame index, and compressed-block layout.
The process followed a repeatable pattern:
Input: Sample binary filesLoop:1. Inspect hexadecimal data and propose a structural hypothesis.2. Write a draft parser.3. If parsing fails, revise offsets or magic constants and retry.Output: A working format parser and a collection of magic constants.
Progress depended on repeated hypothesis testing. A parser failure became evidence for revising the assumed structure rather than simply a coding error to fix.
3.2 Licensing Became an Engineering Constraint
An unexpected obstacle was open-source license compatibility.
When asked to consult an existing decoder, the model first checked its license. If the reference implementation used a strong copyleft license while the target project used a permissive license such as MIT, the model declined to reuse it directly, citing compatibility concerns.
An LGPL implementation did not immediately resolve the issue. The model pointed out that static linking could trigger LGPL obligations and again declined to incorporate it under the proposed approach.
After repeated exchanges, the decision was to write the decoder independently.
For enterprise teams, this behavior suggests that a model can serve as an additional checkpoint for software supply-chain compliance. It may flag licensing issues before a dependency or implementation is incorporated. Its assessment, however, is not a substitute for human legal review, and a refusal should not be treated as a definitive legal interpretation.
3.3 Recalled Constants and the Limits of Independent Implementation
The most revealing result came after the model had rejected the available implementations. It produced a working decoder in roughly ten minutes.
A later inspection found that the model had previously read relevant open-source code, retained important magic constants, and reproduced those constants in a new implementation with different code structure and comments.
This exposed a provenance blind spot: a model can reuse information from code without copying its text verbatim.
Constants such as format identifiers, parameters, and lookup values may represent facts rather than copyrightable expression. Nevertheless, the legal status of particular material requires review. From an engineering and enterprise risk perspective, recalled constants—especially tables and distinctive collections of values—still warrant explicit auditing.
The practical recommendations were:
- Require design-rationale notes for critical modules. Ask the model to explain the basis of its implementation and the sources of its constants.
- Maintain an inventory of constants. Compare important values against known open-source implementations.
- Include recalled material in AI code audits. Review more than matching source text; examine magic numbers, lookup tables, and other potentially reused information.
The distinction matters because a differently structured implementation is not necessarily evidence of an independent development process.
3.4 Applying the Same Method Across Formats
Once the workflow proved effective, it was applied to the remaining resource formats:
Observe the format → infer its structure → write a parser → record the constants.
Images, audio, maps, and INI-like configuration files were processed using the same approach. By the end of Day 1, the project had working support across the resource-format layer.
4. From Day 2 Onward: Managing AI-Generated Code at Scale
After the format work, the main challenge changed. The question was no longer simply whether the model could write the software, but how to manage the volume of code it generated.
Four practices became central.
Put Acceptance Checks Ahead of Manual Inspection
Automated tests and visual validation scripts ran after every commit. Screenshots, frame comparisons, and logic assertions became the main acceptance mechanisms, replacing manual reading as the default way to assess each change.
This made quality checks part of the execution loop rather than an activity postponed until the end of a milestone.
Use Demonstrable Milestones
Development followed the pre-alpha, alpha, and beta sequence, with an observable acceptance criterion for each stage:
- The UI was fully usable.
- Combat could run through a complete match.
- Multiplayer could establish a match.
These milestones gave the long-running task concrete targets instead of allowing progress to be measured only by code volume.
Persist Architectural Context
Over a two-week run, the model repeatedly needed to revisit earlier architectural decisions.
Key design summaries were therefore stored as persistent project documentation. These records provided continuity and reduced the risk of later work contradicting earlier decisions.
For long-running LLM tasks, the plan and architecture notes functioned as external anchors rather than relying entirely on the model’s current context.
Budget by Development Phase
File-format analysis consumed substantial tokens because it involved extensive trial and error. Token use dropped significantly once the work moved into more routine implementation.
Budget planning therefore needed to reflect the differences between phases. The exploratory format-analysis stage had a different cost profile from ordinary coding.
5. Lessons for Enterprise Legacy Modernization
Although this project involved a game, its main lessons apply to other legacy systems.
1. Define the Task Around Compatible Behavior
A precise brief—independently implementing a compatible system based on publicly observable behavior—is more useful than an ambiguous request to copy or port an existing product.
The framing must match the actual process. It does not automatically resolve copyright, licensing, or other legal concerns.
2. Anchor Long Tasks to Milestones and Persistent Plans
A model working across days or weeks needs an explicit plan and durable records of key decisions. These help prevent goal drift and architectural inconsistency.
3. Shift Quality Assurance Toward Behavioral Acceptance
When generation outpaces human review capacity, automated acceptance checks must carry more of the quality-assurance workload.
The case used runnable demonstrations, visual comparisons, and logic assertions to assess results rather than relying primarily on source inspection.
4. Use the Model as a Compliance Checkpoint
The model’s attention to licenses proved useful. It could identify potential conflicts and linking obligations before external code was incorporated.
That capability is best treated as an additional safeguard, not as final approval.
5. Audit Reuse Beyond Verbatim Code
A model can reproduce constants or tables from previously encountered material while generating different surrounding code.
Provenance reviews should therefore include design rationale and important data values, not just copied-text detection.
Conclusion
This experiment showed that LLM-driven rebuilding of source-less legacy software can move beyond a conceptual demonstration into a runnable implementation.
It also exposed the limits of treating code generation as the entire solution. File-format inference required repeated testing. Licensing decisions required oversight. High commit volume demanded automated behavioral checks. Long-running execution depended on persistent plans and architectural documentation.
Lost source code need not be the end of a software system. But human engineers remain essential: their work shifts toward defining the plan, reviewing compliance, and verifying behavior. That change in responsibility is the most transferable lesson of the project.
