Artificial Generals Intelligence: Mastering Generals.io with Reinforcement Learning

Matej Straka, Martin Schmid

TL;DR

This paper introduces a new, accessible, and challenging real-time strategy (RTS) game environment based on Generals.io, designed to advance multi-agent reinforcement learning (MARL) research. They also present a state-of-the-art agent trained using a combination of supervised learning and self-play, which achieves top-tier performance on the game's human leaderboard.

What Problem Does This Paper Address?

Reinforcement learning (RL) has seen significant success in various game environments, from single-player Atari games to complex board games like Go and Chess, and even large-scale video games like StarCraft II and Dota II. However, many of these environments are either computationally expensive, lack a large active player base for evaluation, or don't fully capture the complexities of real-time strategy games with imperfect information and multi-agent dynamics. The authors aim to bridge this gap by creating a lightweight yet challenging RTS benchmark that leverages the existing active community of Generals.io, a popular browser-based RTS game. This platform allows for faster experimentation and more direct comparison with human players.

Methods

The core of their approach involves two main components:

  • Generals.io Environment: They developed a vectorized and customizable environment for Generals.io that is compatible with standard RL libraries like Gymnasium and PettingZoo. This environment can run at thousands of frames per second on commodity hardware, making it efficient for training. It also includes features for recording/replaying matches and a PyGame renderer for visualization.
  • Reference Agent: Their agent is trained in two stages:
  • Behavior Cloning: An initial policy is learned by mimicking human expert replays from the Generals.io dataset. This provides a strong starting point.
  • Self-Play Fine-Tuning: The agent is further refined using Proximal Policy Optimization (PPO) through self-play. To address the sparse reward problem in RTS games, they employ potential-based reward shaping, using a potential function based on land, army, and castle counts relative to the opponent. They also incorporate a memory stack to provide the agent with crucial historical information under partial observability, compensating for the fog-of-war.

Datasets

  • Training Data: A corpus of 347,000 raw replays from Generals.io was used. This dataset was filtered to include games longer than 500 turns and featuring at least one participant with a ≥ 70-star rating, resulting in 16,320 high-quality games for behavior cloning.
  • Benchmark: The Generals.io environment itself serves as a new benchmark for MARL research. It is designed to be comparable in strategic depth to games like StarCraft II but more accessible computationally.

Key Insights and Ideas

  • Generals.io as a MARL Benchmark: The paper highlights Generals.io as a viable and valuable platform for MARL research due to its active player base, diverse game modes, and strategic complexity, while being computationally efficient.
  • Effective Training Pipeline: The combination of supervised pre-training (behavior cloning) followed by self-play fine-tuning with PPO proved highly effective, leading to rapid performance gains.
  • Importance of Reward Shaping: Potential-based reward shaping, specifically using log-ratios of land, army, and castle counts, was crucial for guiding the agent towards more robust and less aggressive gameplay, preventing it from converging to easily exploitable strategies.
  • Memory Augmentation for Partial Observability: A hand-crafted memory stack, including information about revealed units, explored cells, and opponent scouting, significantly improves performance in the face of partial observability.

Key Results

  • The trained agent achieved top-tier performance, hitting the top 0.003% of the 1v1 human leaderboard after just 36 hours of training on a single H100 GPU.
  • The agent achieved a 54.82% win-rate against Human.exe, the previous state-of-the-art bot, over 529 games.
  • In an Elo rating system constructed from pairwise win-rates, the agent ("zero v3") achieved a rating of 2052, surpassing Human.exe (2018) and other bots like HASP (1710) and Flobot (1500).
  • The environment itself can run at approximately 3,500 frames per second on a 12-core CPU with 12 parallel environments.

Limitations and Future Work

  • Hand-crafted Memory: The authors acknowledge that their current memory augmentation is hand-crafted and does not capture all necessary temporal information. They anticipate that recurrent architectures or transformers could better aggregate and remember details like army counts at specific times.
  • Failure Modes: The agent exhibits occasional suboptimal behavior, such as getting stuck in dead ends or focusing too narrowly on one aspect (attack, defense, or castle taking) without balancing them. This is attributed to the limitations of the convolutional network in calculating distances and a lack of look-ahead.
  • Future Work:
    • Extend the benchmark to include multi-team and free-for-all modes.
  • Adopt the JAX framework for an accelerator-agnostic runtime.
  • Investigate policies parameterized by graph neural networks for better handling of the game's graphical structure.
  • Employ game-theoretic approaches to reduce exploitability.

Summary updated

BibTeX
@inproceedings{straka2025artificial,
  author = {Matej Straka and Martin Schmid},
  title = {{Artificial Generals Intelligence: Mastering Generals.io with Reinforcement Learning}},
  booktitle = {RLVG @ RLC},
  year = {2025},
  url = {https://openreview.net/forum?id=fyKzFiKaRd},
}
Figure