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 [2019/03/01 11:22] – victorzamora | quick:agents [2020/02/18 10:29] – [Setting-up the environment] jesusmayoral | ||
---|---|---|---|
Line 5: | Line 5: | ||
This tutorial continues the small example created in the BT tutorials, where the player moves his avatar in the “environment” (a mere plane) using mouse clicks, and the enemy wanders around and pursues the player when he is near enough. We encourage you to follow that tutorial in the first place but, if you are impatient, its final version (and the starting point for this guide) is available in the Behavior Bricks package, under `Samples\ProgrammersQuickStartGuide\Done` folder. Obviously, you are supposed to have been loaded Behavior Bricks into a new Unity project. Refer to the download instructions in other case. | This tutorial continues the small example created in the BT tutorials, where the player moves his avatar in the “environment” (a mere plane) using mouse clicks, and the enemy wanders around and pursues the player when he is near enough. We encourage you to follow that tutorial in the first place but, if you are impatient, its final version (and the starting point for this guide) is available in the Behavior Bricks package, under `Samples\ProgrammersQuickStartGuide\Done` folder. Obviously, you are supposed to have been loaded Behavior Bricks into a new Unity project. Refer to the download instructions in other case. | ||
- | The final scene and all the contents of this ML-Agents integration guide is also available in the Behavior Bricks package, under `Samples\MLAgentsIntegrationGuide\Done` folder. | ||
## Setting-up the environment | ## Setting-up the environment | ||
To start creating a new tree with a behavior trained in ML-Agents in a project that is using Behavior Bricks, it is necessary to make the regular installantion of ML-Agents. More information can be retrieved in [the ML-Agents documentation.](https:// | To start creating a new tree with a behavior trained in ML-Agents in a project that is using Behavior Bricks, it is necessary to make the regular installantion of ML-Agents. More information can be retrieved in [the ML-Agents documentation.](https:// | ||
- | First thing we are going to do is to prepare | + | First thing we are going to do is to prepare |
- | + | ||
- | <code csharp> | + | |
- | using MLAgents; | + | |
- | + | ||
- | public class BBAcademy : Academy {} | + | |
- | </ | + | |
- | + | ||
- | Now we create a `learning brain` (e.g. by right clicking in a folder of the project tab and `create/ | + | |
- | + | ||
- | {{: | + | |
Before creating the C# script for our agent, we have to modify the player and the enemy: | Before creating the C# script for our agent, we have to modify the player and the enemy: | ||
Line 227: | Line 216: | ||
} | } | ||
- | public override void AgentAction(float[] vectorAction, string textAction) | + | public override void AgentAction(float[] vectorAction) |
{ | { | ||
// Actions, size = 2 | // Actions, size = 2 |