We may earn an affiliate commission when you visit our partners.
Penny de Byl and Penny Holistic3D

What if you could build a character that could learn while it played?  Think about the types of gameplay you could develop where the enemies started to outsmart the player. This is what machine learning in games is all about. In this course, we will discover the fascinating world of artificial intelligence beyond the simple stuff and examine the increasingly popular domain of machines that learn to think for themselves.

Read more

What if you could build a character that could learn while it played?  Think about the types of gameplay you could develop where the enemies started to outsmart the player. This is what machine learning in games is all about. In this course, we will discover the fascinating world of artificial intelligence beyond the simple stuff and examine the increasingly popular domain of machines that learn to think for themselves.

In this course, Penny introduces the popular machine learning techniques of genetic algorithms and neural networks using her internationally acclaimed teaching style and knowledge from a Ph.D in game character AI and over 25 years experience working with games and computer graphics.  In addition she's written two award winning books on games AI and two others best sellers on Unity game development. Throughout the course you will follow along with hands-on workshops designed to teach you about the fundamental machine learning techniques, distilling the mathematics in a way that the topic becomes accessible to the most noob of novices.  

Learn how to program and work with:

  • genetic algorithms

  • neural networks

  • human player captured training sets

  • reinforcement learning

  • Unity's ML-Agent plugin

  • Tensorflow

Contents and Overview

The course starts with a thorough examination of genetic algorithms that will ease you into one of the simplest machine learning techniques that is capable of extraordinary learning. You'll develop an agent that learns to camouflage, a Flappy Bird inspired application in which the birds learn to make it through a maze and environment-sensing bots that learn to stay on a platform.

Following this, you'll dive right into creating your very own neural network in C# from scratch.  With this basic neural network, you will find out how to train behaviour, capture and use human player data to train an agent and teach a bot to drive.  In the same section you'll have the Q-learning algorithm explained, before integrating it into your own applications.

By this stage, you'll feel confident with the terminology and techniques used throughout the deep learning community and be ready to tackle Unity's experimental ML-Agents. Together with Tensorflow, you'll be throwing agents in the deep-end and reinforcing their knowledge to stay alive in a variety of game environment scenarios.

By the end of the course, you'll have a well-equipped toolset of basic and solid machine learning algorithms and applications, that will see you able to decipher the latest research publications and integrate the latest developments into your work, while keeping abreast of Unity's ML-Agents as they evolve from experimental to production release.

What students are saying about this course:

  • Absolutely the best beginner to Advanced course for Neural Networks/ Machine Learning if you are a game developer that uses C# and Unity.

  • A perfect course with great math examples and demonstration of the TensorFlow power inside Unity. After this course, you will get the strong basic background in the Machine Learning.

  • The instructor is very engaging and knowledgeable. I started learning from the first lesson and it never stopped. If you are interested in Machine Learning , take this course.

Enroll now

What's inside

Syllabus

Introduction

This lecture is a welcome to the course and introduction to the instructor and an overview of the course content.

In this lecture students will learn about the types of learning models implemented in machine learning.

Read more

This article provides guidances on how to study this course.

This article addresses common general questions about my courses.

Here's an overview of machine learning I gave at the Unity 2019 Conference in Sydney.  It's a brief overview of the domain without the jargon or mathematics.

In this section students will learn about a machine learning technique that takes its lead from the way our own human DNA has been constructed and Darwin's 'survival of the fittest theory'.

Genetic Algorithms are one technique classified under the larger umbrella of evolutionary computing. In this domain researchers use biological systems as the basis for designing code. Genetic algorithms are simple in design but are capable of producing extraordinatry learned behaviours.

In this lecture we begin creating a very simple genetic algorithm that will learn a player's colour preference.

This lecture completes the code for producing your first genetic algorithm application that will breed a set of sprites set to your favourite colour.

Test your knowledge of Genetic Algorithms.

The values stored in the genes can be used to code anything from colour, to movement, to speed. In this lecture we will examine how we can use a single gene to control movement and teach a population to walk along a beam.

In this lecture we will finish the movement strategy example of implementing a genetic algorithm to determine the best way to move to stay alive the longest.

Modify the single gene example code in the previous lectures and instead of testing for fitness on how long each bot survives, test for distance travelled. The result should be a population that prefer to walk along the beam. They will want to get as far away from their starting position as possible without falling off. 

