Testing through imitation

At this point in your learning, you have learned several strategies that we can apply to help our testing agent learn and find the goals. We can use curiosity or curriculum learning fairly easily, and we will leave that as an exercise for the reader. What we want is a way to control some of the testing process, and we don't really want our agent to randomly test everything (at least not at this stage). Sure, there are places where completely random testing works well. (By the way, this random form of testing is called monkey testing, because it resembles a monkey just mashing keys or input.) However, in a space such as our game, exploring every possible combination could take a very long time. Therefore, the best alternative is to capture player recordings and use them for our testing agent as a source for imitation learning.

With everything set up and with our ability to now route the input events through ML-Agents, we can capture player input in the form that an agent needs to learn from. Let's open a backup Unity and set up the scene to capture player recordings, as follows:

  1. Select the Vehicle2 object in the Hierarchy window. Recall that this is where the TestingAgent script is attached.
  2. Use the Add Component button at the bottom of the Inspector window to add a Demonstration Recorder component to the agent.
  1. Set the Demonstration Recorder to Record and the Demonstration Name to Testing, and change the brain to TestingPlayerBrain, as shown in the following screenshot:

Adding a Demonstration Recorder to the agent
  1. Select the TestingAcademy object, and make sure to disable the Control option on the Brain. We want the player to control the agent when recording.
  2. Press Play and run the game. Use the WASD controls keys on your keyboard to drive the vehicle over the goals. Play for a little while, in order to generate a decent recording. 
  3. When you are done, check the Assets folder for a new folder called Demonstrations that contains your Testing.demo recording file.

Now, with the player recording in play, we can set up and run the agent, using imitation learning to test the level.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset