4.6 out of 5
4.6
1916 reviews on Udemy

The Beginner’s Guide to Artificial Intelligence in Unity.

A practical guide to programming non-player characters for games.
Instructor:
Penny de Byl
34,519 students enrolled
English More
Design and program NPCs with C# in Unity
Explain how AI is applied in computer games
Implement AI-related Unity Asset plugins into existing projects
Work with a variety of AI techniques for developing navigation and decision making abilities in NPCs

Do your non-player characters lack drive and ambition?  Are they slow, stupid and constantly banging their heads against the wall? Then this course is for you.  Join Penny as she explains, demonstrates and assists you in creating your very own NPCs in Unity with C#. All you need is a sound knowledge of Unity, C# and the ability to add two numbers together.

In this course, Penny reveals the most popular AI techniques used for creating believable character behaviour in games using her internationally acclaimed teaching style and knowledge from over 25 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 teach you about the fundamental AI techniques used in today’s games.  You’ll join in as NPCs are programmed to chase, patrol, shoot, race, crowd and much more.

Learn how to program and work with:

  • vectors

  • waypoints

  • navmeshes

  • the A* algorithm

  • crowds

  • flocks

  • animated characters

  • vehicles

Contents and Overview

The course begins with a detailed examination of vector mathematics that sits at the very heart of programming the movement of NPCs. Following this, systems of waypoints will be used to move characters around in an environment before examining the Unity waypoint system for car racing with AI controlled cars.  This leads into an investigation of graph theory and the A* algorithm before we apply these principles to developing navmeshes and developing NPCs who can find their way around a game environment.  Before an aquarium is programmed complete with autonomous schooling fish, crowds of people will be examined from the recreation of sidewalk traffic, to groups of people fleeing from danger. Having examined the differing ways to move NPCs around in a game environment, their thinking abilities will be discussed with full explanations and more hands-on workshops using finite state machines and behaviour trees.

The follow-along workshops included in the course come with starter Unity asset files and projects complete with solutions.  Throughout, there are also quizzes and challenge exercises to reinforce your learning and guide you to express your newfound knowledge.

At the completion of this course you will have gained a broad understanding of what AI is in games, how it works and how you can use it in your own projects.  It will equip you with a toolset to examine any of the techniques presented in more depth to take your game environments to the next level.

What students are saying about this course:

  • This has been my favourite Udemy-Unity course so far. It took me from literally 0% knowledge of how game AI is achieved, and took me to a whole new level. Waypoints, pathfinding, state machines, etc etc etc are all covered in-depth and will reveal the magic (spoiler alert: it isn’t magic) behind making your computer characters seem like they really have a mind of their own.

  • Oh My God. I love her way of teaching things. I haven’t finished this course yet. But all i can say is that it is another brilliant course from her. Artificial intelligence by itself is a tricky thing to do. And before starting this course i never thought that i will understand anything in it. But i was wrong. With her style of teaching, you will learn how to move your characters in an ”intelligent“ way. This course is perfectly sliced and the pace is wonderful.

Introduction

1
Introduction

This lecture introduces the course by outlining all the content that will be covered with a section by section breakdown.

2
Join the H3D Student Community

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

3
FAQ's
4
Not So Scary Vector Mathematics

In this lecture we will get an overview of vectors and why they are an important concept to have an understanding of before you launch into programming the movement of an NPC.

5
Vector Mathematic Basics Cheat Sheet
6
Test your vector mathematics knowledge
7
Important Note Regarding Unity Updates to FBX Model Importing
Unity uses the FBX file format by default to represent 3D models. Within Unity 2017 and greater the way the files are dealt with has changed slightly and may cause you to lose the textures from your models. Take note of the process in this lecture that will assist you in fixing this issue when you encounter it later in the course.

Moving

1
Vectors and Moving in a Straight Line

In this lecture we will take a quick look at the nature of vectors and then discuss through a practical application how they can be used to move a character forward at a constant speed.

2
Traveling to a Goal Location

Follow along in the lecture as we setup a goal location for the character to move towards. You will also be shown how to change the facing direction of a character such that it looks in the direction it is travelling.

3
Pushing the Character Forward

In this lecture we will examine a different approach to moving the character. This time instead of setting a vector to travel along we will turn the character towards a goal and then push the character in a forward direction.

4
Slerping

Instead of snapping a character around to face a goal in a single update you may want more smooth turning behaviour to occur that makes the movement appear more natural. In this lecture we will examine the slerp method for achieving this.

5
About Animation and Translation

In this lecture we will take a quick look at the difference between animation translation and translating with code. Eitherway is acceptable and it will depend on what you are trying to achieve with the look of your character as to which one is more appropriate.

6
Waypoints

