Configuring the required brains

The last piece of the puzzle is to configure the brains that we quickly built earlier. ML-Agents requires that the brains be configured with the required input and observation space, in order to work correctly. We will set up the TestingPlayerBrain and TestingLearningBrain in the next exercise:

  1. Open the Unity editor and select TestingLearningBrain from the HoDLG | Brains folder to open it in the Inspector.
  1. Set the Brain parameters, as shown in the following screenshot:

Setting the parameters for the TestingPlayerBrain
  1. There are several parameters to set; they are summarized as follows:
    • Visual Observations: 84 x 84 and no grayscale
    • Vector Action:
      • Space Type: Continuous
      • Space Size: 2
      • Action Descriptions:
        • Size: 2
        • Element 0: Vertical
        • Element 1: Horizontal
    • Axis Continuous Player Actions:
      • Size: 2
      • Vertical:
        • Axis: Vertical
        • Index: 0
        • Scale: 1
      • Horizontal:
        • Axis: Horizontal
        • Index: 1
        • Scale: 1
  1. Select TestingLearningBrain and configure it the same, but for learning, as shown in the following screenshot:

Configuring the TestingLearningBrain
  1. The configuration for the learning brain is much simpler, but it is also still required, even when running the sample in player mode (which, if you recall, it is set up to do).
  2. Save the scene and project. Finally, we have completed our required configuration.
  3. Press Play to run the scene and play the game in player mode. We are controlling the game through the ML-Agents system. After a few seconds, you should see some goals drop nearby.  
  1. Control the vehicle and drive into a goal, as shown in the following screenshot:

Driving into the goals
  1. When you are done playing, stop the game.

Now that we are able to play the game through ML-Agents by using a configured player brain, we will switch to a learning brain and let an agent take control in the next section.

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

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