Can AI Coding Tools Reliably Reverse-Engineer and Rebuild a Classic Game?

    This article examines an experimental project that used AI coding tools to reverse-engineer and rewrite a classic real-time strategy game whose original source code was lost. It breaks down the work into four delivery phases, shows why format reverse-engineering—not coding—is the real bottleneck, and highlights license compliance risks, the dual nature of model memorization, and orchestration practices for long-running automation. Readers will learn the current capability boundaries of AI coding tools in legacy system modernization and get a minimal action checklist for starting similar projects.

    Introduction: An Engineering Experiment That Sounds Absurd

    “Use an AI coding tool to reverse-engineer a classic real-time strategy game whose source code was lost long ago, and rewrite it from scratch.” The premise itself is highly experimental. Its value is not in truly recreating a commercial title, but in putting an extreme scenario on the table: when source code is missing, documentation is scattered, formats are proprietary, and no parsing libraries are available, how much of the workload can AI coding tools actually handle, and where do they lose control?

    Rebuilding such legacy systems is extremely common in real-world engineering: early embedded firmware, discontinued desktop software, and internally developed legacy protocol stacks often leave behind only executables and a pile of modules that “nobody dares to touch.” The lessons from this experiment therefore transfer to scenarios far more serious than a game.

    1. Task Breakdown: Splitting “Rewrite” into Deliverable Phases

    The original effort did not start by writing code. It first produced a roadmap spanning two weeks, divided into four progressive stages:

    • Pre-Alpha: parse formats and data structures, and establish a minimal runnable skeleton;
    • Alpha: make the UI layer usable, including graphics, text, and menus;
    • Beta: close the loop on core gameplay such as combat logic, pathfinding, and damage calculation;
    • Multiplayer: state synchronization and matchmaking services.

    This breakdown is a prerequisite for the success of AI-assisted development. The reason is that a model’s context window and attention are limited. Describing “rewrite an entire game” in one shot only yields generic architectural advice. Compressing the goal into a small, verifiable task—such as “parse the keyframe structure of a certain video container format”—significantly improves output quality.

    The pace in practice was roughly 400 code commits per day. At that volume, reviewing every line manually is completely unrealistic, so acceptance had to shift from “reading code” to “observing behavior”: can it correctly play an opening animation, render a unit, or resolve an attack. This also suggests that in the era of high-speed AI output, the core engineering skill is shifting from coding toward test design and observability.

    2. The Real Bottleneck Is Not Writing Code, but Reverse-Engineering Formats

    Nearly all of the first day’s output went into format analysis. Older games heavily use proprietary binary formats: asset archive formats, sprite atlas formats, and animation and video container formats, generally lacking public specifications and mature parsing libraries. A typical trait of these formats is dense “magic constants”—offsets, bit widths, initial color table values, and block sizes all come from some engineer’s debugging session years ago.

    An effective approach is to first establish a format-probing workflow, then hand it to the model for batch processing:

    1. # Example: general steps for probing a format
    2. def probe_format(data: bytes):
    3. magic = data[:4] # 1. Identify the magic number to determine the container type
    4. header = parse_header(data) # 2. Parse header fields and version number
    5. blocks = split_blocks(data, header) # 3. Split into blocks
    6. return [decode_block(b) for b in blocks] # 4. Decode and validate each block

    Comparing the differing bytes across multiple sample files in a hex view can quickly reveal which fields are constants and which change with content. Doing this step solidly means every later parser can reuse the same skeleton.

    3. License Compliance: The Most Overlooked Minefield in the AI Era

    The most dramatic moment in practice came when choosing a video decoding approach. The model proactively checked the licenses of candidate implementations and found that one used a strongly copyleft open-source license incompatible with the project’s permissive license, while another used a weakly copyleft license that still posed risk under static linking. After repeated deliberation, the conclusion was to implement it in-house.

    This episode reveals a real and frequent engineering risk: AI-generated code may implicitly introduce implementations incompatible with the project’s license. Practical governance measures include:

    • Clearly declare the target license in the project root and write it into the model’s system prompt;
    • Establish a dependency whitelist that only allows components with clear licenses;
    • Add license scanning and dependency composition analysis to continuous integration as a mandatory gate for merging;
    • Stay wary of algorithms the model “writes from memory,” and manually verify the sources of critical modules.

    4. “Reciting Is Not Copying”: The Double-Edged Nature of Model Reuse

    Practice surfaced a rather insightful observation: directly asking the model to copy a certain implementation often led it to refuse; but merely mentioning that “the industry already has a mature algorithm for this problem” would prompt it to produce a highly similar implementation on its own, even fully reproducing magic constants that originally required repeated debugging.

    From an engineering perspective, this is both an efficiency dividend and a source of risk. The dividend is that the model genuinely compresses publicly available technical knowledge into callable capability, shrinking what used to take days of debugging into a dozen minutes. The risk is that this “memory reproduction” bypasses explicit citation, making code provenance untraceable.

    The recommended practice is therefore to use “refer to existing algorithms” as a prompting strategy to speed things up, while establishing provenance records for all modules involving third-party algorithms, noting the reference source and license conclusion, rather than relying on the model’s self-restraint.

    5. Orchestrating Long-Running Automation

    Running continuously for two weeks is essentially a long-running task orchestration problem. Reusable key points include:

    1. Queue tasks: break the roadmap into task cards with priorities and acceptance criteria, and feed them one by one;
    2. Persist state: at the end of each round, write progress, open questions, and format notes into structured documents to avoid context loss;
    3. Automate verification: prepare executable acceptance scripts for each stage, and roll back on failure;
    4. Keep changes traceable: high-frequency commits must be paired with automated static checks, unit tests, and build pipelines;
    5. Control costs: observe call volume and failure rates through logging services and monitoring alerts, and set budget and circuit-breaker thresholds.

    When running in the cloud, it is common to use container platforms to host build and test environments, object storage to keep sample assets and artifacts, message queues to decouple task distribution, and logging and monitoring systems to track the health of long-running tasks.

    6. Capability Boundaries and Conclusion

    This experiment proves something quite clear: on tasks with clear structure and automatable acceptance criteria, AI coding tools can handle the vast majority of the coding workload, compressing the human role into “defining goals, designing acceptance, and handling compliance and exceptions.” What they cannot replace is equally clear: real architectural trade-offs, license and legal judgment, and cross-module complex defect localization must still be handled by people.

    For teams preparing to start a legacy system rebuild, the minimal action checklist is: first fill in automated testing and observability, then clarify the license strategy, and only then hand the task queue to AI for batch execution. Reverse the order, and you will almost certainly be stuck in unconverging rework by the third week.