Neuroevolution for Micromanagement in Real-Time Strategy Games
Total Page:16
File Type:pdf, Size:1020Kb
NEUROEVOLUTION FOR MICROMANAGEMENT IN REAL-TIME STRATEGY GAMES By Shunjie Zhen Supervised by Dr. Ian Watson The University of Auckland Auckland, New Zealand A thesis submitted in fullfillment of the requirements for the degree of Master of Science in Computer Science Department of Computer Science The University of Auckland, February 2014 ii ABSTRACT Real-Time Strategy (RTS) games have become an attractive domain for Artificial Intelligence research in recent years, due to their dynamic, multi-agent and multi-objective environments. Micromanagement, a core component of many RTS games, involves the control of multiple agents to accomplish goals that require fast, real time assessment and reaction. This thesis explores the novel application and evaluation of a Neuroevolution technique for evolving micromanagement agents in the RTS game StarCraft: Brood War. Its overall aim is to contribute to the development of an AI capable of executing expert human strategy in a complex real-time domain. The NeuroEvolution of Augmenting Topologies (NEAT) algorithm, both in its standard form and its real- time variant (rtNEAT) were successfully adapted to the micromanagement task. Several problem models and network designs were considered, resulting in two implemented agent models. Subsequent evaluations were performed on the two models and on the two NEAT algorithm variants, against traditional, non-adaptive AI. Overall results suggest that NEAT is successful at generating dynamic AI capable of defeating standard deterministic AI. Analysis of each algorithm and agent models identified further differences in task performance and learning rate. The behaviours of these models and algorithms as well as the effectiveness of NEAT were then thoroughly elaborated iii iv ACKNOWLEDGEMENTS Firstly, I would like to thank Dr. Ian Watson in taking on this project for supervision and for valuable advice throughout. Secondly, thanks to Glen Robertson for his extensive background research and knowledgeble insights into SC: BW AI. Also thanks to Stefan Wender for helpful discussions and knowledge of MicroManageMent. Thirdly, thanks to Kevin for injecting soMe noise to an otherwise quiet and lonely office. Lastly, thanks to my faMily and friends for support and keeping me sane throughout the year. v vi CONTENTS Chapter 1 Introduction ............................................................................................................................................................. 1 1.1. Motivations .............................................................................................................................................................................. 1 1.2. Objectives and Contributions .............................................................................................................................................. 3 1.3. Organization ........................................................................................................................................................................... 4 Chapter 2 Background and Related Work ............................................................................................................................. 6 2.1. Game AI ................................................................................................................................................................................... 6 2.1.1. Chess AI ..................................................................................................................................................................................... 6 2.1.2. Checkers AI and Machine Learning ................................................................................................................................... 8 2.1.3. Interactive Computer Games ............................................................................................................................................ 10 2.1.4. Commercial Game AI .......................................................................................................................................................... 11 2.1.5. Test-Beds for AI Research .................................................................................................................................................. 13 2.1.6. Real-time Strategy Games ................................................................................................................................................. 15 2.1.7. Summary of Game AI .......................................................................................................................................................... 16 2.2. Related Work ........................................................................................................................................................................ 17 2.2.1. Macromanagement Techniques ...................................................................................................................................... 17 2.2.2. Micromanagement Techniques ........................................................................................................................................ 19 2.2.3. Reinforcement Learning, Neuroevolution and NEAT ................................................................................................ 23 2.2.4. Summary of Related Work ................................................................................................................................................. 25 Chapter 3 NeuroEvolution of Augmenting Topologies ...................................................................................................... 27 3.1. Genetic Algorithms and Artificial Neural Networks ....................................................................................................... 27 3.2. Topology and Weight Evolving Artificial Neural Networks ......................................................................................... 30 3.3. Genetic Encoding and Operations in NEAT ................................................................................................................... 33 3.4. Speciation and Fitness Sharing .......................................................................................................................................... 36 3.5. The Generational NEAT Process ....................................................................................................................................... 38 3.6. Real-Time NEAT ................................................................................................................................................................... 40 3.7. Summary of NEAT ............................................................................................................................................................... 42 Chapter 4 StarCraft Test-Bed ................................................................................................................................................. 43 4.1. StarCraft Environment ......................................................................................................................................................... 44 4.2. Gameplay ............................................................................................................................................................................... 46 4.3. Races and Units .................................................................................................................................................................... 49 4.4. Multi-scale AI and Macromanagement ........................................................................................................................... 50 4.5. Micromanagement .............................................................................................................................................................. 51 4.6. Complexity Attributes of Micromanagement ................................................................................................................. 53 4.7. BWAPI ..................................................................................................................................................................................... 54 vii Chapter 5 Design and Implementation ................................................................................................................................ 57 5.1. Network Mapping ................................................................................................................................................................ 57 5.2. Neural Network Design....................................................................................................................................................... 60 5.2.1. Initial Model ............................................................................................................................................................................ 60 5.2.2. Alternative Models ................................................................................................................................................................ 62 5.2.3. Directional Granularity Model ........................................................................................................................................... 64 5.3. Fitness Function ...................................................................................................................................................................