You are previewing Unity 5.x Game AI Programming Cookbook.
O'Reilly logo
Unity 5.x Game AI Programming Cookbook

Book Description

Build and customize a wide range of powerful Unity AI systems with over 70 hands-on recipes and techniques

About This Book

  • Empower your agent with decision making capabilities using advanced minimaxing and Negamaxing techniques

  • Discover how AI can be applied to a wide range of games to make them more interactive.

  • Instigate vision and hearing abilities in your agent through collider based and graph based systems

  • Who This Book Is For

    This book is intended for those who already have a basic knowledge of Unity and are eager to get more tools under their belt to solve AI and gameplay-related problems.

    What You Will Learn

  • Use techniques such as A*and A*mbush to empower your agents with path finding capabilities.

  • Create a representation of the world and make agents navigate it

  • Construct decision-making systems to make the agents take different actions

  • Make different agents coordinate actions and create the illusion of technical behavior

  • Simulate senses and apply them in an awareness system

  • Design and implement AI in board games such as Tic-Tac-Toe and Checkers

  • Implement efficient prediction mechanism in your agents with algorithms such as N-Gram predictor and naïve Bayes classifier

  • Understand and analyze how the influence maps work.

  • In Detail

    Unity 5 comes fully packaged with a toolbox of powerful features to help game and app developers create and implement powerful game AI. Leveraging these tools via Unity’s API or built-in features allows limitless possibilities when it comes to creating your game’s worlds and characters. This practical Cookbook covers both essential and niche techniques to help you be able to do that and more.

    This Cookbook is engineered as your one-stop reference to take your game AI programming to the next level. Get to grips with the essential building blocks of working with an agent, programming movement and navigation in a game environment, and improving your agent's decision making and coordination mechanisms - all through hands-on examples using easily customizable techniques. Discover how to emulate vision and hearing capabilities for your agent, for natural and humanlike AI behaviour, and improve them with the help of graphs. Empower your AI with decision-making functions through programming simple board games such as Tic-Tac-Toe and Checkers, and orchestrate agent coordination to get your AIs working together as one.

    Style and approach

    This recipe-based guide will take you through implementing various AI algorithms. Each topic is explained and placed among other related techniques, sometimes building on the knowledge from previous chapters. There are also references to more technical books and papers, so you can dig deeper if you want to.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Unity 5.x Game AI Programming Cookbook
      1. Table of Contents
      2. Unity 5.x Game AI Programming Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Behaviors – Intelligent Movement
        1. Introduction
        2. Creating the behavior template
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Pursuing and evading
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Arriving and leaving
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Facing objects
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Wandering around
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Following a path
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Avoiding agents
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more
        9. Avoiding walls
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Blending behaviors by weight
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Blending behaviors by priority
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Combining behaviors using a steering pipeline
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Shooting a projectile
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        14. Predicting a projectile's landing spot
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        15. Targeting a projectile
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        16. Creating a jump system
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There is more
          5. See Also
      9. 2. Navigation
        1. Introduction
        2. Representing the world with grids
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Representing the world with Dirichlet domains
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Representing the world with points of visibility
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Representing the world with a self-made navigation mesh
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Finding your way out of a maze with DFS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There is more…
        7. Finding the shortest path in a grid with BFS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There is more…
          5. See also
        8. Finding the shortest path with Dijkstra
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Finding the best-promising path with A*
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Improving A* for memory: IDA*
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
        11. Planning navigation in several frames: time-sliced search
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        12. Smoothing a path
          1. Getting ready
          2. How to do it…
          3. How it works…
      10. 3. Decision Making
        1. Introduction
        2. Choosing through a decision tree
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Working a finite-state machine
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Improving FSMs: hierarchical finite-state machines
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Combining FSMs and decision trees
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Implementing behavior trees
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Working with fuzzy logic
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Representing states with numerical values: Markov system
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Making decisions with goal-oriented behaviors
          1. Getting ready
          2. How to do it...
          3. How it works...
      11. 4. Coordination and Tactics
        1. Introduction
        2. Handling formations
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
        3. Extending A* for coordination: A*mbush
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
        4. Creating good waypoints
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Analyzing waypoints by height
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. Analyzing waypoints by cover and visibility
          1. Getting ready
          2. How to do it…
          3. How it works…
        7. Exemplifying waypoints for decision making
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Influence maps
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
        9. Improving influence with map flooding
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        10. Improving influence with convolution filters
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
        11. Building a fighting circle
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
      12. 5. Agent Awareness
        1. Introduction
        2. The seeing function using a collider-based system
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. The hearing function using a collider-based system
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
        4. The smelling function using a collider-based system
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
        5. The seeing function using a graph-based system
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. The hearing function using a graph-based system
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
        7. The smelling function using a graph-based system
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Creating awareness in a stealth game
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
      13. 6. Board Games AI
        1. Introduction
        2. Working with the game-tree class
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        3. Introducing Minimax
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        4. Negamaxing
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. AB Negamaxing
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        6. Negascouting
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        7. Implementing a tic-tac-toe rival
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. There is more…
          5. See also
        8. Implementing a checkers rival
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. There is more…
      14. 7. Learning Techniques
        1. .Introduction
        2. Predicting actions with an N-Gram predictor
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. There is more…
        3. Improving the predictor: Hierarchical N-Gram
          1. Getting ready…
          2. How to do it…
          3. How it works…
        4. Learning to use Naïve Bayes classifiers
          1. Getting ready…
          2. How to do it…
          3. How it works…
        5. Learning to use decision trees
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        6. Learning to use reinforcement
          1. Getting ready…
          2. How to do it…
          3. How it works…
        7. Learning to use artificial neural networks
          1. Getting ready…
          2. How to do it…
          3. How it works…
        8. Creating emergent particles using a harmony search
          1. Getting ready…
          2. How to do it…
          3. How it works…
      15. 8. Miscellaneous
        1. Introduction
        2. Handling random numbers better
          1. Getting ready
          2. How to do it…
          3. There's more…
          4. See also
        3. Building an air-hockey rival
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Devising a table-football competitor
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Creating mazes procedurally
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
          5. See also
        6. Implementing a self-driving car
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Managing race difficulty using a rubber-banding system
          1. Getting ready
          2. How to do it...
          3. How it works…
      16. Index