Sorry, this page is no longer available
Sorry, this page is no longer available
We may earn an affiliate commission when you visit our partners.
Course image
Penny de Byl and Penny Holistic3D

Behaviour Trees (BTs) are an A.I. architecture that provide game characters with the ability to select behaviours and carry them out, through a tree-like architecture that defines simple but powerful logic operations.  It can be used across a wide range of game genres from first-person shooters to real-time strategies and developing intelligent characters capable of making smart decisions.   The codebase is deceptively simple and yet logical, reusable and extremely powerful.  The library is written in C# and implemented in Unity 2020, however will easily port to other applications.

Read more

Behaviour Trees (BTs) are an A.I. architecture that provide game characters with the ability to select behaviours and carry them out, through a tree-like architecture that defines simple but powerful logic operations.  It can be used across a wide range of game genres from first-person shooters to real-time strategies and developing intelligent characters capable of making smart decisions.   The codebase is deceptively simple and yet logical, reusable and extremely powerful.  The library is written in C# and implemented in Unity 2020, however will easily port to other applications.

The project has been tested in Unity 6.

In this course, Penny demystifies the advanced A.I. technique of BTs used for creating believable and intelligent game characters in games, using her internationally acclaimed teaching style and knowledge from almost 30 years working with games, graphics, and having written two award-winning books on games AI. Throughout, you will follow along with hands-on workshops designed to take you through every step of putting together your own BT API.  You will build the entire BT library from the ground up, while building an art gallery simulation scenario in parallel, to test the API as you go.

Learn how to program and work with:

  • A Behaviour Tree Library and API that's reusable across a wide range of game projects.

  • Tree architectures, nodes, leaves, sequences, and selectors that define the behaviour of individual non-player characters (NPCs).

  • Navigation Meshes and Agents that provide advanced path planning and navigation capabilities for characters.

  • A Blackboard System that acts as a global inventory for world states and allows characters to communicate with each other.

Contents and Overview

Throughout the course, you will follow along while a BT library and API are constructed from the ground up, to allow you intimate knowledge of the codebase.  Alongside this, a simple art gallery simulation will be constructed to test out the functionality of the library as it is put together.  The simulation will also rely on Unity's NavMesh System for navigation and path planning.

The course begins with an overview of Behaviour Trees and covers all the fundamental elements (including trees, nodes, leaves, sequences, selectors, and other logical constructs). Code will be developed to navigate the Behaviour Tree and used to drive non-player characters in the art gallery including a robber, cop, visitors and workers. Throughout this, students will gain a solid knowledge of how Behaviour Trees are constructed and can be traversed, to apply actions to game characters.

At the completion of this course, students will have a fully-fledged BT library and API that they can reuse in their own game projects, to provide game characters with complex intelligent behaviours.

What students are saying about Penny's courses:

  • Turns out, the hardest part of this course for me is finding the words to describe how glad I am to have enrolled in it.

  • I honestly love Hollistic's teaching approach and I've never learned so much within a few hours about coding effectively with such detailed explanations.

  • Penny is an excellent instructor and she does a great job of breaking down complex concepts into smaller, easy-to-understand topics.

Enroll now

What's inside

Syllabus

While this course was developed in a previous version of Unity, we've tested the projects and they work with Unity 6. This video is a guide to help you adjust your learning in this course to use Unity 6.


Read more

In this lecture Penny will give a brief overview of the content of the course.

H3D has a bustling online student community.  Here's how to get involved.

How to contact us

Important Reading on Common Issues students have and how to ask for help.

In this video students will learn how to setup the AI Navigation package for the versions of Unity that it is not automatically included with.  This package will be used later in this course.

In this lecture students will learn about the structure of behaviour trees and the fundamental elements that are used to construct them.

In this lecture students will write the first class for the behaviour tree system that will underwrite the majority of the functionality for the technique.

In this lecture students will learn how to write code to traverse a behaviour tree and print out the structure.

In this lecture students will work begin writing the code for leaf nodes and get their NavMeshAgent character moving.

