
- 348 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Practical Game AI Programming
About this book
Jump into the world of Game AI developmentAbout 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 performanceWho This Book Is ForThis 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 crowdIn DetailThe 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 approachThe book has a step-by-step tutorial style approach. The algorithms are explained by implementing them in #.
Tools to learn more effectively

Saving Books

Keyword Search

Annotating Text

Listen to it instead
Information
Navigation Behavior and Pathfinding
Navigation behavior
Choosing a new direction
Avoid walking against walls

public float Speed;
public float facingLeft;
public float facingRight;
public float facingBack;
public static bool availableLeft;
public static bool availableRight;
public bool aLeft;
public bool aRight;
void Start ()
{
}
void Update ()
{
aLeft = availableLeft;
aRight = availableRight;
transform.Translate(Vector2.up * Time.deltaTime * Speed);
if(facingLeft > 270)
{
facingLeft = 0;
}
if(facingRight < -270)
{
facingRight = 0;
}
}
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag == "BlackCube")
{
if(availableLeft == true && availableRight == false)
{
turnLeft();
}
if(availableRight == true && availableLeft == false)
{
turnRight();
}
if(availableRight == true && availableLeft == true)
{
turnRight();
}
if(availableRight == false && availableLeft == false)
{
turnBack();
}
}
}
void turnLeft ()
{
facingLeft = transform.rotation.eulerAngles.z + 90;
transform.localRotation = Quaternion.Euler(0, 0, facingLeft);
}
void turnRight ()
{
facingRight = transform.rotation.eulerAngles.z - 90;
transform.localRotation = Quaternion.Euler(0, 0, facingRight);
}
void turnBack ()
{
facingBack = transform.rotation.eulerAngles.z + 180;
transform.localRotation = Quaternion.Euler(0, 0, facingBack);
}
public bool leftSide; public bool rightSide; void Start ()
{ if(leftSide == true)
{ rightSide = false; } if(rightSide == true)
{ leftSide = false; } } void Update () { } void OnTriggerStay2D(Collider2D other) { if(other.gameObject.tag == "BlackCube") { if(leftSide == true && rightSide == false) { Character.availableLeft = false; } if(rightSide == true && leftSide == false) { Character.availableRight = false; } } } void OnTriggerExit2D(Collider2D other) { if(other.gameObject.tag == "BlackCube") { if(leftSide == true) { Character.availableLeft = true; } if(rightSide == true) { Character.availableRight = true; } } }

Table of contents
- Title Page
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Different Problems Require Different Solutions
- Possibility and Probability Maps
- Production System
- Environment and AI
- Animation Behaviors
- Navigation Behavior and Pathfinding
- Advanced Pathfinding
- Crowd Interactions
- AI Planning and Collision Avoidance
- Awareness
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app