Book Image

Learn Unity ML-Agents ??? Fundamentals of Unity Machine Learning

Book Image

Learn Unity ML-Agents ??? Fundamentals of Unity Machine Learning

Overview of this book

Unity Machine Learning agents allow researchers and developers to create games and simulations using the Unity Editor, which serves as an environment where intelligent agents can be trained with machine learning methods through a simple-to-use Python API. This book takes you from the basics of Reinforcement and Q Learning to building Deep Recurrent Q-Network agents that cooperate or compete in a multi-agent ecosystem. You will start with the basics of Reinforcement Learning and how to apply it to problems. Then you will learn how to build self-learning advanced neural networks with Python and Keras/TensorFlow. From there you move o n to more advanced training scenarios where you will learn further innovative ways to train your network with A3C, imitation, and curriculum learning models. By the end of the book, you will have learned how to build more complex environments by building a cooperative and competitive multi-agent ecosystem.
Table of Contents (8 chapters)

Building the Agent ecosystem

Now that we have a core set of rules, we can start to build our multi-agent ecosystem from scratch in Unity. Previously, we spent a considerable amount of time looking at the Unity canned samples, but that was essential in order to cover all the material to get to this point in such a short time. With all the core understanding out of the way, we can now build a more complex example by following this exercise:

  1. From the Project window, create a new folder called Terrarium under Assets.
  2. Create five new folders called Materials, Prefabs, Scenes, Scripts, and TFModels.
  3. Create a new scene called Terrarium in the Scenes folder.
  4. Open the new Terrarium scene and from the menu, select GameObject -> Create Empty. Rename the object to Academy.
  5. Open the Scripts folder in the Project window. Create a new C# script called TerrariumAcademy. Edit the script so...