Real-time strategy (RTS) games like StarCraft are notoriously difficult for artificial intelligence due to their "partially observable" environments. Players can only see the area immediately surrounding their own units; the rest of the map is obscured by the "Fog of War." To win, a player (or an AI) must make high-stakes decisions based on incomplete information, constantly guessing what the opponent is building and where their army is moving.
Most existing StarCraft bots rely on simple "Previous Seen" heuristics—essentially assuming an enemy unit stays exactly where it was last spotted until proven otherwise. This fails to account for the dynamic nature of the game. To address this, researchers from Facebook AI Research (FAIR) developed a deep learning "defogger" for StarCraft: Brood War. By training on 65,000 human games, their model estimates the current state of the game and predicts future states hidden by the fog, significantly outperforming traditional heuristics and boosting the win rate of a state-of-the-art game bot.
Architecture and Methods
The authors treat defogging as a spatio-temporal sequence prediction problem. They propose an encoder-decoder architecture designed to handle both the 2D nature of the map and the temporal flow of the game.
Instead of raw pixels, the model's input is a downsampled 2D grid of "walk tiles" (e.g., a 32x32 grid). Each cell in the grid contains counts of unit types for both the player and the opponent. By ignoring "micro" details like exact pixel coordinates or unit health, the model can more easily capture "macro" trends like army rotations and economic expansions.
The core innovation is the Convolutional-LSTM (CL) Model, which utilizes a spatially-replicated LSTM. In this setup, every grid cell has its own LSTM hidden state to track local history, but the weights are shared across all cells. This allows the model to learn general patterns of movement and production that apply anywhere on the map.
The decoder produces two types of multi-head predictions:
- Global Strategy: A classification of which buildings the opponent likely owns (the "build tree").
- Local Tactics: A spatial map predicting the number and types of units in each grid cell.
Training and Key Insights
The models were trained and evaluated on the STARDATA corpus, a massive dataset of 65,000 high-quality human replays of StarCraft: Brood War. This scale provided enough variety for the neural networks to learn complex game dynamics without explicit hard-coded rules. The models were trained using a combination of Binary Cross Entropy (for unit existence) and Huber loss (for unit counts).
A key insight from the research is that in a partially observable game, estimation is prediction. To know where an enemy unit is right now, the model must predict how it has moved since it was last seen minutes ago.
Interestingly, the researchers found that their model was most useful for strategic planning (deciding what units to build to counter the opponent) rather than tactical movement. Because the bot's movement rules were originally tuned for perfect information, the probabilistic predictions of the neural network sometimes caused the bot to hesitate or retreat unnecessarily during tactical engagements.
Results and Future Work
The researchers compared their Convolutional-LSTM (CL) and standard ConvNet (C) models against rule-based baselines like "Perfect Memory" (which simply remembers everything ever seen).
- Predictive Accuracy: The CL model consistently achieved higher F1 scores for predicting hidden units and all opponent units across various time horizons (up to 30 seconds into the future).
- Bot Performance: When integrated into a competitive rule-based StarCraft bot (a Zerg bot), the defogger increased the overall win rate from 61% to 66%.
- Strategic Advantage: In Zerg vs. Terran matches, using the defogger specifically for "Build Actions" was highly effective, proving that the model successfully learned the "rock-paper-scissors" nature of StarCraft's unit compositions.
While highly successful, the authors note a few limitations. The current model is a "forward model"—it predicts what will happen but doesn't account for how the player's own future actions might change the opponent's behavior. Furthermore, integrating probabilistic neural network outputs into brittle, rule-based bots can lead to friction.
Ultimately, this work paves the way for Model-Based Reinforcement Learning in complex RTS games, where an AI could use this defogger to "imagine" different game scenarios and pick the one with the highest chance of victory.
Summary updated