Create an intelligent game experience
Creating responsive and intelligent virtual players and non-playable game characters is hard. Especially when the game is complex. To create intelligent behaviors, developers have had to resort to writing tons of code or using highly specialized tools.
With Unity Machine Learning Agents (ML-Agents), you are no longer “coding” emergent behaviors, but rather teaching intelligent agents to “learn” through a combination of deep reinforcement learning and imitation learning. Using ML-Agents allows developers to create more compelling gameplay and an enhanced game experience.
Create realistic and complex AI environments to train models
Advancement of artificial intelligence (AI) research depends on figuring out tough problems in existing environments using current benchmarks for training AI models. However, as these challenges are “solved,” the need for novel environments arises. But creating such environments is often time-intensive and requires specialized domain knowledge.
Using Unity and the ML-Agents toolkit, you can create AI environments that are physically, visually, and cognitively rich. You can use them for benchmarking as well as researching new algorithms and methods.
How Unity ML-Agents works
Integrate the ML-Agents Unity package.
Connect your integrated Unity project and start training the agents to learn the right behaviour.
When training is complete, embed the trained agent model back into your Unity project.
Millions of natural-feeling, procedurally generated monsters
In Source of Madness, an action rogue-lite game created by Carry Castle, you traverse an ever-changing dynamic world, battling new procedurally generated monsters each playthrough, brought to life by a powerful machine-learning AI.
Creating the enemy monsters involved several challenges for the small team:
- The physics controlling the monsters is unusual
- There are millions of variations of monsters
- The monsters needed to look natural
Using the ML-Agents toolkit – and, specifically, deep reinforcement learning – the team trained and created a neural network model that produced the right behavior. Then, using the Unity Inference Engine, they embedded the model into the game.
Faster training times with JamCity Snoopy Pop
We partnered with JamCity to train an agent for their bubble shooter Snoopy Pop. One of the challenges with training an agent to play Snoopy Pop is the large volume of gameplay data to learn effective behaviors and strategies. Additionally, most games in development are constantly evolving, so training times need to be reasonably fast. We introduced various features in ML-Agents like Asynchronous Environments, Generative Adversarial Imitation Learning (GAIL), and Soft Actor-Critic to solve these problems.
DOTS and ML-Agents
A version of ML-Agents built for DOTS has been prototyped, and this prototype has been integrated into sample scenes and Unity demos such as MegaCity and TinyRacing. The agents were trained in complex and large environments in just a couple of hours on a standard laptop.
If your game or Unity project is being built using DOTS and you are interested in ML-Agents, please email us. We are looking for interested preview users to work with us on improving ML-Agents for DOTS.
Need to scale up your training?
An ML-Agents cloud offering will be available later this year that will enable ML-Agents users to train on a scalable cloud infrastructure. With this cloud offering you will be able to submit many concurrent training sessions or easily scale out a training session across many machines for faster results.
If you are currently using ML-Agents and need help with scaling and managing experiments, sign up for a preview access.
Check out these ML-Agents videos
Kart Racing Game with Machine Learning in Unity! (Tutorial)
Learn how to implement Unity’s machine learning toolkit ML Agents into Unity’s Kart Racing Game project. Reinforcement learning is used to train the AI agent to travel around the track autonomously by “seeing” with raycasts and steering to avoid obstacles.
AI learns to park a car
An AI learns to park a car in a parking lot in a 3D physics simulation implemented using Unity ML-Agents. The AI consists of a deep neural network with three hidden layers of 128 neurons each. It is trained with the proximal policy optimization (PPO) algorithm, a reinforcement learning approach.
This project uses ML-Agents to stabilize a satellite rotating through one axis. AI controls two satellite engines, which can be on or off. The session starts with a rotating satellite. It took two hours of ML-Agents learning for the satellite to achieve the goal stabilizing, stopping its rotation and calibrating its position.
From the blog
Learn how to implement ML-Agents
We’ve partnered with Immersive Limit to create an online course that teaches you how to implement ML-Agents through exercises, code walkthroughs, and helpful discussions.
Tap the community
Ask questions, find answers, and connect with other Unity ML-Agents experts and experimenters, including Unity staff.
File support issues on our github page