This article is a short note about issues with Unity version compatibility with solution package files from the course.

In these next few lectures we will build a new genetic algorithm series that can train a group of bots to stay on a platform by teaching them when to turn and when to move forward.

In this lecture we finish the first phase of the genetic algorithm that trains bots to stay on a platform. We then make a few tweaks to how it senses the environment and discuss some improvements.

In this lecture we will finalise the training for the genetic algorithm before adding the Ethan third-person character into the scene to replace the capsule bot.

In this challenge you will be asked to create a genetic algorithm to traverse a maze. The video shows you the initial setup of the environment and allows you pausing time to build the application before one solution is given.

This lecture concludes stepping through the solution of the maze walking challenge.

In this lecture we will explore genetic algorithms further by creating a longer gene sequence and use it to train 2D birds to get through an obstacle course.

In this second half we will complete the application by setting up the bird prefabs and adding the PopulationManager.

Additional resources to help expand your knowledge of Genetic Algorithms beyond the scope of the course.

In this section students will learn about the fundamental element that drives neural networks.

A perceptron is the smallest functioning unit of a neural network. However, by itself it can still produce some stunning results. Development of this fundamental algorithm will introduce students to the nature of neural nets and how they function.

Produce a line by line perceptron using a spreadsheet.

In this workshop student's will follow along in Unity to create a perceptron in C#.

An exercise focused on improving your knowledge of perceptrons.

In this lecture you will learn how the weights are used by the perceptron to define a decision boundary that helps it classify inputs.

In this lecture you will create a perceptron to act as the brain of an NPC as you teach it to dodge balls.

After a perceptron is trained, all its 'knowledge' is contained in the weights. By saving these final weights you are essentially saving the artificial brain. The saved values can be reloaded to create an instantly trained perceptron.

In this section the perceptron concept will be taken to the next level to build artificial neural networks that are capable of processing powers beyond the single neuron.

This lecture provides a brief overview of artificial neural networks along with their architecture and uses.

In this lecture we will begin to program our own artificial neural network from scratch.

In the second part of this workshop to build a neural network we will finish creating the code and give it some training examples.

Having programmed an Artificial Neural Network we will now put it through it's paces and discuss training variables.

This lecture addresses three of the most frequently asked questions in neural network development:
1) what activation function should I use;
2) how many layers to I need, and
3) how many neurons do I need?

Once you've got your neural network code setup its a simple matter to add and use more activation functions. In this lecture you will learn how to add more activation functions to your code and analyse their usefulness.

Take a look at the Sinusoid, ArcTan and SoftSign. Write the code to program these into your ANN. 

Additional resources to help expand your knowledge of Artificial Neural Networks beyond the scope of the course.

In this section students will create neural networks to control the behaviours of non-player characters in gaming situations.

In this lecture we will start using the ANN for something game related and what better way than to create an NPC that plays Pong.

In the second part of the Pong playing neural network workshop, we will complete the code and examine the NPCs performance.

In the final part of creating an ANN that plays Pong we look at extending the training set by including more complex data that involves reflections.

Extend the game of Pong and add another paddle to act as the other player. 

In the real world training a neural network with data gathered from the real world can introduce problems that don't show up in purely academic examples. In these next few videos we will create a simple racing scenario, gather data from the game player's racing and inject this data into a neural networked player to train them to drive the track.

We continue on from the previous lecture by finishing our capture of player data to use in a neural network training set. We will examine a way to normalise and compress the large amount of collected information into something more suitable for a neural network.

Once you've collected the training data from the player you can begin training the neural network. In this lecture we will start writing the script to attach to the ANN driven kart.

This short note discusses how gathering data from different sensor angles isn't an issue.

In this lecture we will complete writing the code required to train an NPC ANN to navigate a racing track circuit given the collected user data as well as discuss some of the nuances of training in complex problem spaces with real data.

This lecture completes the training exercise for the go kart racing scenario by adding in code to load previously trained weights and finishes by examining ways to optimise the trained data even further to get the SSE down.

In this section the algorithms behind the Google TensorFlow library will be explored. They will be implemented with our own simple neural network to illustrate the internal workings.

Deep learning can be achieved through the reinforcement learning technique called Q-Learning. In this lecture we will explore the algorithm based on this theory getting ready to implement it with our own neural network.