In this lecture we will look at the simplest form of AI navigation: waypoints. Using the code we've developed thus far by giving the NPC an array of goals we can change its behaviour from chasing to patrolling.

7
Challenge

Cars

1
Unity's Waypoint System

If you import the Utilities from Unity's included assets you'll find code for setting up waypoints and navigating a circuit. In this lecture we will look at how to integrate these Unity asset's with our own code.

2
Car Racing with Waypoints

In this lecture we will examine how to create a simple car NPC that can accelerate and brake while following a circuit tracker.

3
Customising Car Behaviours

Continuing where we left the previous lecture we will add in another car and set about making the properties of the movement behaviour customisable.

4
Unity's Vehicle System

Inside Unity's Standard Assets you will find the setup for a Waypoint following AI car with many customisable properties. In this lecture we will explore this feature as well as discuss how to add your own custom model into the system.

Waypoints

1
Graph Theory and Pathfinding

Graph Theory underpins so many AI techniques and it certainly deserves some focussed attention. In this lecture we will examine the structure of graphs and several path searching algorithms will be discussed.

2
Pathfinding through Waypoints

In this lecture we will apply the A* algorithm to finding a path through a system of waypoints converted into a graph.

3
Pathfinding through Waypoints Part 2

In part 2 of this hands-on workshop to put together a waypoint graph traversal system using the A * algorithm we will add UI buttons to send location commands to the NPC.

4
Challenge
5
Waypoints in 2D

This short article will explain how the code for dealing with 3D waypoints can be modified for 2D environments.

NavMeshes

1
NavMesh Basics

In this lecture we will modify the pathfinding exercise created thus far and introduce the concept of a NavMesh. This will reduce the amount of code we need to write as well as the time taken to setup a waypoint system manually.

2
From Waypoints to NavMesh

In this lecture we will turn the previous waypoint system with the tank into a navmesh based project.

3
NavMesh Agents Part 1

In this lecture we will start taking a closer look at the navmesh agent component and explore the various settings for the baked nav mesh agent that controls how the navmesh is generated.

4
NavMesh Agents Part 2

Agents can be assigned different areas of the NavMesh through which to travel. In this lecture we will look at how to set up different areas with different costs and associate the agents with them.

5
Following a Player on A NavMesh and Setting-Up Off Mesh Links

The test of a NavMesh is to try it out with a real character in a real situation. It's then you'll find glitches in the default settings and automatically generated paths. Without having to remodel the environment, off-mesh links can be generated to provide smooth paths were their aren't any. In this lecture we will make a character follow a first person player character around a map while tweaking the NavMesh to handle different situations when gaps and drops appear in the NavMesh.

6
Fixing Mixamo Textures

This video link describes how to fix textures on imported FBX files from Mixamo.

7
Animating on a NavMesh

In this lecture we will examine how the NavMesh agent code and be coordinated with character animation to provide smooth and believable movement of a character when pathfinding over a NavMesh.

8
Syncing Animation Speed with NavMesh Agent Speed

In this short lecture I will demonstrate how to sync the animation speed with the nav mesh agent speed.

9
Multiple NavMeshes for Different Agent Sizes

In order to include multiple navmeshes to cater for multiple different navmeshagent sizes we need to turn to some beta code that isn't currently included in Unity but available for download and inclusion. In this lecture we will walk through the setups of creating multiple navmeshes after a quick refresher on setting up humanoid animations with strafe sets.

10
Challenge

Autonomously Moving Agents

1
Seek and Flee

In this video students will follow along to implement simple seek and flee methods for a Nav Mesh agent.

2
Pursuit

In this video students will learn about the differences in dynamics between the seek and pursuit behaviours and add an new method for moving an agent into the code.

3
Evade

In this video students will be challenged to create their own evade method which will see the agent move away from the predicted location of the target.

4
Wander

In this video students will examine one method of producing a wandering behaviour that will have the agent freely walk around the environment with smooth randomness.

5
Hide Part 1

In this video students will take a look at the basics behind the hide behaviour.  In it we will create a simple hide method that will have the agent hide behind the closest obstacle in the environment.

6
Hide Part 2

In this video students complete the development of the hiding behaviour and work to calculate a more accurate hiding location and reduce the number of calls to the method in the update.

7
Complex Behaviours

In this video students will learn how to combine a number of steering behaviours with simple geometric conditions to produce complex behaviours in agents.

8
Behaviour Challenge

In this video students will be challenged to integrate the wander behaviour into the complex behaviour to have the agents go into a wander when the target cop is out of range.

Moving As One

1
Crowd Simulation

There are many factors to included in a crowd simulation... or are there? Seemingly very complex movement behaviour can be generated for groups of characters with some very simple rules. This lecture will show you how.