In this lecture students will create a helpful method to assist in moving an agent around on the navmesh and reduce repetitive code.

In this lecture students will learn how to construct the logic to implement a sequence node.

In this lecture students will learn how to create a selector node and insert it into the behaviour tree.

In this lecture students will learn how to integrate game engine specifics such as navmesh commands with the behaviour tree.

In this lecture students will learn how to create a condition node to add extra logic and functionality to a sequence.

In this lecture students will learn how to create a new node type that switches around a nodes return status such that a failure becomes a success and vice versa.

In this lecture we will create a generic behaviour tree agent that can be inherited from to create different agent types.

In this lecture students will learn how to replace the BTAgent update loop with a coroutine to better the system's performance.

In this lecture students will discover the agent is able to repeat actions from the behaviour tree but several other elements of the code need to be tweaked.

In this lecture students will learn how to return a fail state if a game object is no longer active and use a variable to hold onto a game object that is being used.

In this lecture students will learn how to add in extra code to a selector node to sort the children before executing a process.

In this lecture students will learn about two approaches they could make to create dynamic updating of the sort order in the PSelector class.

In this lecture students will be challenged to create a random selector node, the result of which will reveal a little floor in the sorting and prioritisation code.

In this lecture students will learn how to control when shuffling and sorting children occurs.

In this lecture students will learn how to create multiple leaf nodes from an array of items.

In this lecture students will learn how to integrate traditional AI algorithms into the nodes starting with the fleeing behaviour.

In this lecture student will complete coding and testing a small behaviour tree for fleeing.

In this lecture students will be challenged to integrate the steal and runAway behaviours into the same tree and then will discover some issues that may occur thereafter.

In this lecture we will examine how to use extra conditions throughout a behaviour tree to guide an agent's sequence of actions.

In this lecture students will add in a second behaviour tree to provide codependent conditions that must be true for another part of a tree to execute.

In this lecture students will be challenged to modify the structure of the steal behaviour tree to include the money amount as a co-dependency instead of an initial trigger.

In this lecture students will be challenged to modify the behaviour tree to add in different behaviours when one sequence fails.

In this lecture students will be challenged to add a new agent that is an art gallery patron who will view artworks.

In this lecture students will put together a simple behaviour tree to get the agent to get the patron to react to boredom.

In this lecture students will learn to integrate coroutines with the behaviours of the agents to adjust the values of agent properties.

In this lecture students will learn how to create a loop decorator node to force agents to repeat a behaviour while another tree returns success.

In this lecture students will learn how to create a blackboard which acts as a global inventory system for world states.

In this lecture students will discover how a blackboard state can be integrated into a behaviour tree.

In this lecture students will discover how to integrate the opening hours of the gallery into the robber's behaviour.

In this lecture students will learn how to determine when agents need to communicate with each other and how to begin coding for an interaction.

In this lecture students will learn how one agent can be used to control the behaviour of another agent.

In this lecture students will learn how to create a communication channel between individual agents so they can work together.

In this lecture students will examine ways to integrate logic using nodes instead of adding too much logical code into one leaf.

In this lecture students will add a new dependency into the worker behaviour to ensure the quit an action when the environment changes.

In this lecture students will be challenged to turn the cop into a BTAgent and have him patrol around the gallery.

In this lecture students will be challenged to code the cop to chase after the robber if the cop sees the robber while on patrol.

In this lecture students will learn about a couple of techniques to help them debug their behaviour trees in Unity.

In this video Penny will wrap up the course and suggest other topics you might be interested in.

This link provides further information on the courses you can look at taking based on your interests and skill level.

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Provides a fully-fledged behaviour tree library and API that can be reused in personal game projects, which allows characters to have complex intelligent behaviours
Teaches how to program and work with tree architectures, nodes, leaves, sequences, and selectors that define the behaviour of individual non-player characters
Uses Unity's NavMesh system for navigation and path planning, which allows learners to create agents that can navigate complex environments
Requires the AI Navigation package, which may need to be set up manually for some versions of Unity, which may require additional steps for some learners
Tested in Unity 6, which means that learners may need to adjust their learning if they are using older versions of Unity
Focuses on behaviour trees, which may not be relevant to learners interested in other AI techniques

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Building behaviour trees from scratch in unity

