Game AI Pro 2 : Collected Wisdom of Game AI Professionals, Ed
Total Page:16
File Type:pdf, Size:1020Kb
Collected Wisdom of Game AI Professionals EDITED BY STEVE RABIN Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group, an informa business CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2015 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Version Date: 20150312 International Standard Book Number-13: 978-1-4822-5480-8 (eBook - PDF) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com Contents Preface xi Acknowledgments xiii Web Materials xv Editors xvii Contributors xix Section I General Wisdom 1 Game AI Appreciation, Revisited 3 Mike Lewis and Kevin Dill 2 Combat Dialogue in FEAR: The Illusion of Communication 19 Jeff Orkin 3 Dual-Utility Reasoning 23 Kevin Dill 4 Vision Zones and Object Identification Certainty 27 Steve Rabin v 5 Agent Reaction Time: How Fast Should an AI React? 31 Steve Rabin 6 Preventing Animation Twinning Using a Simple Blackboard 35 Michael Dawe Section II Architecture 7 Possibility Maps for Opportunistic AI and Believable Worlds 41 John Manslow 8 Production Rules Implementation in 1849 49 Robert Zubek 9 Production Systems: New Techniques in AAA Games 59 Andrea Schiel 10 Building a Risk-Free Environment to Enhance Prototyping: Hinted-Execution Behavior Trees 69 Sergio Ocio Barriales 11 Smart Zones to Create the Ambience of Life 89 Etienne de Sevin, Caroline Chopinaud, and Clodéric Mars 12 Separation of Concerns Architecture for AI and Animation 101 Bobby Anguelov 13 Optimizing Practical Planning for Game AI 117 Éric Jacopin Section III Movement and Pathfinding 14 JPS+: An Extreme A* Speed Optimization for Static Uniform Cost Grids 131 Steve Rabin and Fernando Silva 15 Subgoal Graphs for Fast Optimal Pathfinding 145 Tansel Uras and Sven Koenig 16 Theta* for Any-Angle Pathfinding 161 Alex Nash and Sven Koenig vi Contents 17 Advanced Techniques for Robust, Efficient Crowds 173 Graham Pentheny 18 Context Steering: Behavior-Driven Steering at the Macro Scale 183 Andrew Fray 19 Guide to Anticipatory Collision Avoidance 195 Stephen J. Guy and Ioannis Karamouzas 20 Hierarchical Architecture for Group Navigation Behaviors 209 Clodéric Mars and Jérémy Chanut 21 Dynamic Obstacle Navigation in Fuse 225 Jan Müller Section IV Applied Search Techniques 22 Introduction to Search for Games 237 Nathan R. Sturtevant 23 Personality Reinforced Search for Mobile Strategy Games 243 Miguel A. Nieves 24 Interest Search: A Faster Minimax 255 Jeff Rollason 25 Monte Carlo Tree Search and Related Algorithms for Games 265 Nathan R. Sturtevant 26 Rolling Your Own Finite-Domain Constraint Solver 283 Leif Foged and Ian Horswill Section V Tactics, Strategy, and Spatial Awareness 27 Looking for Trouble: Making NPCs Search Realistically 305 Rich Welsh 28 Modeling Perception and Awareness in Tom Clancy’s Splinter Cell Blacklist 313 Martin Walsh 29 Escaping the Grid: Infinite-Resolution Influence Mapping 327 Mike Lewis Contents vii 30 Modular Tactical Influence Maps 343 Dave Mark 31 Spatial Reasoning for Strategic Decision Making 365 Kevin Dill 32 Extending the Spatial Coverage of a Voxel-Based Navigation Mesh 389 Kevin A. Kirst Section VI Character Behavior 33 Infected AI in The Last of Us 407 Mark Botta 34 Human Enemy AI in The Last of Us 419 Travis McIntosh 35 Ellie: Buddy AI in The Last of Us 431 Max Dyckhoff 36 Realizing NPCs: Animation and Behavior Control for Believable Characters 443 Jeet Shroff 37 Using Queues to Model a Merchant’s Inventory 463 John Manslow 38 Psychologically Plausible Methods for Character Behavior Design 471 Phil Carlisle Section VII Analytics, Content Generation, and Experience Management 39 Analytics-Based AI Techniques for a Better Gaming Experience 481 Truong-Huy D. Nguyen, Zhengxing Chen, and Magy Seif El-Nasr 40 Procedural Content Generation: An Overview 501 Gillian Smith viii Contents 41 Simulation Principles from Dwarf Fortress 519 Tarn Adams 42 Techniques for AI-Driven Experience Management in Interactive Narratives 523 Vadim Bulitko, Greg Lee, Sergio Poo Hernandez, Alejandro Ramirez, and David Thue Contents ix Preface It makes me proud to be able to deliver to you a brand new volume of Game AI Pro! After putting together books like this one for over a decade, I’m still humbled by the generosity of the authors to share their hard-earned knowledge with the game developer commu- nity. In this book, 47 authors have come together to bring you their newest advances in game AI, along with twists on proven techniques that have shipped in some of the most respected commercial games of the last couple years. In addition, we’ve scoured the latest game AI research from universities and offer you some of the most promising work. Like most technological industries, the game industry is a whirlwind of new ideas, and the subfield of game AI is no exception. This book hits hard on the area of pathfinding opti- mization, showing several techniques that can beat a traditional A* search by one or two orders of magnitude. We dedicated a new section to search, giving an inside look into some of the best techniques for exploring a problem space. Another very special section in this book is on character behavior, where, among other wisdom, we detail three distinct areas of AI behavior within the award-winning game The Last of Us. In the area of tactics and spatial awareness, we have wisdom from the Splinter Cell series and the Guild Wars series, among others. Finally, we give you a tour of the most promising new twists on AI architectures and finish the book with a look into procedural content generation and analytics. Over the last 5 years, game AI communities have really hit their stride and are truly supporting each other. In addition to the Game AI Pro book series, there are now annual conferences, both academic and developer-centric, held all over the globe. Organized by developers, there is the Game Developers Conference (GDC) AI Summit in San Francisco and the Game/AI Conference in Europe. Organized by academia, there is the AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment (AIIDE) and the IEEE Conference on Computational Intelligence and Games. Outside of events, there are two communities that have also sprung up to help developers. The AI Game Programmers Guild is a free professional group with over 400 worldwide members (http://www.gameai. com), and there is a wonderful community of hobbyists and professionals at AiGameDev. com. We warmly welcome you to come hang out with us at any one of these conferences or participate in one of our online communities! xi Acknowledgments Game AI Pro2 required a huge team effort to come together. First, I thank the five section editors for the excellent job they did in selecting, guiding, and editing the contributions in this book. The section editors were • Neil Kirby—General Wisdom • Alex Champandard—Architecture • Nathan R. Sturtevant—Movement and Pathfinding; Applied Search Techniques • Damián Isla—Tactics, Strategy, and Spatial Awareness • Kevin Dill—Character Behavior; Analytics, Content Generation, and Experience Management The wonderful cover artwork is courtesy of Sony Computer Entertainment America and Naughty Dog from the award-winning game The Last of Us. Three chapters covering tech- niques from this game appear in this book: Infected AI in The Last of Us, Enemy AI in The Last of Us, and Ellie: Buddy AI in The Last of Us. The team at CRC Press and A K Peters have done an excellent job in making this whole project happen. I thank Rick Adams, Sherry Thomas, Kari Budyk, and the entire produc- tion team who took the contributions and carefully turned them into this book. Special thanks to our families and friends who have supported us and endured the intense production cycle that required long hours, evenings, and weekends. xiii Web Materials Example programs and source code to accompany the chapters are available at http:// www.gameaipro.com. General System Requirements The following is required to compile and execute the example programs: • DirectX August 2009 SDK • DirectX 9.0 compatible or newer graphics card • Windows 7 or newer • Visual C++.NET 2012 or newer Updates Updates of the example programs and source code will be updated as needed.