LLM-Assisted Reverse Engineering: Modifying a Classic RTS Game Engine

    A practical account of using large language models to modify a legacy real-time strategy game engine with limited documentation and no source code. The project addresses AI attack scheduling, unit congestion, blocked grid cells, garrison fire, aircraft behavior, and crashes through a repeatable cycle of hypothesis generation, minimal changes, and in-game testing. It also shows how mode-specific AI configurations can produce different combat experiences within the same engine.

    Discussions about practical AI applications often overlook a particularly challenging use case: modifying old game engines that are no longer maintained, poorly documented, and supported by shrinking communities.

    Claims about the capabilities of new models are common; detailed accounts of what they actually help solve are less so. This article follows one project to reshape a classic real-time strategy (RTS) game from more than a decade ago, using a large language model (LLM) to investigate engine behavior and develop workable modifications.

    The value was not in asking a model to produce a complete solution. It came from a repeated cycle of proposing explanations, making small changes, testing them in the game, and preserving what worked.

    1. Background: A Modding Project Blocked by Engine Limitations

    More than a decade ago, modding guides and technical references for this game were scarce. I relied on third-party editing tools to make relatively simple configuration changes. Most popular mods targeted the base game, whose engine lacked many mechanisms available in more modern platforms.

    My goal was straightforward: could I modify the base game to support the experience I wanted?

    I collected assets, definitions, and plans, but soon found that essential underlying logic was missing. Many ideas could not get past the first implementation step. The community also had limited capacity to investigate niche problems: unless an issue affected many modders, asking around rarely produced an answer. The project stalled.

    This was a familiar legacy-system problem:

    • No access to source code
    • Incomplete documentation
    • A shrinking pool of experienced contributors
    • A high cost of trial and error

    Those constraints made it a useful setting for LLM-assisted investigation.

    2. Why Use an LLM for Reverse Engineering?

    Traditional reverse engineering relies on disassembly and extensive manual experimentation. For an old game like this one, the readily available material usually falls into two categories:

    1. Readable configuration files, typically INI files. These define unit attributes, weapons, and AI behavior, but many fields have unclear semantics.
    2. Accumulated community knowledge. Forum posts and fragmented documentation contain valuable observations, though their quality and completeness vary.

    An LLM can help connect these fragments in several ways:

    • Broad knowledge of engine design: Familiarity with state machines, pathfinding grids, garrison slots, and projectile logic helps it map observed behavior to plausible mechanisms.
    • Hypothesis generation: For an unknown field, it can propose several possible meanings and experiments that distinguish between them.
    • Translation between representations: It can help interpret old configuration syntax, pseudocode, and disassembly snippets.

    The model is not an oracle. Its explanations must be tested against the actual game.

    The workflow I settled on was:

    Generate hypotheses → Make a minimal change → Reproduce the behavior in-game → Record the result → Update the context

    This loop was far more useful than treating a single answer as a definitive explanation.

    3. Problems Addressed in Practice

    AI Attack Scheduling and Large-Scale Unit Congestion

    In the original skirmish mode, the AI often attacked with small groups. Meanwhile, large infantry formations crowded intersections and assembly points, creating severe traffic jams.

    I approached this at two levels:

    • Attack scheduling: Adjust attack waves and force thresholds so the AI launches substantial groups as soon as enough units are available, maintaining pressure rather than relying on occasional small raids.
    • Pathfinding and occupancy: Investigate how infantry occupy cells around assembly points, then expand or reorganize those areas to reduce competition for the same cells.

    After these changes, the skirmish AI could sustain almost continuous large-scale attacks.

    Congestion did not disappear entirely; the engine’s pathfinding still imposed limits. But the experience of facing large advancing armies improved substantially.

    Clearing “Ghost” Grid Cells

    During extended sessions, the engine could develop what I called “ghost cells”: locations that appeared empty but could not be crossed or used for construction. The internal occupancy data no longer matched the visible state.

    With the model’s help, I investigated the behavior but avoided trying to repair engine memory directly. Instead, I used a script-level workaround that periodically triggered a grid rebuild or refresh, prompting the engine to recalculate occupancy.

    This was a pragmatic solution: mitigate the symptom rather than repair the underlying cause.

    Filling Gaps in Garrison Firing Behavior

    The base game and its expansion used substantially different systems for units firing from inside buildings:

    • Base game: The first infantry unit to enter determines the building’s primary and secondary weapons. Kills are credited to the building.
    • Expansion: Each basic infantry unit has a garrison weapon. Kills are credited to the infantry, which can also gain experience.

    That difference limited attempts to reproduce features such as a combat bunker in the base game.

    The model helped me clarify the distinction between the two implementations. I then approximated the desired behavior at the configuration level by defining corresponding firepower behavior for the units entering the building.

    Experience attribution could not fully match the expansion, but the resulting combat behavior came close to the intended design.

    Aircraft Attack Behavior

    The base engine handled aircraft that could not land using bomber-style attack logic: they flew directly over the target before releasing their payload.

    This became a problem when adding a helicopter-like unit that was produced by a vehicle factory, never landed, and was supposed to attack with a ranged weapon. Despite that design, it still behaved like an airship dropping bombs from directly above its target, making it ineffective in its intended role.

    With LLM assistance, I traced the issue to a limitation in the engine’s aircraft behavior logic and identified alternative implementation paths:

    • Assign the unit to a different attack-behavior template.
    • Use custom projectiles to approximate hovering ranged fire.

    The resulting unit could sustain attacks from a distance instead of moving directly over the enemy.

    Miscellaneous Crash Fixes

    The project also involved intermittent crashes, hangs, and error dialogs.

    For each issue, I organized the following information into a structured description:

    • The crash scenario
    • Reproduction steps
    • Units involved
    • Relevant weapon and unit configurations

    I then asked the model to identify suspicious fields and common crash triggers. Those suggestions became candidates for step-by-step testing and binary isolation.

    One of the model’s most useful contributions was turning scattered experience into a structured investigation—not simply guessing the cause of a crash.

    4. Selecting AI Files by Game Mode

    Another implemented feature was selecting a custom AI file according to the current game mode.

    In Deathmatch, a high-resource, fast-paced mode, the AI could field an on-screen force comparable in scale to a full infantry regiment. Standard mode used a more balanced behavior profile.

    The selection mechanism can be illustrated with this pseudoconfiguration:

    1. ; Illustrative pseudoconfiguration
    2. [AIProfile]
    3. Standard = ai_standard.ini
    4. Deathmatch = ai_blitz.ini

    At load time, the current mode determines which configuration is read. The same engine can therefore deliver very different levels of combat intensity.

    The transferable idea is data-driven AI tuning with separate profiles for different modes. Rather than forcing one configuration to serve every scenario, each mode receives behavior suited to its intended pace.

    5. A Reusable Workflow for LLM-Assisted Reverse Engineering

    Several practices made the process more reliable.

    Provide Context, Not Just Symptoms

    Include the platform version, relevant configuration snippets, and explanations you have already ruled out.

    A report such as “this aircraft attacks incorrectly” leaves too much ambiguity. Context gives the model a better basis for proposing useful explanations.

    Ask for Hypotheses and Validation Methods

    Do not accept a single confident conclusion. Ask for multiple plausible causes and experiments that can distinguish between them.

    The goal is to turn uncertainty into a test plan.

    Maintain a Verified Knowledge Base

    After each test, record what was actually established—for example, the observed meaning of a particular field on a particular platform.

    Use those findings as context in later conversations. This prevents repeated investigation of the same issue and reduces the risk of treating an earlier guess as a confirmed fact.

    Be Wary of Confident Explanations

    Some parameter interpretations in this project came entirely from my own testing and experience. A model could still offer a plausible explanation that did not match the old engine’s behavior.

    In-game results remained the final authority.

    Use AI to Accelerate Interpretation, Not Replace Experiments

    LLMs are useful for organizing fragmented knowledge and translating behavioral descriptions into testable configuration changes.

    They cannot reliably reveal every quirk of a legacy engine without observation. The game still has to run, and the behavior still has to be reproduced.

    6. Conclusion

    This project demonstrated a concrete use for LLMs in a high-friction legacy-system task.

    The model could not invent mechanisms the engine did not support. It could, however, help me understand existing behavior more quickly, design workarounds, and investigate defects that had received little attention for years.

    For a hobbyist modder, that mattered. Ideas left on hold for more than a decade because of platform limitations became achievable one by one.

    The practical lesson is not that an LLM can replace reverse engineering. It is that a disciplined, test-driven collaboration with one can make reverse engineering and legacy-engine modification considerably more manageable.