We have completed maintenance on DiscoverMagazine.com and action may be required on your account. Learn More

How AI Accidentally Learned Ecology by Playing StarCraft

A video game about battling aliens could help ecologists study life on Earth.

By James DinneenApr 14, 2021 6:00 PM
StarCraft II
Aliens face off in StarCraft II. Traits vary between species, just like in the real world. (Credit: Blizzard Entertainment)


Sign up for our email newsletter for the latest science news

Lou Barbe wouldn’t call himself an avid gamer. As an ecologist at the Université de Rennes in France, he spends most of his time with plants. But one game has captured his imagination since childhood: StarCraft, the popular online strategy franchise in which players accrue resources and construct armies of alien fighters to wage war across extraterrestrial landscapes. “I’m not at all a very good player,” says Barbe. “But I understand what’s going on.”

While playing StarCraft II — the latest version of the game — a few years ago, Barbe realized that amid all the explosions and lasers, something else was happening. StarCraft was behaving a lot like an ecosystem. “We have an environment,” says Barbe. “We have resources. We have organisms that are competing in this environment. That’s the definition of an ecosystem.”

Barbe filed the idea away. Then, in 2019, DeepMind, the AI research subsidiary of Google’s parent company, Alphabet, pitted an AI agent called AlphaStar against some of the world’s best players of StarCraft II. AlphaStar trounced 99.8 percent of human players, achieving the coveted distinction of Grandmaster — the game’s highest rank — and adding another victory for computers in the march to AI supremacy.

(Credit: Blizzard Entertainment)

It occurred to Barbe that AlphaStar’s powers might not be limited to manipulating aliens on a virtual planet. If StarCraft functions a lot like an ecosystem, maybe game-playing algorithms could help study ecological problems on Earth.

Writing in Trends in Ecology and Evolution in 2020, Barbe, along with other ecologists from Université de Rennes and Brigham Young University, explain how AlphaStar’s abilities to manage the complex, multidimensional dynamics of StarCraft could be repurposed to test ideas about the dynamics of real-world ecosystems that have flummoxed traditional models. For instance, researchers could deploy AlphaStar agents on StarCraft maps designed to mimic realistic resource distributions, in order to model how different organisms respond to disturbances like invasive species or habitat loss.

The AlphaStar algorithm, Barbe says, might have accidentally become the most sophisticated ecological model there is.

The idea joins a broader movement in ecology to use powerful AI tools to analyze environmental problems. Though it was relatively uncommon 15 to 20 years ago, scientists say there has been a recent explosion of AI applications in the field, ranging from classifying species of wildlife to predicting beetle outbreaks in pine forests. Ecologists think AI tools, paired with new capacity to gather large amounts of data about the Earth, could alter how ecosystems are studied and augment our ability to predict how they will change. Sophisticated algorithms like AlphaStar — often developed for purposes that have nothing to do with ecology — could help advance that research.

(Credit: Blizzard Entertainment)

“[Most] ecological models are tiny compared to the complexity within some of these AI systems,” says Ben Abbott, an ecologist at Brigham Young University and co-author of the AlphaStar paper. “We’re really only scratching the surface of what these approaches can do.”

Breeding a Champion

For AI researchers, StarCraft II has presented a formidable challenge since its release in 2010. Like chess or Go, StarCraft players control different units to attack their opponent, but they also choose where and when to collect resources, when to construct new units and which units to construct, among other complicating factors. Whereas a given turn in chess has around 35 possible moves and Go between 200-250, StarCraft II has 10^26 possible moves. Then, unlike what game theorists call “perfect information” games where all players can see the entire playing space, StarCraft is played across a large map which players can only partially observe. Adding to the complexity, players compete as one of three alien races — Terran, Protoss or Zerg — each of which has particular strengths and weaknesses.

To create an AI that could win against the best players at StarCraft II, DeepMind researchers used machine-learning techniques to train the AlphaStar algorithm. First, the researchers created a league of AI agents trained using data from hundreds of thousands of StarCraft matches between humans. Then, they pitted this league of virtual agents against one another, selecting the fittest ones and remixing them before sending them back to the league. They repeated the process until the AlphaStar juggernaut emerged. Oriol Vinyals, who led the DeepMind team that created AlphaStar, compared the league itself to a sort of ecosystem subject to the process of natural selection. “A lot of inspiration to design the AlphaStar League was drawn from the evolutionary literature,” he says.

