Abstract
A wide variety of strategies have been used to create agents in the growing field of real-time strategy AI. However, a frequent problem is the necessity of hand-crafting competencies, which becomes prohibitively difficult in a large space with many corner cases. A preferable approach would be to learn these competencies from the wealth of expert play available. We present a system that uses the Generalized Sequential Pattern (GSP) algorithm from data mining to find common patterns in StarCraft:Brood War replays at both the micro- and macro-level, and verify that these correspond to human understandings of expert play. In the future, we hope to use these patterns to learn tasks and goals in an unsupervised manner for an HTN planner.
Introduction
Creating competitive AI for Real-Time Strategy (RTS) games like StarCraft: Brood War is a significant challenge due to the near-infinite state spaces and the need for simultaneous management of micro-level unit tactics and macro-level economic strategy. Traditionally, developers have relied on Hierarchical Task Networks (HTNs) or state machines, which require extensive manual curation by experts to define every possible task and goal. This manual bottleneck limits the scalability and adaptability of AI agents.
To overcome this, we propose an unsupervised learning approach that discovers the structure of expert play directly from professional game logs. By analyzing thousands of replays, we aim to automatically identify the competencies and strategic patterns that define high-level human play.
Methodology
The core of our approach is the Generalized Sequential Pattern (GSP) algorithm. GSP is particularly suited for RTS data because it allows for "gaps" between elements in a pattern. This flexibility is essential in StarCraft, where a player might initiate a long-term goal (like building a structure) but perform several unrelated micro-actions (like moving a unit) before the next step in that goal occurs.
Data Abstraction and Constraints
To process the high-dimensional data from 500 professional Terran vs. Protoss (TvP) replays, we applied two levels of abstraction:
- Action Blurring: Specific (x, y) coordinates were removed, transforming actions into generic types, such as
Move(UnitType)orTrain(UnitType). - Gap Constraints: We defined different temporal constraints for different levels of play. "Micro" patterns (e.g., combat) were limited to gaps of 1–4 seconds, while "Macro" patterns (e.g., build orders) allowed gaps up to 60 seconds.
Results and Discussion
Our system successfully identified several categories of patterns that align with established expert strategies:
- Action Spamming: The algorithm detected the high-frequency redundant commands typical of professional players (APM spam). Identifying this "noise" is a critical step in isolating meaningful strategic intent.
- Production Cycles: We observed patterns where experts synchronize building outputs to minimize the cognitive load of base management.
- Macro Build Orders: Without prior knowledge, the system extracted complex chains of construction and research, such as the Terran "Siege Expand" and the Protoss "One Gate Cybernetics Core."
These findings were verified against the fan-moderated TeamLiquid wiki, confirming that the unsupervised algorithm discovered strategically sound patterns recognized by the human community. The ability of GSP to handle gaps was found to be the key differentiator; standard string-matching techniques failed to find these patterns due to the inherent noise in human input.
Conclusion and Future Work
While the GSP algorithm is effective, it is memory-intensive, requiring all sequences to be stored in RAM. Future work will explore batch-processing methods to handle larger datasets. Additionally, we plan to reintroduce spatial context by using "high-level regions" rather than raw coordinates. The ultimate goal is to integrate these discovered patterns into an HTN planner, enabling the creation of AI agents that can autonomously plan and execute complex, human-like strategies.
Summary updated