Using LLMs to Reverse-Engineer and Modernize a Classic RTS Game's AI: Lessons from a Decade-Old Modding Project

    How large language models can compress the most time-consuming part of reverse engineering—understanding unfamiliar code. A veteran modder shares three real-world cases of using LLMs to fix pathfinding congestion, restructure AI configuration, and restore missing logic in a classic RTS game, along with practical lessons for anyone combining AI assistance with binary modding.

    Background: A Modding Project Shelved for Over a Decade

    Many longtime gamers have had the same thought: taking a classic real-time strategy game that has accompanied them for years and remaking it into “what I actually want it to be.” More than a decade ago, modding tutorials and resources were scarce, and most people could only rely on third-party editors to make simple configuration tweaks. Deeper mechanical changes—making the AI smarter, or giving certain units abilities that only existed in the expansion pack—were usually impossible because the original engine simply lacked the corresponding logic.

    I had accumulated a large pile of design notes and implementation plans, but they all got shelved because the original platform lacked the necessary underlying mechanics. There’s an unwritten rule in the modding community: if a problem isn’t something everyone is actively trying to solve, there’s no point asking around about it. So these ideas sat untouched for over ten years.

    Things changed once large language models became genuinely capable of code comprehension and reverse-analysis assistance. This article documents how I used an LLM to pick this project back up, focusing on a few cases of things that were “completely impossible back then, but doable now.”

    Why LLMs Are Well Suited for This

    The core difficulty of reverse-engineering an old game isn’t “writing code”—it’s “reading code.” In games like this, engine logic is scattered across numerous binary modules, configuration files, and in-memory structures. Traditional reverse engineering requires:

    1. Reading disassembly function by function, which is enormously labor-intensive;
    2. Understanding a large amount of legacy naming conventions and hack-style code;
    3. Building connections across multiple systems (pathfinding, weapons, faction AI, vehicle garrisoning).

    LLMs happen to excel at exactly this kind of work: they can quickly digest large chunks of disassembled pseudocode or the source code of open-source reimplementation projects, summarize “what this logic does,” and—based on your natural-language description—infer the range of functions and call chains that need modification. In other words, they compress the most time-consuming part of reverse engineering, the “understanding” phase, by an order of magnitude, while the critical decisions and verification still remain with the human.

    One important caveat: the model’s conclusions are not always correct, especially when it comes to specific memory offsets and struct layouts—everything must be verified through actual testing. My workflow was always “the model provides analysis and direction; I make the changes and run regression tests.”

    Case 1: Pathfinding Optimization—Fixing the “Massive Traffic Jam” Problem

    The most obvious flaw in the original game’s AI when organizing large-scale attacks is that infantry units cluster together and block each other after gathering, creating a “traffic jam” where the entire army gets stuck halfway, unable to advance or retreat. This is a classic pathfinding congestion problem in the original engine.

    I fed the pathfinding dispatch logic and AI squad-generation pseudocode to the model and asked it to analyze the movement decision flow for units near the rally point. After a few rounds of dialogue, we pinpointed the root cause: the avoidance strategy units used when approaching the rally point was too simplistic—when encountering an occupied tile, units tended to wait in place rather than route around it.

    Based on this analysis, I made two types of changes:

    • Adjusted the pacing of squad deployments, preventing hundreds of units from being funneled into the same path all at once;
    • Modified the congestion-tile release logic so that blocked units would actively look for alternate routes after a wait timeout.

    The improvement was immediately visible: in single-player skirmish mode, the AI could now organize continuous large-scale wave attacks, the “traffic jam” during mass infantry gatherings was significantly reduced, and the density and pressure of forces on the battlefield moved up a whole tier.

    Case 2: Mode-Based AI Configuration—Screen-Filling Armies on the Scale of a Full Regiment

    The second goal was to have the AI load different strategy files depending on the game mode. The original AI scripting system was fairly rigid and made per-mode configuration difficult.

    I had the model map out the call chain from mode selection to AI configuration loading, confirmed the injection point, and then implemented a simple selection mechanism (illustrative):

    1. // Pseudocode: select AI profile based on game mode
    2. if (gameMode == MODE_SURVIVAL) {
    3. loadAIProfile("aggressive_full_army");
    4. } else {
    5. loadAIProfile("default");
    6. }

    In modes like “last stand,” the AI can now field on-screen forces approaching the size of a fully manned regiment, with an attack intensity rivaling the best-regarded expansion pack of its era. Achieving this reliably through manual configuration edits alone would have been practically impossible in the past.

    Case 3: Restoring Logic That Was Missing or Broken in the Original

    This is where the model proved most valuable, because the original game was missing several key pieces of logic compared to the expansion pack:

    1. Missing open-fire logic for occupied vehicles: In the original game, multi-crew vehicles were essentially “tin cans”—even fully loaded with infantry, they couldn’t fire outward, which made them of little practical value. The expansion pack introduced a “top-open vehicle” mechanic. Using the model’s analysis of the weapon-switching and vehicle-firing flow, I simulated similar behavior on the original engine.

    2. Inconsistent kill attribution for garrisoned troops: The original game and the expansion pack used two different logic paths for garrison fire—the former credited kills to the building itself, while the latter credited them to the garrisoned infantry, allowing them to gain experience. This directly affected the functional completeness of defensive structures. By comparing the pseudocode of both implementations, I corrected the original’s behavior to the more reasonable approach.

    3. Incorrect attack behavior for non-landing aircraft: The original game applied a single bombing-attack logic to all flying units that couldn’t land, so if you added a “non-landing, long-range attack” aircraft, it would still fly directly over the target before firing—rendering it useless. The model helped me locate the branch that dispatched attack methods, and I added a handling path for long-range attacks.

    The common thread in these problems: the fixes themselves were small, but locating them was extremely difficult. In the past, I couldn’t even identify which module a problem lived in. Now, the model can produce a handful of high-probability candidate locations within minutes, which completely changes the efficiency of manual verification.

    Practical Lessons for Fellow Modders

    1. Prompt quality determines output quality: How well the model understands a mechanism depends heavily on how you describe the problem. Providing as much context as possible—engine version differences, known historical behavior, your desired target behavior—works far better than a vague “help me fix this bug.”
    2. Never blindly trust the analysis: When it comes to precise details like memory offsets and struct layouts, the model may confidently produce wrong answers. Every change must pass regression testing on the actual game.
    3. Verify in small steps: Change only one logic point at a time, confirm the behavior matches expectations, then move on to the next. This avoids multiple changes interfering with each other and becoming impossible to debug.
    4. Keep your own judgment: The model is an accelerator, not the decision-maker. Your understanding of the game, your taste, and your trade-off decisions are the parts no tool can replace.

    Final Thoughts

    All the plans I shelved more than a decade ago due to missing engine logic now mostly have a viable path to implementation. For a hobbyist modder like me, the greatest value of large language models isn’t “writing the game for me”—it’s lowering the once-insurmountable barrier of reverse engineering, making personal passion and years of accumulated knowledge meaningful again. If there’s an old game sitting in your bookmarks folder that you’ve always sworn to “someday remake into its ideal form,” now might be the perfect time to reopen it.