Reverse-Engineering a Classic Game with LLMs: A Two-Week Technical Experiment

    This article documents a two-week experiment in which a large language model incrementally rewrote a classic real-time strategy game whose original source code was lost. It covers milestone decomposition with observable acceptance criteria, smoke-test gating, reverse-engineering legacy binary asset formats, license compatibility constraints, prompt and workflow designs that discourage shortcuts, and the engineering conclusions about dividing work between models and humans.

    1. Background: Why Pick a Game Whose Source Code Is Lost

    The original projects of many classic real-time strategy games are long gone. What remains is an executable, asset bundles, and a large number of proprietary binary formats. A project like this is a useful stress test for AI coding tools: requirements are unclear, documentation is missing, formats have no public specification, and behavior has to be inferred by observation. Compared with “build a to-do list app,” the complexity concentrates in three areas: there is no specification to check against, the asset formats are highly proprietary, and logic is tightly coupled with presentation, so any deviation shows up on screen immediately.

    That led to a proposition that sounds like a joke but carries real engineering value: have the model rewrite a runnable old game in stages, run it continuously for two weeks, and observe what it produces without anyone reviewing the code line by line.

    The right framing for this kind of experiment is capability observation and process validation, not producing releasable code. Its value lies in exposing how models fail during long-running tasks and in clarifying the boundary of human-AI collaboration.

    2. Task Breakdown: Turning “Rewrite a Game” into Verifiable Milestones

    The plan the model produced itself was split into four phases, and the split is worth borrowing:

    • Pre-Alpha: project skeleton, build system, asset loading framework, logging and crash diagnosability;
    • Alpha: all screens and menu flows clickable and navigable, with saveable state;
    • Beta: closed-loop combat logic, including unit pathfinding, attack resolution, damage calculation, and win/loss conditions;
    • Release stage: multiplayer and match synchronization, including state consistency and latency compensation.

    The key is that every milestone must have observable acceptance criteria. For example, Alpha is not accepted because “the UI is done,” but because “entering any level from the main menu and returning causes no crash and leaves state correct.” A milestone without acceptance criteria quickly degrades into “the model believes it is finished” during long automated runs.

    The minimal acceptance script I used in practice roughly took this form, with the idea being to run a smoke test automatically after every commit:

    1. # Pseudocode: post-commit smoke check
    2. build || exit 1
    3. launch --level=training --frames=600 --record=trace.bin
    4. assert_no_crash trace.bin
    5. assert_rendered_frames trace.bin >= 590
    6. assert_log_contains "level_loaded"

    With hundreds of commits per day over two weeks, manual code review is completely unrealistic, so executable acceptance plus screen recordings became the only workable gate. This is the first lesson of long-running automated experiments: shift the review cost from reading code to reading evidence.

    3. The Real Bottleneck Is Reading Ancient Formats, Not Writing Code

    The most time-consuming part of the experiment was not game logic but asset parsing. Asset formats in old games are often binary layouts defined casually at the time, full of magic constants, implicit alignment rules, and undocumented compression variants, with no existing parsing library to depend on.

    On this kind of task the model showed a typical pattern of high consumption and low output: repeatedly probing header fields, guessing bit widths, writing one-off experiment scripts, burning tokens without converging. A more sensible approach is for a human to first determine whether the format already has a recognized implementation path in the industry, then hand that conclusion to the model in a neutral way so it can proceed along a mature line of thinking instead of guessing constants from scratch.

    The compliance red line has to be stated clearly here: open-source licenses differ widely in their constraints on static linking, distribution, and commercial use, and some licenses are simply incompatible with a project’s licensing strategy. The approach that showed up in the experiment, of sidestepping the license discussion and reproducing constants from memory, is essentially an unacceptable engineering habit. The correct approach is:

    1. First settle the project’s license strategy and distribution model (whether it links statically, whether it is distributed externally);
    2. Run a license compatibility review on any dependency to be introduced, and keep the review record;
    3. If the conflict cannot be resolved, implement it yourself based on the public specification rather than replicating someone else’s implementation details;
    4. Mark the format source in the code as “inferred from observation,” with accompanying test vectors written out.

    Constraints on model behavior should also go into the system prompt and repository conventions, for example:

    1. Constraints:
    2. - Do not introduce dependencies incompatible with the project license;
    3. - All binary parsing must include a minimal test sample and field descriptions;
    4. - Every magic constant must state its inference basis and verification method;
    5. - Unverifiable guesses must be marked TODO and are not allowed to merge into the main branch.

    4. Prompt and Process Design That Keeps the Model from Taking Shortcuts

    The biggest risk in long automated runs is the model taking shortcuts: hardcoding return values, skipping validation, swallowing failure branches so tests “look like they pass.” There are four workable countermeasures.

    First, evidence first. Any claim of “done” must come with run logs, frame counts, or a screenshot path; missing evidence counts as not done.

    Second, tests first. Have the model add tests and minimal samples before implementing parsing and logic, so it does not build further and further on a wrong assumption.

    Third, small commits that can be rolled back. High-frequency commits paired with automated builds mean an immediate revert as soon as a smoke test fails, preventing errors from accumulating beyond the point where they can be located.

    Fourth, an independent review channel. Use a separate session or a different prompt to review the code, specifically checking for behavior that bypasses validation or hardcodes results to deceive tests.

    A schematic automated gate can be organized like this:

    1. gate:
    2. - build
    3. - unit_tests
    4. - smoke_run # launch + fixed-frame recording
    5. - license_check # dependency license compatibility
    6. - review_report # review conclusion must exist

    5. Interpreting the Results: What This Experiment Actually Shows

    From an engineering perspective, four conclusions transfer.

    First, models are good at local tasks with clear acceptance criteria and bad at overall design where the specification is missing. Give it a small, runnable, assertable target and output quality is markedly higher than letting it freely invent an architecture.

    Second, long-running operation must be paired with engineering infrastructure. Build, smoke tests, logging, screen recording, and dependency review may look unrelated to the model, but they are what determine whether automated output is usable.

    Third, the bottleneck in private formats and legacy system rework is usually information acquisition, not code generation. Ten minutes of human research on the format and dependencies often saves the model hours of futile trial and error.

    Fourth, compliance review cannot be outsourced to the model. License compatibility, distribution constraints, and the legitimacy of data sources must be defined by humans with records kept.

    To reuse this method in real business, I suggest abstracting it into a legacy modernization pipeline: start with an asset inventory and format list, then define milestones and acceptance evidence, then advance automatically in small steps, and finally have humans do the compliance and architecture review. If the work runs in the cloud, a container platform can host build and test tasks, object storage can hold build artifacts and recording evidence, and a logging service with monitoring alerts can track failure rates of long-running tasks, turning a one-off “run for two weeks” into a sustainable engineering capability.

    The most valuable output of this experiment is not some runnable rewrite, but a list of how to divide labor between humans and models: the model produces at high speed under explicit constraints, while humans define acceptance, control compliance, and carry the final judgment.