Centralized control for multi-agent RL in a complex Real-Time-Strategy game

Roger Creus CastanyerarXiv 2023 · DOI

Abstract

Real-Time Strategy (RTS) games represent a significant challenge for Reinforcement Learning (RL) due to their high-dimensional action spaces, non-stationary dynamics, and the need for complex multi-agent coordination. This paper details an end-to-end approach for the Lux AI v2 competition, utilizing a centralized "pixel-to-pixel" control architecture. By employing Proximal Policy Optimization (PPO) with prioritized fictitious self-play and dense reward shaping, the proposed agent successfully learns to manage variable-sized fleets and intricate resource chains within a 48x48 grid environment.

Introduction

Unlike traditional board games with fixed pieces and predictable states, Real-Time Strategy games involve the simultaneous control of hundreds of units in an environment where the opponent's strategy is constantly evolving. The Lux AI v2 environment exemplifies these challenges, requiring agents to balance resource extraction (ice and ore), infrastructure development (factories), and long-term survival through water production and lichen growth.

This research addresses four primary hurdles in RTS RL: variable fleet sizes, complex multi-step coordination, the difficulty of credit assignment in decentralized systems, and the massive computational requirements typically associated with industrial-scale RTS training. We propose a centralized control model that treats the entire unit fleet as a single entity, simplifying the coordination problem into a spatial mapping task.

Methodology

Centralized Architecture

Rather than using a decentralized multi-agent setup where each unit acts independently, we employ a centralized "pixel-to-pixel" actor-critic model. This architecture processes the 48x48 game grid as a stack of 17 feature maps. The core of the model is a Residual Network (ResNet) enhanced with squeeze-and-excitation layers, which allows the agent to capture global spatial dependencies and prioritize relevant feature channels.

Action Space and Masking

The model features three distinct output heads: a critic to estimate state value and two actors (one for robots and one for factories). To manage the grid-based action space, the model generates potential actions for every cell. However, because units only occupy a small fraction of the map, we implement invalid action masking. By masking the logits of illegal actions to large negative values, we prevent the gradients from being overwhelmed by noise from empty tiles, focusing the learning process on meaningful unit interactions.

Training and Self-Play

We utilize Proximal Policy Optimization (PPO) for its stability and efficiency in on-policy data reuse. To address the non-stationarity of the competitive environment, we implement Prioritized Fictitious Self-Play (PFSP). The agent is trained against a pool of its own historical versions, ensuring it retains the ability to counter older strategies while simultaneously developing more sophisticated behaviors.

Reward Shaping

Given that winning or losing is a sparse signal occurring only at the end of a 1,000-step episode, we introduced a dense reward function. This function focuses on water generation—the primary bottleneck for survival in Lux AI v2. This hand-crafted signal acts as a curriculum, guiding the agent through the complex sequence of digging ice, transporting it to factories, and refining it into water.

Results

The final model was trained for 220 million environment steps, requiring approximately 126 hours of compute on eight Nvidia A600 GPUs.

Survival and Resource Management

The agent successfully learned the fundamental resource management chain required for survival. In many evaluation episodes, the agent maintained its fleet and factories for the full 1,000-step duration, demonstrating a robust understanding of the game's survival mechanics.

Training Dynamics

Observations during training indicated that while value loss frequently spiked—suggesting the discovery of new, high-value states—policy entropy eventually decreased. This downward trend in entropy signals that the agent was transitioning from exploratory behavior to a more deterministic, learned strategy. However, reward variance remained high throughout the run, likely due to the significant impact of resource distribution in randomly generated maps.

Discussion and Future Work

Our results suggest that centralization significantly simplifies the coordination problem in RTS games by baking spatial relationships directly into the convolutional layers. However, several limitations remain:

  1. Environment Throughput: The simulation speed (60 steps/second) remains a bottleneck for data-hungry RL algorithms.
  2. Generalization: The high variance in performance across different maps suggests that the agent still struggles to generalize perfectly across all possible resource configurations.
  3. Architectural Refinement: Future iterations could replace the standard ResNet with a U-Net architecture to better preserve fine-grained spatial information, or incorporate LSTMs to handle temporal dependencies more effectively.
  4. Population-Based Training: While PFSP provided a solid foundation, moving toward Population-Based Training (PBT) could further enhance the agent's robustness against a wider variety of opponent playstyles.

Conclusion

This work demonstrates that a centralized, pixel-to-pixel RL approach is a viable and effective strategy for complex RTS environments like Lux AI v2. By combining spatial feature extraction with robust action masking and self-play, agents can learn to navigate intricate resource economies and multi-unit coordination without the need for decentralized communication protocols.

Summary updated

BibTeX
@misc{castanyer2023centralized,
  author = {Roger Creus Castanyer},
  title = {{Centralized control for multi-agent RL in a complex Real-Time-Strategy game}},
  year = {2023},
  eprint = {2304.13004},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.13004},
}
Figure