According to students, this course offers a largely positive experience for learning about Behaviour Trees in Unity. Many highlight the instructor's clear and knowledgeable teaching style. A significant strength is the approach of building the entire BT library from scratch, which learners found provided great insight into the internals and resulted in a reusable asset for their own projects. The course features helpful hands-on coding through an art gallery simulation project. While many appreciate the practical focus, some experienced developers noted the content felt more like a solid foundation than truly advanced, particularly regarding complex scenarios or code patterns. Recent reviews indicate good compatibility with Unity 6.
Seems compatible, even with Unity 6.
"Compatibility with Unity 6 was not an issue thanks to the provided guidance."
"The Unity 6 compatibility was good."
Practical coding reinforces learning.
"the hands-on coding is very helpful."
"The art gallery simulation is a fun way to test the system."
"The art gallery project ties everything together nicely."
Receive a practical, reusable library.
"The code provided is clean and reusable."
"The course provides a solid reusable foundation."
"This library is definitely going into my future projects."
"The reusable library is invaluable."
Learn by building the core system step-by-step.
"Building from scratch gives great insight."
"Excellent course that teaches you how to build a Behaviour Tree system from scratch."
"Building the library step-by-step is a great approach."
"Building the BT library was a great way to learn the internals."
Instructor praised for clear explanations.
"Penny explains the concepts clearly..."
"Penny is a fantastic instructor. She makes complex topics easy to understand."
"Penny is a very knowledgeable and clear instructor."
"Penny is brilliant."
Some integration or setup parts felt brief.
"Some sections felt a little rushed, especially the parts on integrating with NavMesh and the Blackboard system."
"I struggled a bit with the hands-on parts. The art gallery example... required a bit more setup than I expected."
"The Unity integration parts were a bit basic..."
May be more foundational than advanced.
"Some code sections felt a bit basic for an 'Advanced' course."
"Good foundation, but maybe not 'Advanced' enough for experienced programmers."
"I felt the Unity integration parts were a bit basic, and the 'Advanced' title might be misleading..."
"Still, it provides a functional library."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Advanced AI for Games; Behaviour Trees (Unity 6 Compatible) with these activities:
Review Unity Navigation Meshes
Review the fundamentals of Unity's Navigation Mesh system to ensure a solid understanding before diving into the course's implementation within Behavior Trees.
Show steps
  • Read the Unity documentation on NavMesh.
  • Watch a tutorial on basic NavMesh setup.
  • Create a simple scene with a NavMeshAgent.
Read 'Programming Game AI by Example'
Study a book on game AI to gain a broader understanding of the field and how behavior trees fit into the larger picture.
Show steps
  • Obtain a copy of 'Programming Game AI by Example'.
  • Read the chapters related to behavior trees.
  • Take notes on key concepts and examples.
Implement a Simple Behavior Tree
Practice implementing a basic behavior tree in Unity to control a simple game character's actions, reinforcing the concepts learned in the course.
Show steps
  • Create a new Unity project.
  • Design a simple character with basic actions.
  • Implement a behavior tree to control the character.
  • Test and debug the behavior tree.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Read 'Artificial Intelligence for Games, Second Edition'
Study a book on game AI to gain a broader understanding of the field and how behavior trees fit into the larger picture.
Show steps
  • Obtain a copy of 'Artificial Intelligence for Games, Second Edition'.
  • Read the chapters related to behavior trees and related AI concepts.
  • Take notes on key concepts and examples.
Document Your Behavior Tree API
Create documentation for the behavior tree API you built during the course, solidifying your understanding and providing a valuable reference for future projects.
Show steps
  • Review the behavior tree API code.
  • Write documentation for each class and method.
  • Create examples of how to use the API.
