Practical Game AI Programming

Book description

Jump into the world of Game AI development

About This Book

  • Move beyond using libraries to create smart game AI, and create your own AI projects from scratch
  • Implement the latest algorithms for AI development and in-game interaction
  • Customize your existing game AI and make it better and more efficient to improve your overall game performance

Who This Book Is For

This book is for game developers with a basic knowledge of game development techniques and some basic programming techniques in C# or C++.

What You Will Learn

  • Get to know the basics of how to create different AI for different type of games
  • Know what to do when something interferes with the AI choices and how the AI should behave if that happens
  • Plan the interaction between the AI character and the environment using Smart Zones or Triggering Events
  • Use animations correctly, blending one animation into another and rather than stopping one animation and starting another
  • Calculate the best options for the AI to move using Pruning Strategies, Wall Distances, Map Preprocess Implementation, and Forced Neighbours
  • Create Theta algorithms to the AI to find short and realistic looking paths
  • Add many characters into the same scene and make them behave like a realistic crowd

In Detail

The book starts with the basics examples of AI for different game genres and directly jumps into defining the probabilities and possibilities of the AI character to determine character movement. Next, you’ll learn how AI characters should behave within the environment created.

Moving on, you’ll explore how to work with animations. You’ll also plan and create pruning strategies, and create Theta algorithms to find short and realistic looking game paths. Next, you’ll learn how the AI should behave when there is a lot of characters in the same scene.

You'll explore which methods and algorithms, such as possibility maps, Forward Chaining Plan, Rete Algorithm, Pruning Strategies, Wall Distances, and Map Preprocess Implementation should be used on different occasions. You’ll discover how to overcome some limitations, and how to deliver a better experience to the player. By the end of the book, you think differently about AI.

Style and approach

The book has a step-by-step tutorial style approach. The algorithms are explained by implementing them in #.

Table of contents

  1. 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
  2. Different Problems Require Different Solutions
    1. A brief history of and solutions to game AI
    2. Enemy AI in video games
    3. From simple to smart and human-like AI
    4. Visual and audio awareness
    5. Summary
  3. Possibility and Probability Maps
    1. Game states
    2. Possibility maps
      1. How to use possibility maps
      2. Preparing a possibility map (FPS)
      3. Creating a possibility map (FPS)
    3. Defining the states
      1. DEFENSIVE state
      2. AGGRESSIVE state
      3. Possibility map conclusion
    4. Probability maps
      1. How to use probability maps
      2. Where to go from here
    5. Summary
  4. Production System
    1. Automated finite-state machines (AFSMs)
      1. Calculating chances
    2. Utility-based functions
    3. Dynamic game AI balancing
    4. Summary
  5. Environment and AI
    1. Visual interactions
    2. Basic environment interactions
      1. Moving environment objects
      2. Obstructive environment objects
      3. Breaking down the environment by area
    3. Advanced environment interactions
      1. Adapting to unstable terrain
      2. Using raycast to evaluate decisions
    4. Summary
  6. Animation Behaviors
    1. 2D animation versus 3D animation
      1. 2D animation - sprites
      2. 3D animation - bone structure
        1. The main differences
    2. Animation state machines
    3. Smooth transitions
    4. Summary
  7. Navigation Behavior and Pathfinding
    1. Navigation behavior
      1. Choosing a new direction
        1. Avoid walking against walls
          1. Choosing an alternative path
      2. Point to point movement
        1. Tower defense genre
          1. Racing genre
          2. MOBA genre
          3. Point to point movement and avoiding dynamic objects
    2. Summary
  8. Advanced Pathfinding
    1. Simple versus advanced pathfinding
    2. A* search algorithm
      1. How it works
        1. Disadvantages of using A*
        2. Going directly from A to B
        3. From point A to B with obstacles in the way
        4. Generating grid nodes
        5. Pathfinding implementation
    3. Summary
  9. Crowd Interactions
    1. What is crowd interaction
    2. Video games and crowd interactions
      1. Assassin's Creed
      2. Grand Theft Auto (GTA)
      3. The Sims
      4. FIFA/Pro evolution soccer
    3. Planning crowd interactions
      1. Group fight
      2. Communication (attention zones)
      3. Communication (talking to other AI characters)
      4. Team sports
    4. Crowd collision avoidance
    5. Summary
  10. AI Planning and Collision Avoidance
    1. Search
      1. Offensive search
        1. Predicting opponent actions
        2. Collision avoidance
    2. Summary
  11. Awareness
    1. Stealth sub-genre
    2. About tactics
    3. About awareness
    4. Implementing vision awareness
      1. Basic vision detection
        1. Advanced vision detection
        2. Realistic field of view effect
    5. Summary

Product information

  • Title: Practical Game AI Programming
  • Author(s): Micael DaGraça
  • Release date: June 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781787122819