This lecture begins our integration of Q-Learning into the existing neural network code. We will examine Q-Learning in this context to train a platform to balance a ball.

In this second part we will continue coding the Brain for the system and work through the integration of the critical Q-Learning algorithm and Bellman's equation to create the reward feedback system.

In the final part of this series we will complete the Brain code and run it to explore how well the platform balanace the ball.

Modify the balance beam ANN to create a Flappy Bird that learns to hover.

Additional resources to help expand your knowledge beyond the scope of the course.

ML-Agents
Read This First
In this section we will take a look at setting up and working with Unity's (beta) new machine learning functionality.

In this lecture we will cover the setting up of the python and Tensorflow environment essential for training the ML-Agents.

In this video we will take a look at an overview of the ML-Agent Project structure and step through building and training an example project.

This document outlines the changes you'll need to take into consideration in migrating ML-Agents 0.2 to 0.3.

In this article I will address the more common and simple questions raised by students with regards to the ML-Agent use and setup.

Now that you have Tensorflow and the Unity ML-Agents working it's time to create your own - from scratch. In these next lectures we will take a closer look at what makes the ML-Agent's system tick and explore the settings and options.

This lecture completes the development of a simple ML-Agent's application and steps through the training process.

A cheat sheet of quick help for working with ML-Agents.

In this lecture we will start developing an agent in a 2D environment that will learn to avoid an enclosing boundary, discuss more ML-Agent settings and examine discrete and continuous actions.

In this lecture we'll complete the avoidance agent by examining the difference between training with continuous and discrete values.

Modify the cat agent developed in the previous lecture to use raycasts to sense the proximity of the border colliders instead of the method currently being used. 

In this lecture I'll share with you the top ten things I have learnt when using ML-Agents system to help you design your agents better and debug issues that may arise.

In this lecture we will revisit the 2D floating cat example, train it to use raycast sensors and throw in some moving dogs to dodge.

Rewards

In this lecture we will train an agent to reach a goal position.

We will extend the abilities of our agent from the last lecture here and teach it to jump over a wall.

This section contains documents relating to ML-Agents Version 0.2 no longer referenced in this course.

Why this section is depreciated.

This lecture takes students step by step through the setup of Tensorflow.

This article is a step-by-step setup guide for Windows specific Tensorflow and ML-Agent issues.

This article is a step-by-step setup guide for Mac specific Tensorflow and ML-Agent issues.

In this lecture we will use a sample Unity application to demonstrate the steps involved in training a working brain with Tensorflow.

Recap of topics covered.

A short video with some final words from Penny.

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

Save this course

Save A Beginner's Guide To Machine Learning with Unity to your list so you can find it easily later:
Save

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 A Beginner's Guide To Machine Learning with Unity with these activities:
Review Linear Algebra Fundamentals
Solidify your understanding of linear algebra, which is essential for understanding the mathematical foundations of neural networks and machine learning algorithms used in Unity.
Browse courses on Linear Algebra
Show steps
  • Review vector and matrix operations.
  • Practice solving systems of linear equations.
  • Understand the concept of eigenvalues and eigenvectors.
Read 'Artificial Intelligence for Games'
Gain a broader understanding of AI in games, providing context for the machine learning techniques covered in the course.
Show steps
  • Read chapters related to machine learning and neural networks.
  • Experiment with the code examples provided in the book.
Follow Unity's ML-Agents Tutorials
Gain hands-on experience with Unity's ML-Agents toolkit by following official tutorials, reinforcing the practical application of machine learning in Unity.
Show steps
  • Set up the ML-Agents environment in Unity.
  • Work through the '3D Balance Ball' tutorial.
  • Experiment with different training parameters and agent configurations.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Experiment with Neural Network Parameters
Improve your intuition for neural network behavior by systematically varying parameters and observing the effects on training and performance.
Show steps
  • Choose a simple neural network project in Unity.
  • Vary the number of layers, neurons per layer, and learning rate.
  • Record the training time and final performance for each configuration.
  • Analyze the results and identify optimal parameter settings.
Implement a Simple Neural Network in Unity
Solidify your understanding of neural networks by building one from scratch in Unity, reinforcing the concepts taught in the course.
Show steps
  • Create a new Unity project.
  • Implement a basic neural network class with layers and activation functions.
  • Train the network on a simple dataset.
  • Visualize the network's performance in the Unity scene.
