Herbivores to the rescue

The herbivore will be our most basic agent that will learn to live in the terrarium. A herbivore creature will thrive by consuming plants, which will give them energy to grow and reproduce. We can follow several of the same basic patterns we used building the Plant script when creating our Herbivore agent script. Open up Unity and follow this exercise to code the Herbivore agent script:

  1. Create a new script called CreatureAgent in the Assets/Terrarium/Scripts folder and open it in your editor of choice. Fortunately, we won't need to create a different script for each different type of agent if we generalize things into a single CreatureAgent script.
  2. We will cover each section of this script as we build it. Enter the ...

Get Learn Unity ML-Agents - Fundamentals of Unity 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.