Contribute to a Behavior Tree Project
Contribute to an open-source behavior tree project, gaining experience working with a larger codebase and collaborating with other developers.
Show steps
  • Find an open-source behavior tree project.
  • Understand the project's codebase and contribution guidelines.
  • Identify a bug or feature to work on.
  • Submit a pull request with your changes.
Create a Demo Reel of AI Agents
Showcase your skills by creating a demo reel featuring AI agents controlled by behavior trees, demonstrating your ability to design and implement intelligent game characters.
Show steps
  • Design several AI agents with unique behaviors.
  • Implement behavior trees to control the agents.
  • Record footage of the agents in action.
  • Edit the footage into a compelling demo reel.

Career center

Learners who complete Advanced AI for Games; Behaviour Trees (Unity 6 Compatible) will develop knowledge and skills that may be useful to these careers:
AI Engineer
An AI Engineer specializes in developing artificial intelligence systems. This often entails creating complex behavior trees, pathfinding algorithms, and decision-making processes for game characters. This course helps an AI engineer by providing a hands-on approach to constructing behavior trees from scratch, covering fundamental elements such as nodes, leaves, and selectors. Furthermore, the course explores the integration of navigation meshes and agents for advanced path planning. The experience gained from building an art gallery simulation to test the API is valuable.
Artificial Intelligence Programmer
An Artificial Intelligence Programmer designs and implements AI systems for games. This role focuses on creating intelligent and believable non-player characters, often using techniques like behavior trees. For an AI Programmer, this course will be useful because it provides hands-on experience in constructing a behavior tree library and API from the ground up. The course also covers fundamental elements such as trees, nodes, leaves, sequences, and selectors. Furthermore, you'll build an art gallery simulation to test the API, integrating Unity's NavMesh system for navigation and path planning. This course gives you a deeper understanding of how to create character actions.
Gameplay Programmer
A Gameplay Programmer is responsible for implementing game mechanics, character controls, and interactive elements. This role often involves working with AI to create engaging and challenging gameplay experiences. By taking this course, a gameplay programmer gains valuable skills in implementing behavior trees, a powerful AI architecture. The course shows how to use tree architectures, nodes, leaves, sequences, and selectors to define NPC behavior. The course gives you a deeper understanding of how to create character actions. Working with Navigation Meshes and Agents to implement path planning can also be useful.
AI Architect
An AI Architect designs the overall structure and strategy for AI systems within a game or simulation. You'll be responsible for selecting the appropriate AI techniques, defining the interactions between AI agents, and ensuring the system meets the design goals. In this context, knowing behaviour trees is a powerful and essential tool. This course on behaviour trees is therefore critical, as it will enable you to create such trees to solve problems, using logic operations and simple but powerful designs. You may find the blackboard system to be particularly invaluable.
Simulation Engineer
A Simulation Engineer creates and maintains simulations for various purposes, including training, testing, and research. In the context of game AI, they might simulate realistic character behaviors or game environments. This course directly benefits simulation engineers by teaching them how to build behavior trees, which are crucial for creating complex and realistic AI behaviors. The art gallery simulation project within the course offers hands-on experience in designing and implementing simulated environments and agents. You may also find the use of a blackboard system particularly insightful.
Software Engineer
A Software Engineer designs, develops, and tests software applications. In the context of game development, this entails implementing AI systems, gameplay mechanics, and other interactive elements. This course may be valuable for software engineers because it provides a practical understanding of behavior trees, a widely used AI architecture. You'll learn how to program and work with behavior tree libraries and APIs. The course also covers fundamental concepts such as tree architectures, nodes, leaves, sequences, and selectors. Such experience is vital for those who wish to build a career as a Software Engineer in the gaming sector.
Game Designer
A Game Designer conceptualizes and designs the various elements of a game, including the AI behavior of non-player characters. This role requires a strong understanding of AI principles to create believable and engaging game experiences. This course is particularly helpful for game designers because it provides a practical understanding of behavior trees and their application. As a game designer, you'll learn how these can be used to design complex NPC behaviors and interactions. You'll gain insights into the underlying logic and structure of AI systems, using these insights to enhance their design decisions. Knowledge of the blackboard system may also prove useful.
AI Director
An AI Director oversees the entire AI implementation in a game, ensuring that the AI systems align with the game's design and create the desired player experience. This course may be useful for an AI Director because it gives you a practical understanding of behaviour trees, which they can leverage to design and manage those AI systems. An AI director may find useful the course's coverage of the fundamental elements of behaviour trees, including logical constructs. You can see how the blackboard system may be used to enhance gameplay.
Robotics Engineer
A Robotics Engineer designs, builds, and programs robots. While seemingly unrelated to game development, the principles of AI and behavior control are applicable to robotics. This course can introduce robotics engineers to behavior trees, a powerful tool for programming robot behaviors. While the course focuses on game AI, the underlying concepts of tree architectures, nodes, and selectors can be applied to robotics projects. The blackboard system may be useful in particular.
Machine Learning Engineer
A Machine Learning Engineer develops and implements machine learning models for various applications. While behavior trees are not machine learning algorithms, they can be used in conjunction with machine learning to create more advanced AI systems. This course may introduce machine learning engineers to behavior trees as a practical tool for implementing AI behaviors. By combining machine learning techniques with behavior trees, you can create more adaptable and intelligent game characters. The course will give you a greater appreciation for NPCs.
Avionics Engineer
An Avionics Engineer designs, develops, and tests the electronic systems used in aircraft and spacecraft. There is a need for smart automation in this domain. This course may be useful for an avionics engineer because it introduces AI concepts like behaviour trees. This engineer may learn new skills in logic processing, reuseable elements, and techniques. The blackboard system may be an invaluable aid as well.
Control Systems Engineer
A Control Systems Engineer designs and implements systems that control the behavior of machines and processes. While seemingly disparate from game development, the underlying principles of control systems can be applied to AI. This course may be useful for control systems engineers. You may find the construction of the AI library particularly insightful.
Technical Artist
A Technical Artist bridges the gap between art and programming, optimizing assets and implementing visual effects in games. While not directly involved in AI programming, understanding AI behavior can help technical artists optimize art assets and create visually compelling AI-driven animations. In this course, you can gain insight into how behavior trees drive character actions, that may inform the development of AI assets. Through the course, you will gain an appreciation of the integration of navigation meshes and agents can aid in efficient path planning.
Data Scientist
A Data Scientist collects, analyzes, and interprets large datasets to identify trends and insights. This role can intersect with game development by analyzing player behavior data to improve game design and AI. This course may not directly align with the typical tasks of a data scientist, but it provides valuable background knowledge on the AI systems that generate player behavior data. By understanding how AI works, a data scientist can better interpret player behavior patterns. The use of the blackboard as a global inventory system may be particularly insightful.
Quality Assurance Tester
A Quality Assurance Tester identifies and reports bugs and issues in games, ensuring a high-quality player experience. Knowledge of AI systems can help testers effectively test AI behaviors and identify potential issues. Taking this course may give testers a deeper understanding of how behavior trees work, enabling them to create more thorough and targeted test cases. Testers may better understand the logic behind NPC actions and identify edge cases more effectively. Testers may find the construction of the art gallery simulation to be particularly poignant.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Advanced AI for Games; Behaviour Trees (Unity 6 Compatible).
Provides a comprehensive overview of game AI techniques, including behavior trees. It offers practical examples and explanations that complement the course material. While not Unity-specific, the underlying AI principles are directly applicable. This book valuable resource for understanding the broader context of AI in games and solidifying the concepts taught in the course.
Provides a broad overview of AI techniques used in games, including behavior trees, pathfinding, and decision-making. It offers a theoretical foundation and practical examples to enhance understanding. While it's not specific to Unity, the concepts are widely applicable and provide a deeper understanding of the underlying principles. This book valuable resource for expanding your knowledge of game AI beyond the scope of the course.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser