Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Unity 5.x Game AI Programming Cookbook

You're reading from  Unity 5.x Game AI Programming Cookbook

Product type Book
Published in Mar 2016
Publisher Packt
ISBN-13 9781783553570
Pages 278 pages
Edition 1st Edition
Languages
Author (1):
Jorge Palacios Jorge Palacios
Profile icon Jorge Palacios

Table of Contents (15) Chapters

Unity 5.x Game AI Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Behaviors – Intelligent Movement 2. Navigation 3. Decision Making 4. Coordination and Tactics 5. Agent Awareness 6. Board Games AI 7. Learning Techniques 8. Miscellaneous Index

Representing the world with points of visibility


This is another widely-used technique for world representation based on points located throughout the valid area of navigation, whether manually placed or automated via scripting. We'll be using manually-placed points connected automatically via scripting.

Getting ready

Just like the previous representation, it's important to have several things in order before continuing:

  • Having the Edge class prepended to the Graph class in the same file

  • Defining the GetEdges function in the Graph class

  • Having the Vertex class

Note

The vertex objects in the scene must have a collider component attached to them, as well as the Vertex tag assigned. It's recommended for them to be unitary Sphere primitives.

How to do it...

We'll be creating the graph representation class as well as a custom Vertex class:

  1. Create the VertexVisibility class deriving from Vertex:

    using UnityEngine;
    using System.Collections.Generic;
    
    public class VertexVisibility : Vertex
    {
        void Awake...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}