Multi-agent environments
It likely started out as a fun experiment, but as it turns out, letting agents compete against themselves can really amp up training, and, well, it's just cool. There are a few configurations we can set up when working with multiple agents. The BananaCollector
example we will look at uses a single brain shared among multiple competing agents. Open up Unity and follow this exercise to set up the scene:
- Load the
BananaCollectorBananaRL
scene file located in theAssets/ML-Agents/Examples/BananaCollectors/
folder. - Leave the
Brain
onPlayer
; if you changed it, change it back. - Run the scene in Unity. Use the WASD keys to move the agent cubes around the scene and collect bananas. Notice how there are multiple cubes responding identically. That is because each agent is using the same brain.
- Expand the RLArea object in the Hierarchy window, as shown in the following screenshot:

Inspecting the RLArea and agents
- Notice the five Agent objects under the RLArea. These are the agents...