Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
quick:agents [2020/02/18 15:05] – [Setting-Up the execution with Behavior Bricks] jesusmayoral | quick:agents [2020/09/03 09:25] – pedro | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
# ML-Agents Integration Guide | # ML-Agents Integration Guide | ||
Line 21: | Line 22: | ||
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, | 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, | ||
+ | |||
+ | </ | ||
<code csharp> | <code csharp> | ||
Line 62: | Line 65: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | < | ||
The code should be self-explanatory, | The code should be self-explanatory, | ||
Line 70: | Line 75: | ||
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`. | ||
+ | |||
+ | </ | ||
<code csharp> | <code csharp> | ||
Line 150: | Line 157: | ||
</ | </ | ||
+ | < | ||
We have to note the following points: | We have to note the following points: | ||
Line 158: | Line 166: | ||
Finally, we create the C# script `EnemyAgent`, | Finally, we create the C# script `EnemyAgent`, | ||
+ | |||
+ | </ | ||
<code csharp> | <code csharp> | ||
Line 254: | Line 264: | ||
</ | </ | ||
+ | < | ||
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 279: | Line 290: | ||
- The second branch will be `MoveToGameObject` node with a `IsTargetClose` decorator. | - The second branch will be `MoveToGameObject` node with a `IsTargetClose` decorator. | ||
- | - In `IsTargetClose` set 17 as the close distance. For the `target` we will create a blackboard input parameter called `target`. | + | - In `IsTargetClose` set 15 as the close distance. For the `target` we will create a blackboard input parameter called `target`. |
- In `MoveToGameObject ` set `target` as the `target`. | - In `MoveToGameObject ` set `target` as the `target`. | ||
Line 318: | Line 329: | ||
- We have 2 continuous actions, one to rotate and one to shoot, that is the space size. | - We have 2 continuous actions, one to rotate and one to shoot, that is the space size. | ||
- | You need to train our Enemy for having a proper behavior, but, for now, we give you a trained model that you can set in the `Behavior parameters` | + | You need to train our Enemy for having a proper behavior, but, for now, we give you a trained model that you can set in the `Behavior parameters` |
Line 326: | Line 337: | ||
## Training | ## Training | ||
- | The node used to execute `ML-Agents` in `Behavior Bricks` lets also to train a behavior inside a behavior tree. To do so, the only thing that has to be done is to check the control checkbox | + | 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 |
- | Then we have to follow the same procedure as indicated in [ML-Agents guides.](https: | + | </markdown> |