Adding some fun obstacles

Without having to do anything else in our code, we can make a few changes to our scene layout and enable a few components provided by Unity to dramatically alter the behavior of our agents. In our CrowdsObstacles scene, we've added a few walls to the environment, creating a maze-like layout for our red and blue teams of capsules to traverse, as you can see in the following screenshot:

Let the games begin!

The fun part about this example is that, because of the randomized speed of each agent, the results will be totally different each time you run the game. As the agents move through the environment, they'll be blocked ...

Get Unity 2017 Game AI Programming - Third Edition 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.