O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unreal Engine 4 AI Programming Essentials

Book Description

Create responsive and intelligent game AI using Blueprints in Unreal Engine 4

About This Book

  • Understand and apply your Game AI better through various projects such as adding randomness and probability, and introducing movement
  • Configure and debug Game AI logic using multiple methodologies
  • Bridge the gap between your knowledge and Game AI in Unreal Engine 4

Who This Book Is For

This book is for programmers and artists who want to expand their knowledge of Game AI in relation to Unreal Engine 4. You are recommended to have some experience of exploring Unreal Engine 4 prior to this book because we jump straight into Game AI.

What You Will Learn

  • Understand the fundamental components of Game AI within Unreal Engine 4
  • Skillfully introduce Game AI within Unreal Engine 4
  • Configure, customize, and assign Navigation and AI components to your pawn
  • Create, debug, and analyze Game AI behavior
  • Design responsive Game AI using the Behavior Tree methodology
  • Create smart objects designed to interact with AI
  • Utilize advanced AI features within your project to maximize the user experience

In Detail

Unreal Engine is a powerful game development engine that provides rich functionalities to create 2D and 3D games. Developers have the opportunity to build cross-platform mobile and desktop games from scratch. This book will show you how to apply artificial intelligence (AI) techniques to your Unreal project using blueprints as your scripting language. You will start with an introduction to AI, and learn how it is applied to gaming. Then you'll jump right in and create a simple AI bot and apply basic behaviors to allow it to move randomly. As you progress, you'll find out how to implement randomness and probability traits. Using NavMesh, you will impart navigation components such as character movement, MoveTo nodes, settings, and world objects, and implement Behavior Trees. At the end of the book, you will troubleshoot any issues that might crop up while building the game.

Style and approach

This easy-to-follow project-based guide throws you directly into the excitement of Game AI in an approachable and comprehensive manner.

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. Unreal Engine 4 AI Programming Essentials
    1. Table of Contents
    2. Unreal Engine 4 AI Programming Essentials
    3. Credits
    4. About the Authors
    5. About the Reviewer
    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. 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
    8. 1. Introduction to Game AI
      1. Game Artificial Intelligence
      2. How AI affects the gaming experience
      3. Techniques and practices of game AI
        1. Navigation
        2. Achieving realistic movement with Steering
        3. Creating a character with randomness and probability
        4. Creating complex decision making with Behavior Tree
          1. Root
          2. Decorators
          3. Composites
          4. Services
          5. Tasks
          6. Blackboard
          7. Sensory systems
          8. Machine learning
          9. Tracing
          10. Influence Mapping
      4. Unreal Engine 4 tools
      5. Summary
    9. 2. Creating Basic AI
      1. Goal
      2. Setting up the project
        1. Environment
        2. Prerequisites
      3. Using our new AIController class
        1. Assigning the AIController class
        2. Placing the pawn
        3. Sending the instructions
        4. Small tips on MoveToLocation
      4. Reviewing the current progress
      5. Adding the challenge
      6. Traces
        1. Reviewing the current progress
      7. The Enemy logic
      8. Adding the Enemy AI
      9. Summary
    10. 3. Adding Randomness and Probability
      1. Introducing probability
        1. Probabilistic distribution
        2. Non-uniform distribution
      2. RandomStream in Unreal Engine 4
      3. The plan
      4. Adding Wander
        1. Setting up the project
        2. Creating probability
        3. Non-uniform distribution with RandomStream
        4. Creating transitions
      5. Fleeing and attacking
        1. Back to the action
        2. The results!
      6. Summary
    11. 4. Introducing Movement
      1. Overview
      2. Path Finding
      3. The A* algorithm
      4. Navigation Mesh
        1. RecastNavMesh
      5. The movement component
        1. The AIController
      6. Let's start!
      7. Waypoints
      8. Navigation
        1. Navigation Modifiers
        2. Back in the editor
        3. The NavArea class
        4. The navigation cost
      9. Summary
    12. 5. Giving AI Choices
      1. Behavior Tree in AIController
      2. Creating Behavior Tree
      3. Blackboard
      4. Designing Behavior Tree
        1. The Behavior Tree service
        2. State transitions
        3. Blackboard Compare Decorator
        4. Environment Query System
      5. Summary
    13. 6. How Does Our AI Sense?
      1. Overview
      2. AI Sense
      3. AI Perception components
      4. State machines
      5. Pawn detection
      6. State transition
      7. Resetting the state
      8. Simulating and playing
      9. Summary
    14. 7. More Advanced Movement
      1. Setting up the agents
      2. Viewing the agent
      3. Following the agent
        1. Follow or lead
      4. Steering behavior: Flocking
        1. Flocking agents
      5. Controlling behavior through UMG
        1. A simple UI
      6. Summary
    15. 8. Creating Patrol, Chase, and Attack AI
      1. Creating a Blackboard
      2. Mid-range attack
      3. Controllers
      4. Waypoints
      5. BT Composites, Task, Decorator, and Service
      6. Creating the logic
      7. Summary
    16. 9. What Have We Learned?
      1. Creating basic AI
        1. The pros and cons of using controls
      2. Adding randomness and probability
        1. The pros and cons of using randomness
        2. The pros and cons of using probability
      3. Introducing movement
      4. Giving our AI choice
        1. The pros and cons of using EQS
        2. The pros and cons of using Blueprint
      5. How does our AI sense?
      6. More advanced movement
      7. Creating patrol, chase, and attack AI
        1. The pros and cons of using Behavior Tree
        2. The pros and cons of using blueprint for AI
      8. Summary
    17. Index