StarCraft-playing AI Accidentally Learns Ecology

Original article was published on Artificial Intelligence on Medium

StarCraft-playing AI Accidentally Learns Ecology

Through playing StarCraft II, the AI AlphaStar learned ecological principles that apply to real ecosystem and organisms

(Pixabay, geralt)

Ready for battle

Ever since Deep Blue beat Gary Kasparov in chess (1996/1997), AI/machine learning systems have kept mastering new games. Some games are harder for AI than others, though. The game Go long proved a hurdle, requiring intuition and strategy in an even greater degree than chess. In fact, in 2001, this paper said:

The problems related to Computer Go require new AI problem solving methods. Given the great number of problems and the diversity of possible solutions, Computer Go is an attractive research domain for AI.

Then, in 2015, the AI AlphaGo beat 18-time Go world champion Lee Sedol 4 to 1, occasionally making ‘unique and creative’ moves.

On to the next challenge.

Yep, quite popular those StarCraft matches (Wikimedia commons, Kevin Chang)

StarCraft is an SF real-time strategy game that has a long history of being one of the most popular and challenging games of its kind. Until about a year and a half ago, it was dubbed the next grand challenge for AI.

Then, along comes AlphaStar: a deep neural network trained directly from raw game data by supervised and reinforcement learning. After a (relative) blink of an eye, it beat a human top team in StarCraft II. Blink again, and it achieved ‘Grandmaster’ status, having — by all accounts — mastered the game fully, joining elite ranks only the very best 0.02% of players belong to.

The merging is complete

Without going into excessive detail, StarCraft is a game where three ‘races’ compete for space and resources.

The Protoss (think high-tech space elves): build slow, but are very strong.

The Zerg (think Starship Trooper-like bugs): breed like crazy, but most are easy to squash.

The Terrans (think us, but with improved technology): somewhere in between.

(It’s a bit more complex than that, but these basics are good to keep in mind.)

Here, then, we have an environment with unequally distributed resources and three different ‘species’ with different strategies for growth and resource acquisition. Sounds a lot like an ecosystem.

And that is indeed the analogy that was explored in a (really cool) recent study.

The researchers point out how ecological principles are applied in the game. For example, early on most players go for a ‘fast and cheap’ strategy, quickly producing a lot of cheap units to gain a foothold (in ecology this is known as an r-strategy).

As the game progresses, however, they often observe a change in strategy. Let’s call this the ‘slow and specialized’ strategy. Players begin to produce expensive units that take longer to build. These units are often specialized in specific functions (battle, transport, resource mining…). In ecology, we know this as a K-strategy.

Finally, units often depend on each other (ecological networks), and only a maximum number of units is allowed on the map (carrying capacity).

Engaging foe

AlphaStar took advantage of this game-ecology overlap. During its training, it learned from data from the best human players, but it also developed strategies of its own. These strategies, developed free of human influence, strongly reflect a great ‘understanding’ (can we call it understanding?) of the ecological principles:

…used apparently counterproductive strategies, such as oversaturating their resource collection capacity or having a homogeneous army composition. This unconventional approach was so effective that these games almost always finished in a few minutes… overall domination of AlphaStar over its human competitors in these situations demonstrated that these counterintuitive behaviors better balanced the ecological tradeoffs necessary…

(This strongly reminds me of AI using simulations to infer physical principles.)

The authors next suggest to use StarCraft and AlphaStar to study real world ecology and evolution. By manipulating the (virtual) environment, resource availability/distribution, and species present, we might:

…reveal their evolutionary trajectory, which would allow assessment of deterministic and contingent development pathways in different starting conditions.

These findings would potentially be applicable to various species and ecosystems. For plants, it could teach us about the response to a changing environment (climate change, invasive species…), such as niche shifts and succession changes. For animals, it could add to our understanding of the effects of ‘personality’, and for that specific animal, humans, it could perhaps even teach us about intercultural relations.

And there I was not too long ago, studying ecology with books…