2
Creating a City Crowd Part 1

In this series of lectures we will set up a city scene with a crowd walking along the sidewalk.

3
Creating a City Crowd Part 2

This lecture continues on from the last adjusting animation behaviours and speeds to vary from agent to agent as well as introduces the concept of a dynamic obstacle that can move around a navmesh and be avoided by the agents.

4
Fleeing

A behaviour seen in NPC movement is fleeing. This is a technique for steering a character away from danger. In this lecture we will look at the mathematics involved in the movement and apply it to the crowd simulation.

5
Flocking Part 1

Flocking is capable of producing incredible behaviour from three simple vector calculations. In this lecture you will learn how to apply this to the development of schooling fish.

6
Flocking Part 2

In this second part of the flocking workshop we will add extra behaviours to the fish by controlling the boundary of their swimming range.

7
Flocking Part 3

The third part of the flocking workshop will explore ways in which the fish can avoid obstacles in their environment through raycasting and vector calculations.

8
Challenge 1
9
Challenge 2
10
Challenge 3

Let's Start Thinking

1
Line of Sight

In this lecture we will develop an NPC that can detect the presence of a player and act accordingly. We will implement step-by-step this algorithm which is one of the simplest AI techniques used.

2
Finite State Machines Part 1

Finite State Machines are a staple AI method used in games as they elegantly segregate the states, behaviours and logic used by NPCs. In part one we will begin looking at how the Unity animation system can be used to create such a machine.

3
Finite State Machines Part 2

In this second part of the FSM workshop we will add a base NPC class to enable sharing of properties between behaviour scripts and then add in the functionality to move from patrol to chase and back again.

4
Finite State Machines Part 3

In the final FSM lecture, steping you through the setup for a FSM, we will complete the example by adding in bullet shooting functionality and states onto the NPC tank.

5
Converting the FSM to Work on a Navmesh

In this short lecture I'll show you how to convert the waypoint system used to move the tank around to have the same FSM work on a navmesh.

6
Challenge

Behaviour Trees

1
Introduction to Behaviour Trees

In this lecture Behaviour Trees will be introduced. Well take a look at their structure and the theory of their execution.

2
Sequence Nodes Part 1

This lecture begins by taking you through the setup for our behaviour tree project before starting with a very simple sequencial behaviour tree as a demo.

3
Sequence Nodes Part 2

We continue our examination of sequences in this lecture by creating a longer set of actions and modifying different behaviour tree specific returns discover what makes sequences run and fail. Towards the end we will start creating a new behaviour tree for attacking and take a look at the wait leaf node.

4
Embedding Logic in Behaviour Trees

In this lecture we will take a look at the while decorator node that allows you to invert the value of an action and also perform logic tests in the tree at a higher level than leaf nodes.

5
Selector Nodes

This lecture will introduce the selector node. This type of node can be used when any (but only one) of the children nodes need to run.

6
More Logic for Complex Behaviours

In this lecture we will complete the full set of single behaviour trees that will define all behaviours of the agent by adding the abilities to flee from danger and die.

7
Putting Together a Complex Behaviour Tree

To finish our investigation into Behaviour Trees all the smaller trees made throughout this section will be combined to inform the total behaviour of the agent droid. A final version of the project is attached as a download.

8
Challenge

Goal-Orientated Action Planning

1
Introduction to GOAP

Goal-Orientated Action Planning is an AI technique that turns Finite State Machines on their head. It decouples goals from actions and provides for a very dynamic NPC behavioural system.

2
Getting Started with GOAP in Unity

In this lecture we will get started with GOAP by setting up a simple scene and adding an agent.

3
Adding Actions to GOAP

In this lecture the GOAP agent will be given its first set of actions.

4
Adding Multiple Plans to GOAP

To create more complex behaviours in an agent you can add multiple plans that it can execute when the world states are right. In this lecture we will do this by extending the baker behaviour.

5
Global States and Multiple Agents

Even more complexity can be added when multiple inventories and agents are introduced to the system. This lecture will take you through the addition of a world inventory as well as a new agent type.

End Words

1
Where To Now?
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.6
4.6 out of 5
1916 Ratings

Detailed Rating

Stars 5
1244
Stars 4
525
Stars 3
115
Stars 2
15
Stars 1
17
30-Day Money-Back Guarantee

Includes

11 hours on-demand video
12 articles
Full lifetime access
Access on mobile and TV
Certificate of Completion

Community

For Professionals

For Businesses

We support Sales, Marketing, Account Management and CX professionals. Learn new skills. Share your expertise. Connect with experts. Get inspired.

Community

Partnership Opportunities

Layer 1
samcx.com
Logo
Register New Account
Compare items
  • Total (0)
Compare
0