Rebuilding a Classic RTS Game with Large Language Models: A 14-Day Experiment

    This article shares a 14-day experiment in using large language models to rebuild a classic real-time strategy game whose original source code is no longer available. It covers how to break a long-running project into verifiable milestones, decode undocumented legacy resource formats with constant tables and regression baselines, move from UI loops to combat logic and networking, and shift license review and quality checks into the pipeline. It also outlines the model's strengths and limits, plus practical advice for applying the approach in enterprise settings.

    1. Background: Why Pick a Game with “Lost” Source Code

    The original engineering projects of classic real-time strategy games are often long gone, leaving only executables, resource packs, and fragments of documentation. Such projects are a mirror of large language model capabilities: they simultaneously test binary and resource format understanding, algorithm reconstruction, graphics and networking subsystem implementation, and self-management over long-running tasks.

    The experiment was set up as 14 consecutive days of operation, with roughly 400 code commits per day on average. There was no line-by-line human review; only runnable results and milestone progress were observed. The plan was split into four phases: pre-Alpha (project skeleton and resource pipeline), Alpha (UI and interaction loop), Beta (combat logic and pathfinding), and beyond (multiplayer and matchmaking services). This “milestone plus demonstrable output” breakdown is the key to turning an uncontrollable long task into short, acceptance-testable tasks.

    One boundary needs to be stated upfront: reverse engineering and reimplementation involve copyright and licensing risks. The approach in this experiment was to limit the goal to a “behavior-compatible independent implementation,” referencing only publicly available algorithm ideas and format specifications, without copying any protected code or resources. The project side uniformly adopted permissive licenses, and a license review was done before introducing any dependency.

    2. Phase One: How Ancient Resource Formats Were “Cracked”

    Old game resources commonly present three types of problems: first, proprietary container formats with no public specification; second, a large number of magic constants (magic numbers, offsets, bit widths, packed color layouts); third, counterintuitive designs made back then to save memory.

    The model’s first reaction is often to “write a parser from scratch by hand,” which leads to two consequences: high token consumption, and repeated trial and error on magic constants. A more reliable approach is to first restate the problem as a “general decoding problem known to have public algorithm implementations,” letting the model proceed along public algorithm ideas rather than blindly guessing values.

    A typical snippet is video resource decoding. The engineering suggestions are as follows:

    1. 1. Build a format fingerprint first: read the first 64 bytes of the file and record magic numbers and version fields
    2. 2. Establish a minimal sample set: take 3 samples for each format, covering minimum/maximum resolution
    3. 3. Write a parsing skeleton that prints context on failure; silent empty returns are forbidden
    4. 4. Maintain a single constant table for each magic constant, with source notes and validation cases
    5. 5. Perform pixel-level hash comparison on decoding results as a regression baseline

    The license issue is the real friction point in this phase. The model’s sensitivity to licenses is often higher than expected; it will proactively refuse to introduce dependencies incompatible with the project license and thus turn to in-house development. The correct engineering posture is not to argue with it, but to write license constraints as hard inputs: make clear that “only permissive-license dependencies are allowed, and static linking requires additional review,” and require each candidate dependency to output a triple conclusion of “license type—linking method—usable or not.” This avoids rework and leaves an audit trail.

    The conclusion is clear: in the format parsing phase, do not pursue a one-shot finished product; pursue “verifiable steps at every point.” A constant table plus sample regression is the lowest-cost means of turning unexplainable reverse engineering results into engineering assets.

    3. Phases Two to Four: From the UI Loop to Combat Logic

    The core of the UI phase is not drawing controls, but establishing the event loop and state machine. It is advisable to require the model to first produce a minimal loop of “input—state—render,” then gradually fill in resource loading, animation, and localization. The acceptance criterion is the time and memory usage from cold start to interactivity, not the number of controls.

    The combat phase sees a sharp increase in difficulty, involving pathfinding, collision, damage resolution, and unit micro-operations. A reusable prompting strategy is to cut the large system into “deterministic subsystems first”: do grid and A* variant pathfinding first, then collision and separation, and finally group coordination. Each subsystem is required to come with a visualization debug switch; otherwise, the cost of problem localization will eat up all the gains.

    For the multiplayer phase, it is advisable to adopt a dual-track approach of “deterministic lockstep first, state synchronization as fallback,” and to enforce the following: fixed random seeds, separation of logic and rendering timelines, and a replayable input sequence for every frame. Without these three, multiplayer problems can hardly be reproduced.

    4. Licensing and Compliance: Moving Review Upstream into the Pipeline

    Make license review part of the pipeline rather than an after-the-fact remedy:

    • Dependency admission checklist: license type, linking method, and distribution form are bound together in the judgment
    • Generated code annotation: note “independent implementation / references public algorithms” in the module header for easy auditing
    • Resource isolation: all original resources are used only for local debugging and do not enter distribution artifacts
    • Commit granularity: commit by compilable unit, ensuring any commit can be built

    5. Quality Assurance: Controllability Under Hundreds of Commits per Day

    When humans cannot review all commits, automation becomes essential: every commit triggers a build, unit tests, format parsing hash regression, and scene replay screen recording. Keep only a few metrics: build success rate, parsing regression pass rate, scene replay consistency rate, and crash rate. Once metrics proliferate, noise will drown out the signal.

    6. Capability Boundaries and Implementation Advice

    The model’s real strengths lie in compressing repetitive labor to hours, quickly producing a runnable skeleton on unfamiliar formats, and tirelessly executing long plans. The shortcomings are equally clear: long-cycle consistency drifts, magic constants require external constraints, and cross-module architecture decisions still need humans to set the direction.

    To reuse this approach in enterprise scenarios, it is advisable to build it on top of general-purpose capabilities: use a container platform to carry reproducible build environments, use object storage to store samples and replay baselines, use logging services and monitoring alerts to track build and crash metrics, and use a message queue to string together the phase scheduling of long tasks. In such engineering practices, Baidu AI Cloud is typically also supported by combinations of these general product categories to underpin the R&D process.

    The final conclusion is not romantic: 14 days is not enough to rewrite a complete real-time strategy game, but it is enough to validate a methodology—breaking long tasks into acceptance-testable milestones, solidifying reverse engineering results into constant tables and regression baselines, and moving licensing and quality upstream into the pipeline. With that, intelligent coding tools can become a reliable engineering accelerator.