Reverse Engineering a Classic RTS Game with AI: A Practical Engineering Workflow

    This article walks through a real-world effort to mod a classic real-time strategy game using AI-assisted reverse engineering. It explains why the original platform fell short of the expansion platform, defines three representative logic gaps (open-top transport firing, garrison fire and kill attribution, and unified air attack behavior), and lays out a five-step workflow: capture the symptom, supply real context, enumerate mutually exclusive hypotheses, batch-verify patches, and write conclusions back into searchable documentation. It also covers landed results in skirmish mode, a three-layer approach to pathfinding congestion, ghost-cell cleanup, crash triage, and the limits of what AI tooling can and cannot decide.

    1. Background: Why “Wanting to Do It” and “Being Able to Do It” Are Separated by a Wall

    Seventeen or eighteen years ago, reference material, assets, and tutorials in the modding community were scarce. Most modders could only rely on third-party trainers to tweak values in surface-level configuration files, and the works available for download were mostly built on the expansion platform. The original platform was more appealing in terms of narrative style, but the expansion platform was clearly more mature in mechanical completeness and third-party extension ecosystems. This mismatch between preference and capability was a shared predicament for that generation of modders.

    When modders actually sat down to implement their ideas, they found that the original platform was missing large amounts of logic layers that were only filled in later. The usual outcome: a huge pile of assets collected, dozens of pages of design and planning written, and none of it shippable because the platform had no audience for it. An unwritten rule in the community held that if a problem was not something everyone was rushing to solve, there was no point asking about it everywhere. So the problems sat unresolved for years.

    The maturation of AI coding tools over the past three years changed the economics of this chain. Work that once required reading assembly, digging through memory addresses, and waiting for a community expert to weigh in can now be compressed into a loop of “describe the symptom, get hypotheses, verify in batches.” The tool does not make decisions for you; it only reduces the cost of trial and error from weeks to hours.

    2. Locating Three Typical Bottlenecks

    The most time-consuming part of modding is not writing configs. It is identifying that “the platform simply does not have this logic.” Three categories of problems are representative.

    The first is missing open-top transport logic. Without it, heavy vehicles can only serve as sealed transport compartments: passengers cannot fire outward, making them less useful than cheap transport trucks. The essence of the problem is not values but that no firing-attribution rule between the vehicle and its passengers exists.

    The second is the divergence between two implementations of garrison fire and kill attribution. In one implementation, a building switches its primary and secondary weapons based on the type of the first infantry unit to enter, and kills are credited to the building. In the other, each basic infantry unit holds its own garrison weapon, kills are credited to the infantry unit, and experience is awarded. The result is that the same feature is significantly weaker on defensive structures, and the progression system stops working.

    The third is that flying units are all handled by a single attack mode. When the platform applies the same bombing logic to every air unit, a newly added air unit produced by a vehicle factory, which never lands and attacks with a ranged weapon, will still fly directly above the target before firing, completely defeating the unit’s intended role.

    3. The AI-Assisted Reverse Engineering Workflow

    The effective approach is not to have the model “guess the answer,” but to treat it as a tireless reverse engineering assistant. The recommended process:

    1. Fix the symptom: write a minimal description of the reproducible behavior, including platform version, trigger conditions, expected behavior, and actual behavior.
    2. Feed context: provide real material such as config file snippets, log snippets, and address offset tables, so the model does not invent fields that do not exist.
    3. Enumerate hypotheses: ask the model for multiple mutually exclusive hypotheses, each annotated with its verifiable characteristics.
    4. Verify in batches: apply patches one by one in hypothesis priority order, and run fixed test cases with automation scripts.
    5. Write conclusions back: turn verified conclusions into documentation the community can search, creating a positive feedback loop.

    A sample prompt structure:

    1. Role: Senior reverse engineer
    2. Platform: A classic RTS original platform (not the expansion)
    3. Symptom: A newly added air unit hovers above the target and drops bombs
    4. Known material: <config snippet> <log snippet>
    5. Requirement: Provide 3 mutually exclusive hypotheses, each annotated with verifiable characteristics and verification order
    6. Constraint: Do not fabricate field names that do not exist; explicitly mark uncertain points as "to be verified"

    The last constraint is the critical one. When material is lacking, models tend to invent plausible-looking fields and parameters, which directly contaminates the verification process.

    4. Landed Modding Results

    In single-player skirmish scenarios, the modded build behaves as follows: the AI can organize continuous, uninterrupted attack waves; the traffic-jam problem when large numbers of infantry gather is noticeably reduced; and mode-specific custom AI scripts can be loaded, with on-screen forces reaching the scale of a full infantry regiment in high-intensity combat modes.

    The approach to pathfinding congestion breaks into three layers: first, path cost correction, dynamically raising the traversal cost of crowded cells; second, formation decoupling, splitting large formations into several smaller squads that depart at staggered times; third, target point dispersion, avoiding having every unit compete for the same destination. Pseudocode:

    1. def cost(cell, tick):
    2. base = terrain_cost(cell)
    3. crowd = occupancy(cell, radius=1)
    4. return base * (1 + crowd * CROWD_WEIGHT) + queue_penalty(cell, tick)
    5. def dispatch(units, target):
    6. for squad in split(units, size=SQUAD_SIZE):
    7. schedule(squad, target, delay=squad.index * STAGGER_TICKS)

    Ghost cells are usually not fixed at a single point but handled in three steps: scan, judge, reclaim. Traverse the map cells, mark cells that are impassable but have no visible object, then decide whether to reclaim them based on the connectivity of adjacent cells. For miscellaneous crash issues, the recommendation is to first establish a reproducible test case, then narrow the scope layer by layer along the call stack. Never blindly modify configs without a stable reproduction path.

    5. Methodological Limits and Engineering Advice

    It must be acknowledged that the transferability of this kind of work is limited. Understanding of parameters comes largely from accumulated personal experience, and the quality of model output depends entirely on how precise the instructions are and how complete the material is. Modders are therefore advised to focus on three things: build your own test case library, maintain a change-to-symptom reference table, and consolidate verified conclusions into documentation.

    If the modding workflow involves large-scale assets and version management, general cloud capabilities can help carry the load: object storage for assets and build artifacts, container platforms for running batch verification jobs, and logging services with monitoring and alerting to track changes in crash rates. The role of these general-purpose capabilities is to make “batch trial and error” sustainable, not to replace understanding of the game mechanics themselves.

    In summary, the real value of AI coding tools is pushing long-shelved “theoretically feasible” work to “deliverable in engineering.” They free modders from repetitive labor, but mechanic design, tradeoff decisions, and final acceptance still have to be done by people.