Chapter 2. Creating Your First Simulation

We’re going to get started by looking at a simple simulation environment: a ball agent that can roll around a platform. As we said earlier, we know it’s a lot to handle, but we think you’ll be able to cope with the levels of excitement and come through with a better understanding of machine learning and simulation with Unity.

Everybody Remembers Their First Simulation

In this chapter we’re going to build a brand-new simulation environment using Unity, create an agent, and then train that agent to accomplish a task in the environment using reinforcement learning. It’s going to be a very simple simulation environment, but it will serve to demonstrate a number of important things:

  • How straightforward it is to assemble a scene in Unity by using a small collection of simple objects

  • How to use the Unity Package Manager to import the Unity side of the Unity ML-Agents Toolkit into Unity and set up a Unity project for machine learning

  • How to set up a simple agent in your simulation object with the intention of enabling it to accomplish a task

  • How to take manual control of your agent to test the simulation environment

  • How to start a training run using the command-line tool (CLI) side of the Unity ML-Agents Toolkit, and how to bring up TensorBoard to monitor the training’s progress

  • How to bring a trained model file back into a Unity simulation environment and run the agent using the trained model

By the end of this chapter, you’ll ...

Get Practical Simulations for Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.