Slow-growing Terran, one of the three alien races in StarCraft II, behave a bit like the cacti of the game’s ecosystem. (Credit: Saran_Poroong/Shutterstock)

While the AI researchers took inspiration from nature, Barbe and his fellow ecologists took inspiration from the game. In their 2020 paper, they detail deeper parallels between the Terran, Protoss and Zerg races in StarCraft and the competitive strategies of certain kinds of organisms. Zerg units, for instance, are fast colonizers but weak fighters, similar to ruderal species of plants — small and weedy, but the first to grow after an ecosystem is disturbed. Protoss, on the other hand, are like ferns, which use up lots of resources and grow best in groups. Terran are like cacti: slow growers, but good at defense. As in a real ecosystem, these “species” employ their different strategies to compete for resources in complex patterns of interaction.

Though he hasn’t formally tried it yet, Barbe thinks observing these interactions among AlphaStar agents in StarCraft could be a way to test hypotheses about ecological and evolutionary processes that regular statistical models are unable to capture — for example, predicting how a small change in available resources in one corner of the map in StarCraft will ripple across to impact Terran and Zerg units competing in the opposite corner. Replace Terran and Zerg with pine trees and bark beetles and you start to see how a prediction like this could be valuable for environmental managers. “It could be like a sandbox” for scientists to play around with ecosystems, says Barbe.

“It could turn into a very interesting toy model where you can have this very simplified system and ask these very specific questions,” says Anne Thessen, an Oregon State University data scientist not affiliated with the StarCraft ecology paper. “You just have to keep in mind that it’s a simulation.”

Trendy Technology

Indeed, StarCraft II — for all its complexity — is far simpler than a real ecosystem. Barbe notes that basic natural processes like the nitrogen cycle don’t occur in the game, nor do key relationships between organisms, like parasitism. And there are only three species.

(Credit: Blizzard Entertainment)

“A problem, in my opinion, is that the game mechanics — which are designed for being as entertaining as possible — are only superficially similar to the real physical world,” comments Werner Rammer, an ecologist at the Technical University of Munich.

Rammer says this would make it challenging to generalize observations of AlphaStar’s play, however sophisticated, beyond the parameters of the game.

Whether or not ecologists ever do use AlphaStar for research, though, increasingly sophisticated AI tools are being applied to problems in ecology and environmental science.

Ten years ago, says Thessen, AI applications in ecology and environmental science were mostly limited to classification tasks, like rapidly identifying species in recordings of birdsong or types of landscapes in satellite images. Now, she says, AI in ecology is moving beyond classification to take on more varied and ambitious tasks like making predictions based on messy, highly dimensional data — the kind ecology tends to generate.

But AI is still underutilized in ecology, says Nicolas Lecomte, Canada Research Chair of Polar and Boreal Ecology and an ecologist at Université de Moncton in Canada, who uses AI tools to classify the calls of birds in the Arctic and to predict their migration patterns. Ecologists can be intimidated by the programming skills needed to train AI algorithms, he explains. And collecting sufficient data to train the algorithms can be difficult, Abbott echoes. Some data are easy to come by, like satellite imagery, but others might be more challenging to collect, like soil samples.

Some of it just comes down to money and skilled collaborators available for ecology, says Abbott – which, he points out, is not the most “monetizable” of fields. Companies like Blizzard, which made StarCraft, are “spending hundreds of millions of dollars each year to develop the algorithms to run their games,” he says. “They just have way more resources than we do. But we, of course, think our questions are much more important than theirs are.” He’s only half joking — for life on Earth, after all, it’s not just a game.

1 free article left
Want More? Get unlimited access for as low as $1.99/month

Already a subscriber?

Register or Log In

1 free articleSubscribe
Discover Magazine Logo
Want more?

Keep reading for as low as $1.99!


Already a subscriber?

Register or Log In

More From Discover
Recommendations From Our Store
Shop Now
Stay Curious
Our List

Sign up for our weekly science updates.

To The Magazine

Save up to 70% off the cover price when you subscribe to Discover magazine.

Copyright © 2024 Kalmbach Media Co.