Create a Blog Post on Genetic Algorithms
Deepen your understanding of genetic algorithms by explaining the concept in your own words, solidifying your knowledge and improving communication skills.
Show steps
  • Research and gather information on genetic algorithms.
  • Write a clear and concise explanation of the algorithm.
  • Include examples of how genetic algorithms can be used in games.
  • Publish the blog post on a personal website or platform.
Read 'Deep Learning' by Goodfellow et al.
Gain a deeper theoretical understanding of deep learning, providing a solid foundation for using ML-Agents effectively.
View Deep Learning on Amazon
Show steps
  • Read chapters related to neural networks, backpropagation, and reinforcement learning.
  • Take notes on key concepts and algorithms.

Career center

Learners who complete A Beginner's Guide To Machine Learning with Unity will develop knowledge and skills that may be useful to these careers:
Artificial Intelligence Programmer
An Artificial Intelligence Programmer develops the algorithms and systems that allow games to exhibit intelligent behaviors. A course such as this one is directly applicable, offering insights into machine learning techniques like genetic algorithms and neural networks, which form the backbone of game AI. By exploring how to implement these algorithms within Unity, you gain practical experience that can be directly translated into creating smarter, more adaptive game characters. The course's focus on Unity's ML-Agents plugin and Tensorflow is especially helpful, allowing you to leverage cutting-edge tools in your AI development workflow. Furthermore, learning how to distill complex mathematical concepts into accessible, practical applications helps you to create game AI even as a beginner.
Gameplay Programmer
A Gameplay Programmer focuses on implementing game mechanics and character behaviors. The course enhances your ability to create more dynamic and adaptive gameplay by integrating machine learning techniques. Understanding how to use genetic algorithms and neural networks can enable you to design enemies that learn from the player's actions, leading to more challenging and engaging experiences. The hands-on workshops, which teach you how to program these algorithms in C#, are particularly useful. The experience you gain from working with Unity's ML-Agents plugin allows you to experiment with reinforcement learning, creating gameplay scenarios that evolve over time. For a gameplay programmer, the course offers essential skills for creating innovative gaming experiences.
Machine Learning Engineer
A Machine Learning Engineer builds and deploys machine learning models. Although this course is focused on Unity, it introduces the fundamental machine learning concepts, such as genetic algorithms and neural networks. Understanding these concepts and how they are applied in a game development context helps one to build a strong foundation in machine learning. The course also covers Tensorflow, which is a widely used tool in the machine learning field. If you are interested in machine learning, the combination of traditional machine learning concepts and their applicability within games could be exactly what you need.
Game Designer
A Game Designer conceptualizes and designs the rules and systems that make up a game. This course offers a valuable perspective on how machine learning can be integrated into game design to create more engaging and dynamic experiences. Understanding how AI can learn and adapt allows you to design games where the challenge evolves with the player's skill. The course's exploration of genetic algorithms and neural networks is particularly relevant, as these techniques can be used to create adaptive game environments and characters. By learning how to work with Unity's ML-Agents plugin, a game designer can prototype and experiment with artificial intelligence features. The course provides a solid foundation for designing innovative games.
Simulation Engineer
A Simulation Engineer creates realistic simulations for various purposes, including training, testing, and research. A course using machine learning with Unity may prove indispensable for developing more sophisticated and adaptive simulations. You can learn how to implement genetic algorithms and neural networks to create agents that learn and evolve within your simulated environment. The hands-on workshops involving Unity's ML-Agents plugin and Tensorflow can be particularly beneficial, allowing you to create simulations that respond dynamically to different scenarios. You can design simulations that accurately reflect real-world complexities by understanding machine learning principles, leading to more effective and insightful results.
Robotics Engineer
A Robotics Engineer designs, builds, and programs robots. While this course focuses on game development, its exploration of machine learning techniques like genetic algorithms and neural networks has relevance to robotics. Understanding how to implement these algorithms empowers an engineer to create robots that can learn and adapt to their environment. The modules covering Unity's ML-Agents plugin and Tensorflow are particularly valuable, providing tools for training robots in simulated environments. For those interested in applying machine learning to robotics, this course introduces essential concepts and practical skills.
Software Developer
A Software Developer designs, develops, and tests software applications. This course may broaden your skill set by introducing machine learning concepts and their implementation within the Unity game engine. You can gain hands-on experience with genetic algorithms and neural networks, expanding your knowledge of different programming paradigms. The exploration of Unity's ML-Agents plugin and Tensorflow may also provide valuable insights into the application of machine learning in real-world scenarios. The course offers a practical and accessible introduction to machine learning for software developers.
Data Scientist
A Data Scientist analyzes large datasets to extract meaningful insights and develop predictive models. While this course focuses on machine learning within the context of game development, understanding fundamental machine learning algorithms such as genetic algorithms and neural networks may be helpful. You can gain practical experience in implementing these algorithms in C# using the Unity engine. The course's coverage of Tensorflow, a popular tool in the data science community, may also be beneficial. The insights provided by the course may complement your existing data science skillset.
Quality Assurance Tester
A Quality Assurance Tester ensures that software products meet specified standards and are free of defects. A course in machine learning with Unity may provide insights into how artificial intelligence can be used to automate testing processes. By understanding the fundamentals of machine learning, such as genetic algorithms and neural networks, you can explore the potential for creating AI-driven testing tools. While the course's primary focus is on game development, the underlying principles may inspire new approaches to software testing and quality assurance.
Technical Artist
A Technical Artist bridges the gap between art and programming, optimizing art assets for use in games. A course in machine learning with Unity may broaden your skillset by introducing you to the possibilities of AI-driven art generation and animation. You can learn how genetic algorithms and neural networks might be used to create procedural art and dynamic animations. Gaining an understanding of Unity's ML-Agents plugin and Tensorflow may allow you to collaborate more effectively with programmers on AI-related projects. The course may provide new perspectives on how technology can enhance the creative process.
Project Manager
A Project Manager oversees the planning, execution, and completion of projects. A course in machine learning with Unity may enhance your understanding of the technological landscape of game development, particularly in the area of artificial intelligence. By learning about genetic algorithms, neural networks, and tools like Unity's ML-Agents plugin and Tensorflow, you can gain insights into the challenges and opportunities associated with integrating AI into game projects. This knowledge can facilitate more informed decision-making and communication within your project teams. While the course is technical in nature, the concepts may be useful for managing projects involving AI technologies.
Level Designer
A Level Designer creates the environments and layouts in which gameplay takes place. A course in machine learning with Unity may offer you insights into how AI can be used to create more dynamic and adaptive game levels. By understanding the fundamentals of genetic algorithms and neural networks, you can explore the potential for designing levels that evolve based on player behavior. While this course is primarily focused on character AI, the underlying principles might inspire new approaches to level design and environmental storytelling.
Animator
An Animator creates the movement and visual effects for characters and objects in games and other media. This course may provide a foundation for exploring AI-driven animation techniques. By understanding the basics of genetic algorithms and neural networks, you can begin to explore how these technologies can be used to create more realistic and dynamic animations. A course like this one may offer a starting point for animators interested in the intersection of AI and animation.
IT Support Specialist
An IT Support Specialist provides technical assistance and troubleshooting for computer systems and software. This course may introduce you to some of the software and technical concepts used in machine learning and game development. By gaining a basic understanding of Unity, Tensorflow, and machine learning algorithms, you could better understand the technical needs of game developers and AI engineers. While its primary focus is not IT support, the course may broaden your overall technical knowledge.
Teacher
A Teacher is responsible for educating students on a variety of subjects. If you are a teacher of computer science or mathematics, you may be interested in teaching students about machine learning. You can leverage genetic algorithms and neural networks and implement them within the Unity game engine. A course such as this can help you explain the concepts in a way that is easier for students to grasp and implement themselves.

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 A Beginner's Guide To Machine Learning with Unity.
Provides a comprehensive overview of AI techniques used in games, including pathfinding, decision-making, and machine learning. It offers practical examples and code snippets that can be adapted for use in Unity. It valuable resource for understanding the broader context of game AI and how machine learning fits into it. This book is commonly used as a textbook at academic institutions.
Provides a comprehensive introduction to deep learning, covering a wide range of topics from basic neural networks to advanced architectures. While it is not specific to Unity, it provides a strong theoretical foundation for understanding the underlying principles of the ML-Agents toolkit. This book is more valuable as additional reading than it is as a current reference. This book is commonly used as a textbook at academic institutions.

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