You are previewing Unity AI Programming Essentials.
O'Reilly logo
Unity AI Programming Essentials

Book Description

Use Unity3D, a popular game development ecosystem, to add realistic AI to your games quickly and effortlessly

In Detail

Unity is a powerful cross-platform game creation system that includes a game engine and integrated development environment (IDE). AI programming in Unity is a key task for any game developer as it gives you the ability to make computer characters think and behave like a living organism.

This book focuses on the different AI tasks that are essential for game development using Unity. It includes topics such as defining "minds" for your characters with behavior trees. Furthermore, it covers more specialized AI tasks such as how to implement AI crowds and how to create driving AI for vehicles. We have a section dedicated to NavMesh, one of the most important aspects of pathfinding, that will show you how to customize the mesh generation to handle different use cases for different characters. This is a practical book as it uses several popular Unity plugins such as RAIN and React AI to accomplish different AI tasks.

What You Will Learn

  • Apply pathfinding and pathfollowing features using Unity AI plugins
  • Build behavior trees for different character types
  • Acquire the skills to create an enemy attack AI
  • Make use of crowd AI plugins to create realistic crowds
  • Create game characters that sense different parts of the environment and adapt to them
  • Use driving AI to handle AI for racing games
  • Integrate AI with Unity's classic animation system and Mecanim
  • Design complex navigation meshes for character movement
  • 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 If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Unity AI Programming Essentials
      1. Table of Contents
      2. Unity AI Programming Essentials
      3. Credits
      4. Foreword
      5. About the Authors
      6. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      9. 1. Pathfinding
        1. An overview
        2. Quick Path AI
        3. React AI
        4. RAIN AI
        5. Comparing AI solutions
        6. Summary
      10. 2. Patrolling
        1. Quick Path AI
        2. React AI
        3. RAIN AI
        4. Summary
      11. 3. Behavior Trees
        1. An overview of behavior trees
        2. RAIN node types
        3. The behavior tree demo
        4. Summary
      12. 4. Crowd Chaos
        1. An overview of crowd chaos
        2. React AI
          1. Setting up a scene with React
          2. Building behavior trees in React
          3. Setting up wandering characters with React
        3. RAIN AI
          1. RAIN AI custom wander scripts
          2. Putting NPCs in the RAIN demo
        4. Summary
      13. 5. Crowd Control
        1. An overview of crowd control
        2. The Fame Crowd Simulation API
          1. Setting up a scene with Fame
          2. Setting up a group
          3. Adding obstacles to Fame
          4. Adding vector fields to Fame
        3. ANT-Op
        4. Summary
      14. 6. Sensors and Activities
        1. An overview of sensing
          1. Advanced visual sensor settings
          2. Advanced audio sensor settings
        2. Using senses with RAIN
          1. Setting up aspects in RAIN
          2. Setting up a visual sensor in RAIN
          3. Changing activities based on sensing
          4. RAIN sensor filters
        3. Summary
      15. 7. Adaptation
        1. An overview
        2. RAIN's demo
          1. Reacting to game events
            1. Using RAIN's motor directly
            2. Adding large game events
        3. The React AI
        4. Summary
      16. 8. Attacking
        1. An overview of attack AI
        2. The attack demo
        3. The chase and attack demo
        4. Creating cover AI
        5. Group attacks
        6. Summary
      17. 9. Driving
        1. An overview of driving
        2. Setting up a Smart Car vehicle
        3. The Smart Car AI demo
          1. Setting up a Unity test scene
          2. Using Unity's built-in NavMesh system
          3. Setting up waypoints
          4. Adding obstacles to driving
        4. Additional features
          1. Adding brake zones and drift zones
          2. Integrating with other AI systems
        5. Summary
      18. 10. Animation and AI
        1. An overview of animation
        2. The AI animation demo
          1. Configuring RAIN animations
          2. Using the animate node
          3. RAIN and the Mecanim demo
          4. Additional Mecanim nodes
        3. Summary
      19. 11. Advanced NavMesh Generation
        1. An overview of a NavMesh
        2. Advanced NavMesh parameters
        3. Culling areas
        4. Multiple navigation meshes
        5. Summary
      20. Index