Extrinsic rewards for individuality

We have looked extensively at external or extrinsic rewards for several chapters now and how techniques can be used to optimize and encourage them for agents. Now, it may seem like the easy way to go in order to modify an agent's behavior is by altering its extrinsic rewards or in essence its reward functions. However, this can be prone to difficulties, and this can often alter training performance for the worse, which is what we witnessed when we added Curriculum Learning (CL) to a couple of agents in the previous section. Of course, even if we make the training worse, we now have a number of techniques up our sleeves such as Transfer Learning (TL), also known as Imitation Learning (IL); Curiosity; and CL, to help us correct things.

In the next exercise, we are going to look to add further individuality to our agents by adding additional extrinsic rewards. Open up the previous exercise example we were just working on and follow along:

  1. From the menu, select Window | Asset Store.  This will take you to the Unity Asset Store, which is an excellent resource for helper assets. While most of these assets are paid, honestly, the price compared to comparable developer tools is minimal, and there are several free and very excellent assets that you can start using to enhance your training environments. The Asset Store is one of the best and worst things about Unity, so if you do purchase assets, be sure to read the reviews and forum posts. Any good asset will typically have its own forum if it is developer-focused, artistic assets much less so.
  2. In the search bar, enter toony tiny people and press the Enter key or click the Search button. This will display the search results.
We would like to thank Polygon Blacksmith for their support in allowing us to distribute their Toony Tiny People Demo asset with the book's source. Also, their collection of character assets is very well done and simple to use. The price is also at an excellent starting point for some of the larger asset packages if you decide you want to build a full game or enhanced demo.
  1. Select the result called Toony Tiny People Demo by Polygon Blacksmith and select it. It will appear as shown in this screenshot:

The Toony Tiny People Demo asset from Polygon Blacksmith
  1. Click the red Download button and, after the asset has downloaded, the button will change to Import, as shown in the preceding screenshot. Click the Import button to import the assets.  When you are prompted by the Import dialog, make sure everything is selected and click Import.
These types of low polygon or toon assets are perfect for making a simple game or simulation more entertaining and fun to watch. It may not seem like much, but you can spend a lot of time watching these training sims run, and it helps if they look appealing.

  1. Select and expand all the agent objects in Hierarchy. This includes RedStriker, BlueStriker, RedGoalie, and BlueGoalie.
  2. Open the Assets | TooyTinyPeople | TT_demo | prefabs folder in the Project window.
  3. Select and drag the TT_demo_Female prefab from the preceding folder and drop it into the RedStriker agent object in the Hierarchy window. Select the cube object just beneath the agent and disable it in the inspector. Continue to do this for the other agents according to the following list:
    • TT_demo_female -> RedStriker
    • TT_demo_male_A -> BlueStriker
    • TT_demo_police -> BlueGoalie
    • TT_demo_zombie -> RedGoalie

This is further demonstrated in this screenshot:

Setting the new agent bodies
  1. Make sure to also reset the new agent model's Transform Position and Orientation to [0,0,0], as shown in the following screenshot:

Resetting the orientation and position of dragged prefabs
  1. Save the scene and project. 

At this point, you can run the scene in training and watch the new agent models move around, but there isn't much point. The agents will still act the same, so what we need to do next is set additional extrinsic rewards based on some arbitrary personality, which we will define 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