You are previewing Introduction to Game AI.
O'Reilly logo
Introduction to Game AI

Book Description

Today's game players expect increasingly realistic interaction within games. "Introduction to Game AI" teaches readers who are new to game AI the skills they need through hands-on projects based on small, understandable games. While there are many books that take a more advanced approach to this topic, this is one of the only books that focuses specifically on beginners. Every project in the book can be completed using tolls that are available for free online, and new skills are taught using easy to follow instructions and examples.

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. CD-ROM Downloads
  5. 1. What Is Game AI?
    1. An Introduction to Visual Basic
      1. Getting Visual Basic
      2. The Hit Point Calculator Project
    2. Chapter Summary
    3. Chapter Review
    4. References
  6. 2. Simple Hard-Coded AI
    1. The Good, the Bad, and the Ugly
      1. The Good
      2. The Bad
      3. The Ugly
    2. Projects
      1. A Simple Thermostat
      2. Analysis
      3. A More Sophisticated Implementation
      4. State of the Art
    3. Chapter Summary
    4. Chapter Review
    5. Exercises
  7. 3. Finite State Machines (FSMs)
    1. What Are FSMs?
    2. Design and Analysis
      1. Single-Transition Review
      2. Multiple-Transition Review
      3. Complexity
      4. Failure Modes
        1. Concurrent States
        2. State Explosion
        3. Transition Explosion
    3. Projects
      1. A Brief Foray into Object-Oriented Programming
      2. FSM Objects
        1. State Objects
        2. Transition Objects
        3. The Machine Object
        4. The Monster Object
      3. Creating the MonsterAI Project
    4. Chapter Summary
    5. Chapter Review
    6. Exercises
    7. References
  8. 4. Rule-Based Systems
    1. What Is a Rule-Based AI?
    2. Design and Analysis
    3. Advantages
    4. Disadvantages
    5. The Minesweeper Project
      1. Implementing the Basic Game
        1. The Playing Field
        2. Squares
        3. Adding Squares to the Playing Field
        4. Turning Plain Squares into Mines
        5. Neighbor
        6. Making It Playable
        7. Making It Fun: Adding Flags and a Safety Feature
        8. Implementing the AI
        9. The AI Needs to Think Out Loud
        10. Rules
        11. A Rule for Single-Square Evaluation
        12. The Framework
        13. Adding the Framework to the Game
        14. Rules for Two-Square Evaluation
        15. A Two-Square Evaluation Rule Using Near Neighbors
        16. Two-Square Evaluation Using Non-Adjacent Squares
        17. Do We Need More Rules?
    6. Chapter Summary
    7. Chapter Review
    8. Exercises
    9. References
  9. 5. Random and Probabilistic Systems
    1. Can That Be AI?
    2. Computing the Odds
      1. Monte Carlo Methods
      2. Precomputing
      3. Faking It
    3. Using the Odds: Factors to Consider
    4. Design and Analysis
    5. Advantages
    6. Disadvantages
    7. The Day in the Life Project
      1. The Simulation
      2. Occupations
      3. The Simulated People
      4. Complexity
      5. Implementing the Basic Game
      6. Implementing the AI
      7. Finishing the Code
      8. Results
    8. Chapter Summary
    9. Chapter Review
    10. Exercises
    11. References
  10. 6. Look-Ahead: The First Step of Planning
    1. Evaluation Functions
    2. Pruning
    3. Heuristics
      1. Complexity Without Heuristics
      2. Complexity with the Line Heuristics
      3. Complexity with Depth-Limit Heuristics
      4. Drawbacks to Heuristics
    4. Discrete Moves
    5. Knowledge Representation
    6. Advantages to Look-Ahead
    7. Disadvantages
    8. Applicability
    9. The Fox and Hounds Project
      1. Moves and Neighbors
      2. What Is Needed for Game State?
      3. Evolution of the Evaluation Function
      4. Game Board User Interface
      5. Implementing Moves and Neighbors
      6. Graphical Squares
      7. Implementing Game State
        1. Constants
        2. GameState class
      8. Board Code
      9. Enabling the Player’s User Interface
        1. UI Elements in the Board Class
        2. Game State Support for the UI
        3. Drag and Drop in the Button Class
      10. Adding the AI
        1. Connecting the UI to the AI
        2. The Public Interface to the AI
        3. Internal Helper Routines for the AI
        4. The Fox’s Move
        5. The Fox’s Look-Ahead
        6. The Hounds’ Move
        7. Hounds’ Look-Ahead
    10. Chapter Summary
    11. Chapter Review
    12. Exercises
    13. References
  11. 7. Book of Moves
    1. This Seems Familiar
    2. Killer Moves
    3. Hybrid AI
      1. Chess
      2. Twixt
        1. The Game Board
        2. Complexity
      3. Minesweeper
        1. The Basic Numbers
        2. A Middle First Move
        3. A Corner First Move
        4. An Edge First Move
        5. One Square Away from an Edge
        6. One Square Diagonally Away from a Corner
        7. Can We Apply This?
    4. Advantages
    5. Disadvantages
    6. Projects
      1. Fox and Hounds
      2. Minesweeper
    7. Chapter Summary
    8. Chapter Review
    9. Exercises
    10. References
  12. 8. Emergent Behavior
    1. Give My Creature ALife!
    2. Proven Recipes
    3. Interaction
    4. Simple Behaviors
    5. Between Order and Chaos
    6. Feedback and Control
      1. Reinforcement
      2. Timing
        1. Fast Feedback
        2. Slow Feedback
        3. Feedback in Cars and Trucks
    7. Beyond Steering
    8. Advantages
    9. Disadvantages
    10. The Cars and Trucks Project
      1. The Road and the Vehicles
      2. Movement and Animation
    11. Chapter Summary
    12. Chapter Review
    13. Exercises
    14. References
  13. 9. Evoking Emotions on the Cheap
    1. What Emotions Do Popular Games Invoke?
    2. Music
    3. Mood
      1. Clothing
      2. Lighting
      3. Texturing
    4. Plot
    5. Camera
    6. A Wide Skill Set
    7. Modeling Emotional States
    8. Advantages
    9. Disadvantages
    10. Projects
      1. Using Action States for Emotion States
      2. Using a Separate FSM for Emotions
      3. Modeling Needs and Relationships
        1. User Interface
        2. Helpers
        3. The Mini-Database
        4. The Person Class
        5. Finishing the Cruise Class
    11. Chapter Summary
    12. Chapter Review
    13. Exercises
    14. References
  14. 10. Topics to Pursue from Here
    1. A* Path Finding
      1. An A* Example
      2. Details in the Lists
      3. Caveats
    2. Machine Learning
      1. Training
      2. Why Don’t These Methods Get Used in Games?
      3. Neural Networks
        1. Classifiers
        2. Input Features
      4. Genetic Algorithms
    3. Behavior Trees
      1. Top-Down Evaluation
      2. Bottom-Up Evaluation
      3. Advantages
    4. Planning
      1. STRIPS
      2. GOAP
      3. HTN
    5. Resources
    6. Chapter Summary
    7. Chapter Review
    8. Exercises
    9. References
  15. Answers to Chapter Review Questions
    1. Chapter 1: What Is Game AI?
    2. Chapter 2: Simple Hard-Coded AI
    3. Chapter 3: Finite State Machines (FSMs)
    4. Chapter 4: Rule-Based Systems
    5. Chapter 5: Random and Probabilistic Systems
    6. Chapter 6: Look-Ahead: The First Step of Planning
    7. Chapter 7: Book of Moves
    8. Chapter 8: Emergent Behavior
    9. Chapter 9: Evoking Emotions on the Cheap
    10. Chapter 10: Topics to Pursue From Here