Unity’s ML-Agents and Effective ways of training (1/3)
By Sajjad Saleem Game Developer at WRP Studios
Here’s a video of Snake UI training using ML-Agents.
I’ve distributed the blog into three parts. (You may skip accordingly)
Part 1 Introduction to ML-Agents
Part 2 Resolutions to Time Problem
Part 3 ML-Agent’s Environment Executable to the Rescue
Introduction to ML-Agents
Let us first understand the ML-Agents tool before diving into details. ML-Agents is an open-source machine learning tool for Unity that enables training for intelligent agents using simulations and games as an environment. Developers can create complex behaviors for playable and nonplayable characters using Deep Reinforcement Learning (DRL). Developers of the ML-Agents tool have really in-depth documentation on GitHub to help beginners in setting up the unity environment for training.
So now that we’re aware of the ML-Agents tool’s existence, the next question that comes to mind is when is it useful and in which cases it should be avoided?
Why ML Tool is good?
It is a handy tool to make your game more engaging by making NPC’s more exciting or by teaching the playable characters to learn the behaviors that otherwise will require a lot of effort to code. In simple words, if you are making a game that requires a neat AI to improve the overall gaming experience. Instead of coding your own algorithms, you can use the ML-Agents tool instead. As a result, you will only have to provide the environment for training and necessary data needed for agents to collect samples from and learn.
Cases where ML Agent could be beneficial:
It’s a useful tool to teach playable and nonplayable characters to learn complex behaviors and it works on the principle of deep learning algorithms meaning collection of data is required to achieve the desired behavior. For example, teaching a playable character to move to a certain point in the world while avoiding all the hurdles and picking up collectibles on the way.
When it should be avoided:
Using ML-Agents to deal with small data is not favorable. For example, teaching playable or non-playable characters to jump or shoot and vice versa. In these simple cases, it is the best practice to use simple algorithms and avoid agent training. As you’ll be wasting your time in training while you can write a code that can produce the desired outputs.
Machine Learning and Patience
Now it’s time to unwind the most frustrating issue developers face while training an agent. Which ofcourse is the time it takes to train an agent to learn complex behaviors. One thing that should be understood before I dive into any further details is that the key to handling machine learning is patience and happy thoughts.
The training process could be compared to the training of a toddler. You’ll have to be very patient during the whole process as the agents tend to make the same silly mistakes over and over again. We’ll be unraveling the solutions to the time problem in Part 2.
About Us
WRP Studios is a game development and animation studio making our own games and providing game development services around the world. Our latest ego boost is when Explottens got published by Apple Arcade. It was one of the launch titles to go LIVE in 2019.
Website: https://werplay.com/
Discord: https://discord.gg/jaWhzuy
Jobs: careers@werplay.com
Try our latest game “Explottens”: https://apps.apple.com/us/app/explottens/id965816162
Sign up as Beta Player for current puzzle games and get a chance to play the Alpha Beta version
https://mailchi.mp/ff413de04360/lost-twins-2
