Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| quick:agents [2020/02/20 10:26] – [Setting-Up the execution with Behavior Bricks] jesusmayoral | quick:agents [2023/11/16 13:29] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | < | ||
| # ML-Agents Integration Guide | # ML-Agents Integration Guide | ||
| Line 16: | Line 17: | ||
| - Add a cube to the enemy above the `shootpoint` scaled to (0.1, 0.1, 0.3) at the relative position (0, 0.5, 0.5). This will tell us where the enemy is aiming. | - Add a cube to the enemy above the `shootpoint` scaled to (0.1, 0.1, 0.3) at the relative position (0, 0.5, 0.5). This will tell us where the enemy is aiming. | ||
| - | {{: | + | . Additionally, | The script `FiredBullet` consists in giving intelligence to the bullet, so it can tell if the it has impacted the player, besides autodestroy passed 2 seconds (or whatever the time indicated by the parameter). Additionally, | ||
| - | < | + | |
| + | ```csharp | ||
| using UnityEngine; | using UnityEngine; | ||
| Line 61: | Line 63: | ||
| } | } | ||
| } | } | ||
| - | </ | + | ``` | 
| The code should be self-explanatory, | The code should be self-explanatory, | ||
| Line 71: | Line 73: | ||
| The script `EnemyShoot` implements the shooting capacity of the enemy agent. We create a C# script that extends `Monobehaviour` based on the previous script `ShootOnce`. | The script `EnemyShoot` implements the shooting capacity of the enemy agent. We create a C# script that extends `Monobehaviour` based on the previous script `ShootOnce`. | ||
| - | < | + | ```csharp | 
| using UnityEngine; | using UnityEngine; | ||
| Line 148: | Line 150: | ||
| } | } | ||
| } | } | ||
| - | </ | + | ``` | 
| We have to note the following points: | We have to note the following points: | ||
| Line 159: | Line 161: | ||
| Finally, we create the C# script `EnemyAgent`, | Finally, we create the C# script `EnemyAgent`, | ||
| - | < | + | ```csharp | 
| using UnityEngine; | using UnityEngine; | ||
| Line 252: | Line 254: | ||
| } | } | ||
| } | } | ||
| - | </ | + | ``` | 
| This class has three main methods that are overriden from the `Agent` class. Explaining why this methods have to be overridden and how Agent class works is out of the scope of this guide. The concrete implementation of these methods is described below. | This class has three main methods that are overriden from the `Agent` class. Explaining why this methods have to be overridden and how Agent class works is out of the scope of this guide. The concrete implementation of these methods is described below. | ||
| Line 274: | Line 276: | ||
| - | {{: | + | ![](: | 
| Line 283: | Line 285: | ||
| - | {{: | + | ![](: | 
| Line 291: | Line 293: | ||
| - | {{: | + | ![](: | 
| Line 302: | Line 304: | ||
| - | {{: | + | ![](: | 
| Line 308: | Line 310: | ||
| - | {{: | + | ![](: | 
| Line 321: | Line 323: | ||
| - | {{: | + | ![](: | 
| Line 327: | Line 329: | ||
| The node used to execute `ML-Agents` in `Behavior Bricks` lets also to train a behavior inside a behavior tree. To do so, We have to follow the same procedure as indicated in [ML-Agents guides.](https:// | The node used to execute `ML-Agents` in `Behavior Bricks` lets also to train a behavior inside a behavior tree. To do so, We have to follow the same procedure as indicated in [ML-Agents guides.](https:// | ||
| + | |||
| + | </ | ||