Learning Game AI Programming with Lua

Leverage the power of Lua programming to create game AI that focuses on motion, animation, and tactics

Learning Game AI Programming with Lua

David Young

1 customer reviews
Leverage the power of Lua programming to create game AI that focuses on motion, animation, and tactics
Mapt Subscription
FREE
$29.99/m after trial
eBook
$18.90
RRP $26.99
Save 29%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$18.90
$44.99
$29.99p/m after trial
RRP $26.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781783281336
Paperback352 pages

Book Description

Game AI can be easily broken up into a number of components such as decision making, animation handling, and tactics, but the balance and interaction between each system strikes a balance between good AI and bad AI.

Beginning with an introduction to the AI sandbox, each new aspect of game AI is introduced, implemented, and then expanded upon. Going forward, you will learn to utilize open source libraries such as Ogre3D, Bullet Physics, OpenSteer, Recast, Detour, and Lua to create an AI sandbox with an entire codebase available to expand and step through.

This is done through a step-by-step approach, from learning to move basic shapes to fully animating your soldiers. By the end of the book, your AI will be able to navigate, pathfind, manage animation playback, communicate, and perceive their environment.

Table of Contents

Chapter 1: Getting Started with AI Sandbox
Introduction to AI sandbox
Summary
Chapter 2: Creating and Moving Agents
Creating a new sandbox project
Setting up the file structure
Extending the SandboxApplication class
Running your sandbox for the first time
Creating a new Decoda project
Configuring Decoda's run executable
Creating a sandbox Lua script
Shooting blocks
Creating an agent Lua script
Agent properties
Physics
Knowledge
Agents' movement
Agent-steering forces
Avoidance
Avoiding blocks and agents
Group steering
Creating a group of followers
Summing steering forces
Summary
Chapter 3: Character Animations
Skeletons and meshes
Attaching meshes to bones
Animation clips
Soldier poses
Manipulating animations
Animation blending
Animation state machine (ASM)
Building a weapon animation state machine
Building a soldier animation state machine
Updating animation state machines
Playing with states
Summary
Chapter 4: Mind Body Control
Creating a body
Adding callbacks to the animation state machine
Getting our soldier to shoot
Getting our soldier to run
Creating a brain
Direct animation control
A simple, finite state machine
Indirect animation control
Running the obstacle course
Action latency
Summary
Chapter 5: Navigation
Pathfinding
Creating a navigation mesh
Pathfinding on a navigation mesh
The path information
Adding random pathfinding to our soldier
Creating additional navigation meshes
Summary
Chapter 6: Decision Making
Creating userdata
Agent actions
Creating actions
Evaluators
Creating evaluators
Decision structures
Decision trees
Building a decision tree
Creating a decision tree agent
Finite state machines
Building a finite state machine
Creating a finite state machine agent
Strengths of finite state machines
Pitfalls of finite state machines
Behavior trees
Actions
Conditions
Selectors
Sequences
Creating a behavior tree object
Building a behavior tree
Creating a behavior tree agent
Strengths of behavior trees
Pitfalls of behavior trees
Summary
Chapter 7: Knowledge Representation
Knowledge sources
Blackboards
Creating soldier knowledge sources
Constructing a soldier blackboard
Updating decision evaluators
Updating behavior actions
Summary
Chapter 8: Perception
Events
Managing events
Creating agent senses
Agent visibility
Agent sighting events
Handling new agent sightings
Agent auditory senses
Auditory events
Handling auditory events
Decaying blackboard events
Decaying auditory events
Team communications
Updating agent behaviors
Summary
Chapter 9: Tactics
Influence maps
Constructing an influence map
Drawing influence maps
Accessing influences
Clearing influences
Spreading influences
Influence map layers
Updating the influence map
Soldier tactics
Scoring team influences
Scoring dangerous areas
Summary

What You Will Learn

  • Create an animation state machine to drive AI animations within Lua
  • Build and find paths on navigation meshes
  • Write and debug Lua scripts within a full-scale Lua IDE
  • Develop decision logic with behavior trees, state machines, and decision trees to build modular, reusable AI
  • Manage short- and long-term knowledge representation with blackboard data structures
  • Add sensory perception to give AIs the ability to see and hear
  • Develop high-level tactics with multiple AIs based on influence maps

Authors

Table of Contents

Chapter 1: Getting Started with AI Sandbox
Introduction to AI sandbox
Summary
Chapter 2: Creating and Moving Agents
Creating a new sandbox project
Setting up the file structure
Extending the SandboxApplication class
Running your sandbox for the first time
Creating a new Decoda project
Configuring Decoda's run executable
Creating a sandbox Lua script
Shooting blocks
Creating an agent Lua script
Agent properties
Physics
Knowledge
Agents' movement
Agent-steering forces
Avoidance
Avoiding blocks and agents
Group steering
Creating a group of followers
Summing steering forces
Summary
Chapter 3: Character Animations
Skeletons and meshes
Attaching meshes to bones
Animation clips
Soldier poses
Manipulating animations
Animation blending
Animation state machine (ASM)
Building a weapon animation state machine
Building a soldier animation state machine
Updating animation state machines
Playing with states
Summary
Chapter 4: Mind Body Control
Creating a body
Adding callbacks to the animation state machine
Getting our soldier to shoot
Getting our soldier to run
Creating a brain
Direct animation control
A simple, finite state machine
Indirect animation control
Running the obstacle course
Action latency
Summary
Chapter 5: Navigation
Pathfinding
Creating a navigation mesh
Pathfinding on a navigation mesh
The path information
Adding random pathfinding to our soldier
Creating additional navigation meshes
Summary
Chapter 6: Decision Making
Creating userdata
Agent actions
Creating actions
Evaluators
Creating evaluators
Decision structures
Decision trees
Building a decision tree
Creating a decision tree agent
Finite state machines
Building a finite state machine
Creating a finite state machine agent
Strengths of finite state machines
Pitfalls of finite state machines
Behavior trees
Actions
Conditions
Selectors
Sequences
Creating a behavior tree object
Building a behavior tree
Creating a behavior tree agent
Strengths of behavior trees
Pitfalls of behavior trees
Summary
Chapter 7: Knowledge Representation
Knowledge sources
Blackboards
Creating soldier knowledge sources
Constructing a soldier blackboard
Updating decision evaluators
Updating behavior actions
Summary
Chapter 8: Perception
Events
Managing events
Creating agent senses
Agent visibility
Agent sighting events
Handling new agent sightings
Agent auditory senses
Auditory events
Handling auditory events
Decaying blackboard events
Decaying auditory events
Team communications
Updating agent behaviors
Summary
Chapter 9: Tactics
Influence maps
Constructing an influence map
Drawing influence maps
Accessing influences
Clearing influences
Spreading influences
Influence map layers
Updating the influence map
Soldier tactics
Scoring team influences
Scoring dangerous areas
Summary

Book Details

ISBN 139781783281336
Paperback352 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Unity 2D Game Development Book Cover
Mastering Unity 2D Game Development
$ 32.99
$ 6.60
Building Machine Learning Systems with Python Book Cover
Building Machine Learning Systems with Python
$ 29.99
$ 6.00
Procedural Content Generation for C++ Game Development Book Cover
Procedural Content Generation for C++ Game Development
$ 39.99
$ 28.00
Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
Lua Game Development Cookbook Book Cover
Lua Game Development Cookbook
$ 39.99
$ 28.00
OpenGL Development Cookbook Book Cover
OpenGL Development Cookbook
$ 29.99
$ 21.00