O'Reilly logo

Learn Unity ML-Agents - Fundamentals of Unity Machine Learning by Micheal Lanham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Carnivore: the hunter

Trying to find the balance in creating a thriving world was one of the challenges you originally faced in the original terrarium. In fact, the most challenging creature to write was no surprise: the carnivore. The carnivore is at the top of the food chain and its purpose is to consume herbivores. Not unlike the real world, this will actually help in our training of both agents. In order to add our carnivore creature, we will first need to add some code to our CreatureAgent script. Follow this exercise to modify the CreatureAgent script for carnivores:

  1. Open the CreatureAgent script in your favorite coding editor.
  2. Modify the AgentAction method and uncomment the Attack and Defend actions as follows:
 public override void ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required