浏览代码

1 to 1 Brain to Agent (#2729)

* 1 to 1 Brain to Agent
This is a work in progess
In this PR :
 - Deleted all Brain Objects
 - Moved the BrainParameters into the Agent
 - Gave the Agent a Heuristic method (see Balance Ball for example)
 - Modified the Communicator and ModelRunner : Put can only take one agent at a time
 - Made the IBrain Interface with RequestDecision and DecideAction method

No changes made to Python
[Design Doc](https://docs.google.com/document/d/1hBhBxZ9lepGF4H6fc6Hu6AW7UwOmnyX3trmgI3HpOmo/edit#)

* Removing editorconfig

* Updating BallanceBall scene

* grammar mistake

* Clearing the Agents of the Model runner

* Added Documentation on IBrain

* Modified comments on GiveModel

* Introduced a factory

* Split Learning Brain in two

* Changes to walljump

* Fixing the Unit tests

* Renaming the Brain to Policy

* Heuristic now has priority over training

* Edited code comments

* Fixing bugs

* Develop one to one scene edits...
/develop-gpu-test
GitHub 5 年前
当前提交
99146e97
共有 181 个文件被更改,包括 3235 次插入2372 次删除
  1. 10
      UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs
  2. 101
      UnitySDK/Assets/ML-Agents/Editor/BrainParametersDrawer.cs
  3. 26
      UnitySDK/Assets/ML-Agents/Editor/Tests/EditModeTestInternalBrainTensorGenerator.cs
  4. 91
      UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs
  5. 29
      UnitySDK/Assets/ML-Agents/Examples/3DBall/Prefabs/3DBall.prefab
  6. 24
      UnitySDK/Assets/ML-Agents/Examples/3DBall/Prefabs/3DBallHardNew.prefab
  7. 47
      UnitySDK/Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity
  8. 34
      UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs
  9. 25
      UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs
  10. 24
      UnitySDK/Assets/ML-Agents/Examples/Basic/Prefabs/Basic.prefab
  11. 13
      UnitySDK/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs
  12. 24
      UnitySDK/Assets/ML-Agents/Examples/Bouncer/Prefabs/Environment.prefab
  13. 10
      UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs
  14. 25
      UnitySDK/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab
  15. 24
      UnitySDK/Assets/ML-Agents/Examples/Crawler/Prefabs/FixedPlatform.prefab
  16. 128
      UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/FoodCollectorArea.prefab
  17. 868
      UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab
  18. 129
      UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scenes/VisualFoodCollector.unity
  19. 102
      UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs
  20. 61
      UnitySDK/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab
  21. 32
      UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
  22. 21
      UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs
  23. 24
      UnitySDK/Assets/ML-Agents/Examples/Hallway/Prefabs/SymbolFinderArea.prefab
  24. 57
      UnitySDK/Assets/ML-Agents/Examples/Hallway/Prefabs/VisualSymbolFinderArea.prefab
  25. 16
      UnitySDK/Assets/ML-Agents/Examples/Hallway/Scenes/VisualHallway.unity
  26. 57
      UnitySDK/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs
  27. 24
      UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockArea.prefab
  28. 41
      UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockVisualArea.prefab
  29. 16
      UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scenes/VisualPushBlock.unity
  30. 21
      UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs
  31. 24
      UnitySDK/Assets/ML-Agents/Examples/Pyramids/Prefabs/AreaPB.prefab
  32. 69
      UnitySDK/Assets/ML-Agents/Examples/Pyramids/Prefabs/VisualAreaPyramids.prefab
  33. 10
      UnitySDK/Assets/ML-Agents/Examples/Pyramids/Scenes/VisualPyramids.unity
  34. 65
      UnitySDK/Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs
  35. 24
      UnitySDK/Assets/ML-Agents/Examples/Reacher/Prefabs/Agent.prefab
  36. 96
      UnitySDK/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab
  37. 48
      UnitySDK/Assets/ML-Agents/Examples/Tennis/Prefabs/TennisArea.prefab
  38. 9
      UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs
  39. 24
      UnitySDK/Assets/ML-Agents/Examples/Walker/Prefabs/WalkerPair.prefab
  40. 30
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Prefabs/WallJumpArea.prefab
  41. 8
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity
  42. 37
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs
  43. 88
      UnitySDK/Assets/ML-Agents/Scripts/Academy.cs
  44. 130
      UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
  45. 4
      UnitySDK/Assets/ML-Agents/Scripts/DemonstrationRecorder.cs
  46. 107
      UnitySDK/Assets/ML-Agents/Scripts/Grpc/RpcCommunicator.cs
  47. 3
      UnitySDK/Assets/ML-Agents/Scripts/ICommunicator.cs
  48. 7
      UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs
  49. 1
      UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/GeneratorImpl.cs
  50. 24
      UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/ModelRunner.cs
  51. 8
      config/gail_config.yaml
  52. 2
      config/offline_bc_config.yaml
  53. 42
      config/sac_trainer_config.yaml
  54. 42
      config/trainer_config.yaml
  55. 2
      docs/Background-TensorFlow.md
  56. 53
      docs/Basic-Guide.md
  57. 4
      docs/Creating-Custom-Protobuf-Messages.md
  58. 2
      docs/FAQ.md
  59. 4
      docs/Feature-Memory.md
  60. 116
      docs/Getting-Started-with-Balance-Ball.md
  61. 10
      docs/Glossary.md
  62. 7
      docs/Learning-Environment-Best-Practices.md
  63. 110
      docs/Learning-Environment-Create-New.md
  64. 2
      docs/Learning-Environment-Design-Academy.md
  65. 135
      docs/Learning-Environment-Design-Agents.md
  66. 54
      docs/Learning-Environment-Design.md
  67. 72
      docs/Learning-Environment-Examples.md
  68. 17
      docs/Learning-Environment-Executable.md
  69. 97
      docs/ML-Agents-Overview.md
  70. 1
      docs/Migrating.md
  71. 4
      docs/Readme.md
  72. 2
      docs/Reward-Signals.md
  73. 3
      docs/Training-Behavioral-Cloning.md
  74. 14
      docs/Training-Curriculum-Learning.md
  75. 5
      docs/Training-ML-Agents.md
  76. 2
      docs/Training-PPO.md
  77. 2
      docs/Training-SAC.md
  78. 3
      docs/Training-on-Amazon-Web-Service.md
  79. 4
      docs/Unity-Inference-Engine.md
  80. 358
      docs/images/3dball_learning_brain.png
  81. 327
      docs/images/agent.png
  82. 350
      docs/images/visual-observation-rendertexture.png
  83. 369
      docs/images/visual-observation.png
  84. 5
      gym-unity/README.md
  85. 2
      UnitySDK/Assets/ML-Agents/Scripts/Policy/BarracudaPolicy.cs.meta
  86. 78
      UnitySDK/Assets/ML-Agents/Editor/BehaviorParametersEditor.cs
  87. 11
      UnitySDK/Assets/ML-Agents/Editor/BehaviorParametersEditor.cs.meta
  88. 8
      UnitySDK/Assets/ML-Agents/Scripts/Policy.meta
  89. 93
      UnitySDK/Assets/ML-Agents/Scripts/Policy/BarracudaPolicy.cs
  90. 64
      UnitySDK/Assets/ML-Agents/Scripts/Policy/BehaviorParameters.cs
  91. 11
      UnitySDK/Assets/ML-Agents/Scripts/Policy/BehaviorParameters.cs.meta
  92. 45
      UnitySDK/Assets/ML-Agents/Scripts/Policy/HeuristicPolicy.cs
  93. 11
      UnitySDK/Assets/ML-Agents/Scripts/Policy/HeuristicPolicy.cs.meta
  94. 30
      UnitySDK/Assets/ML-Agents/Scripts/Policy/IPolicy.cs
  95. 11
      UnitySDK/Assets/ML-Agents/Scripts/Policy/IPolicy.cs.meta
  96. 86
      UnitySDK/Assets/ML-Agents/Scripts/Policy/RemotePolicy.cs
  97. 11
      UnitySDK/Assets/ML-Agents/Scripts/Policy/RemotePolicy.cs.meta
  98. 3
      UnitySDK/Assets/ML-Agents/Editor/BrainEditor.cs.meta
  99. 3
      UnitySDK/Assets/ML-Agents/Editor/HeuristicBrainEditor.cs.meta

10
UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs


using UnityEngine;
using UnityEditor;
using Barracuda;
/*
This code is meant to modify the behavior of the inspector on Brain Components.
Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly.
*/
/*
This code is meant to modify the behavior of the inspector on Agent Components.
*/
[CustomEditor(typeof(Agent), true)]
[CanEditMultipleObjects]
public class AgentEditor : Editor

var serializedAgent = serializedObject;
serializedAgent.Update();
var brain = serializedAgent.FindProperty("brain");
var actionsPerDecision = serializedAgent.FindProperty(
"agentParameters.numberOfActionsBetweenDecisions");
var maxSteps = serializedAgent.FindProperty(

var isOdd = serializedAgent.FindProperty(
"agentParameters.onDemandDecision");
EditorGUILayout.PropertyField(brain);
EditorGUILayout.PropertyField(

101
UnitySDK/Assets/ML-Agents/Editor/BrainParametersDrawer.cs


/// <inheritdoc />
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
if (property.isExpanded)
{
return k_LineHeight +
GetHeightDrawVectorObservation() +
GetHeightDrawVectorAction(property) +
GetHeightDrawVectorActionDescriptions(property);
}
return k_LineHeight;
return GetHeightDrawVectorObservation() +
GetHeightDrawVectorAction(property);
property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label);
position.y += k_LineHeight;
if (property.isExpanded)
{
EditorGUI.BeginProperty(position, label, property);
EditorGUI.indentLevel++;
EditorGUI.BeginProperty(position, label, property);
EditorGUI.indentLevel++;
// Vector Observations
DrawVectorObservation(position, property);
position.y += GetHeightDrawVectorObservation();
// Vector Observations
DrawVectorObservation(position, property);
position.y += GetHeightDrawVectorObservation();
// Vector Action
DrawVectorAction(position, property);
position.y += GetHeightDrawVectorAction(property);
// Vector Action
DrawVectorAction(position, property);
position.y += GetHeightDrawVectorAction(property);
// Vector Action Descriptions
DrawVectorActionDescriptions(position, property);
position.y += GetHeightDrawVectorActionDescriptions(property);
EditorGUI.EndProperty();
}
EditorGUI.EndProperty();
EditorGUI.indentLevel = indent;
}

actionSize += 1;
}
return actionSize * k_LineHeight;
}
/// <summary>
/// Draws the Vector Actions descriptions for the Brain Parameters
/// </summary>
/// <param name="position">Rectangle on the screen to use for the property GUI.</param>
/// <param name="property">The SerializedProperty of the BrainParameters
/// to make the custom GUI for.</param>
private static void DrawVectorActionDescriptions(Rect position, SerializedProperty property)
{
var bpVectorActionType = property.FindPropertyRelative(k_ActionTypePropName);
var vecActionSize = property.FindPropertyRelative(k_ActionSizePropName);
var numberOfDescriptions = 0;
if (bpVectorActionType.enumValueIndex == 1)
{
numberOfDescriptions = vecActionSize.GetArrayElementAtIndex(0).intValue;
}
else
{
numberOfDescriptions = vecActionSize.arraySize;
}
EditorGUI.indentLevel++;
var vecActionDescriptions =
property.FindPropertyRelative(k_ActionDescriptionPropName);
vecActionDescriptions.arraySize = numberOfDescriptions;
if (bpVectorActionType.enumValueIndex == 1)
{
//Continuous case :
EditorGUI.PropertyField(
position,
vecActionDescriptions,
new GUIContent("Action Descriptions",
"A list of strings used to name the available actionsm for the Brain."),
true);
position.y += k_LineHeight;
}
else
{
// Discrete case :
EditorGUI.PropertyField(
position,
vecActionDescriptions,
new GUIContent("Branch Descriptions",
"A list of strings used to name the available branches for the Brain."),
true);
position.y += k_LineHeight;
}
}
/// <summary>
/// The Height required to draw the Action Descriptions
/// </summary>
/// <returns>The height of the drawer of the Action Descriptions </returns>
private static float GetHeightDrawVectorActionDescriptions(SerializedProperty property)
{
var descriptionSize = 1;
if (property.FindPropertyRelative(k_ActionDescriptionPropName).isExpanded)
{
var descriptions = property.FindPropertyRelative(k_ActionDescriptionPropName);
descriptionSize += descriptions.arraySize + 1;
}
return descriptionSize * k_LineHeight;
}
}
}

26
UnitySDK/Assets/ML-Agents/Editor/Tests/EditModeTestInternalBrainTensorGenerator.cs


{
public class EditModeTestInternalBrainTensorGenerator
{
private class TestAgent : Agent
{
}
private static IEnumerable<Agent> GetFakeAgentInfos()
{
var goA = new GameObject("goA");

stackedVectorObservation = new[] {1f, 2f, 3f}.ToList(),
stackedVectorObservation = new[] { 1f, 2f, 3f }.ToList(),
storedVectorActions = new[] {1f, 2f},
storedVectorActions = new[] { 1f, 2f },
actionMasks = null
};
var goB = new GameObject("goB");

stackedVectorObservation = new[] {4f, 5f, 6f}.ToList(),
memories = new[] {1f, 1f, 1f}.ToList(),
storedVectorActions = new[] {3f, 4f},
actionMasks = new[] {true, false, false, false, false},
stackedVectorObservation = new[] { 4f, 5f, 6f }.ToList(),
memories = new[] { 1f, 1f, 1f }.ToList(),
storedVectorActions = new[] { 3f, 4f },
actionMasks = new[] { true, false, false, false, false },
return new List<Agent> {agentA, agentB};
return new List<Agent> { agentA, agentB };
}
[Test]

{
var inputTensor = new TensorProxy
{
shape = new long[] {2, 3}
shape = new long[] { 2, 3 }
};
const int batchSize = 4;
var agentInfos = GetFakeAgentInfos();

{
var inputTensor = new TensorProxy
{
shape = new long[] {2, 5}
shape = new long[] { 2, 5 }
};
const int batchSize = 4;
var agentInfos = GetFakeAgentInfos();

{
var inputTensor = new TensorProxy
{
shape = new long[] {2, 2},
shape = new long[] { 2, 2 },
valueType = TensorProxy.TensorType.Integer
};
const int batchSize = 4;

{
var inputTensor = new TensorProxy
{
shape = new long[] {2, 5},
shape = new long[] { 2, 5 },
valueType = TensorProxy.TensorType.FloatingPoint
};
const int batchSize = 4;

91
UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs


public override void CollectObservations()
{
collectObservationsCalls += 1;
AddVectorObs(0f);
}
public override void AgentAction(float[] vectorAction, string textAction)

public override void AgentOnDone()
{
agentOnDoneCalls += 1;
}
public override float[] Heuristic()
{
return new float[0];
}
}

sensorName = n;
}
public int[] GetFloatObservationShape() {
return new[] {1};
public int[] GetFloatObservationShape()
{
return new[] { 1 };
}
public void WriteToTensor(TensorProxy tensorProxy, int agentIndex) { }

}
}
// This is an empty class for testing the behavior of agents and academy
// It is left empty because we are not testing any brain behavior
public class TestBrain : Brain
{
public int numberOfCallsToInitialize;
public int numberOfCallsToDecideAction;
public static TestBrain Instantiate()
{
return CreateInstance<TestBrain>();
}
protected override void Initialize()
{
numberOfCallsToInitialize++;
}
protected override void DecideAction()
{
numberOfCallsToDecideAction++;
m_Agents.Clear();
}
}
public class EditModeTestGeneration
{
[Test]

//This will call the method even though it is private
var academyInitializeMethod = typeof(Academy).GetMethod("InitializeEnvironment",
BindingFlags.Instance | BindingFlags.NonPublic);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
Assert.AreEqual(1, aca.initializeAcademyCalls);
Assert.AreEqual(0, aca.GetEpisodeCount());
Assert.AreEqual(0, aca.GetStepCount());

acaGo.AddComponent<TestAcademy>();
var aca = acaGo.GetComponent<TestAcademy>();
aca.resetParameters = new ResetParameters();
var brain = TestBrain.Instantiate();
brain.brainParameters = new BrainParameters();
brain.brainParameters.vectorObservationSize = 0;
agent1.GiveBrain(brain);
agent2.GiveBrain(brain);
Assert.AreEqual(false, agent1.IsDone());
Assert.AreEqual(false, agent2.IsDone());

agentEnableMethod?.Invoke(agent2, new object[] { aca });
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
agentEnableMethod?.Invoke(agent1, new object[] { aca });
Assert.AreEqual(false, agent1.IsDone());

aca.resetParameters = new ResetParameters();
var academyInitializeMethod = typeof(Academy).GetMethod("InitializeEnvironment",
BindingFlags.Instance | BindingFlags.NonPublic);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
var academyStepMethod = typeof(Academy).GetMethod("EnvironmentStep",
BindingFlags.Instance | BindingFlags.NonPublic);

{
numberReset += 1;
}
academyStepMethod?.Invoke(aca, new object[] {});
academyStepMethod?.Invoke(aca, new object[] { });
}
}

acaGo.AddComponent<TestAcademy>();
var aca = acaGo.GetComponent<TestAcademy>();
aca.resetParameters = new ResetParameters();
var brain = TestBrain.Instantiate();
var agentEnableMethod = typeof(Agent).GetMethod(

agent1.agentParameters = new AgentParameters();
agent2.agentParameters = new AgentParameters();
brain.brainParameters = new BrainParameters();
// We use event based so the agent will now try to send anything to the brain
agent1.agentParameters.onDemandDecision = false;
agent1.agentParameters.numberOfActionsBetweenDecisions = 2;

brain.brainParameters.vectorObservationSize = 0;
agent1.GiveBrain(brain);
agent2.GiveBrain(brain);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
var academyStepMethod = typeof(Academy).GetMethod(
"EnvironmentStep", BindingFlags.Instance | BindingFlags.NonPublic);

requestAction += 1;
agent2.RequestAction();
}
academyStepMethod?.Invoke(aca, new object[] {});
academyStepMethod?.Invoke(aca, new object[] { });
}
}
}

aca.resetParameters = new ResetParameters();
var academyInitializeMethod = typeof(Academy).GetMethod(
"InitializeEnvironment", BindingFlags.Instance | BindingFlags.NonPublic);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
var academyStepMethod = typeof(Academy).GetMethod(
"EnvironmentStep", BindingFlags.Instance | BindingFlags.NonPublic);

}
stepsSinceReset += 1;
academyStepMethod.Invoke(aca, new object[] {});
academyStepMethod.Invoke(aca, new object[] { });
}
}

acaGo.AddComponent<TestAcademy>();
var aca = acaGo.GetComponent<TestAcademy>();
aca.resetParameters = new ResetParameters();
var brain = TestBrain.Instantiate();
var agentEnableMethod = typeof(Agent).GetMethod(

agent1.agentParameters = new AgentParameters();
agent2.agentParameters = new AgentParameters();
brain.brainParameters = new BrainParameters();
// agent2 will request decisions only when RequestDecision is called
brain.brainParameters.vectorObservationSize = 0;
agent1.GiveBrain(brain);
agent2.GiveBrain(brain);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
var numberAgent1Reset = 0;
var numberAgent2Reset = 0;

agent2StepSinceReset += 1;
//Agent 1 is only initialized at step 2
if (i < 2)
{}
academyStepMethod?.Invoke(aca, new object[] {});
{ }
academyStepMethod?.Invoke(aca, new object[] { });
}
}
}

acaGo.AddComponent<TestAcademy>();
var aca = acaGo.GetComponent<TestAcademy>();
aca.resetParameters = new ResetParameters();
var brain = TestBrain.Instantiate();
var agentEnableMethod = typeof(Agent).GetMethod(

agent1.agentParameters = new AgentParameters();
agent2.agentParameters = new AgentParameters();
brain.brainParameters = new BrainParameters();
// We use event based so the agent will now try to send anything to the brain
agent1.agentParameters.onDemandDecision = false;
// agent1 will take an action at every step and request a decision every steps

//Here we specify that the agent does not reset when done
agent1.agentParameters.resetOnDone = false;
agent2.agentParameters.resetOnDone = false;
brain.brainParameters.vectorObservationSize = 0;
agent1.GiveBrain(brain);
agent2.GiveBrain(brain);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
agentEnableMethod?.Invoke(agent1, new object[] { aca });
var agent1ResetOnDone = 0;

}
academyStepMethod?.Invoke(aca, new object[] {});
academyStepMethod?.Invoke(aca, new object[] { });
}
}

acaGo.AddComponent<TestAcademy>();
var aca = acaGo.GetComponent<TestAcademy>();
aca.resetParameters = new ResetParameters();
var brain = TestBrain.Instantiate();
var agentEnableMethod = typeof(Agent).GetMethod(

agent1.agentParameters = new AgentParameters();
agent2.agentParameters = new AgentParameters();
brain.brainParameters = new BrainParameters();
// We use event based so the agent will now try to send anything to the brain
agent1.agentParameters.onDemandDecision = false;
agent1.agentParameters.numberOfActionsBetweenDecisions = 3;

agent1.agentParameters.maxStep = 20;
brain.brainParameters.vectorObservationSize = 0;
agent1.GiveBrain(brain);
agent2.GiveBrain(brain);
academyInitializeMethod?.Invoke(aca, new object[] {});
academyInitializeMethod?.Invoke(aca, new object[] { });
agentEnableMethod?.Invoke(agent1, new object[] { aca });

Assert.LessOrEqual(Mathf.Abs(i * 0.1f - agent2.GetCumulativeReward()), 0.05f);
academyStepMethod?.Invoke(aca, new object[] {});
academyStepMethod?.Invoke(aca, new object[] { });
agent1.AddReward(10f);
if ((i % 21 == 0) && (i > 0))

29
UnitySDK/Assets/ML-Agents/Examples/3DBall/Prefabs/3DBall.prefab


m_Component:
- component: {fileID: 4780098186595842}
- component: {fileID: 65010516625723872}
- component: {fileID: 114259948429386406}
- component: {fileID: 114368073295828880}
- component: {fileID: 114715123104194396}
m_Layer: 0
m_Name: Agent
m_TagString: Untagged

serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &114259948429386406
--- !u!114 &114368073295828880
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1424713891854676}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 8
numStackedVectorObservations: 1
vectorActionSize: 02000000
vectorActionDescriptions: []
vectorActionSpaceType: 1
m_Model: {fileID: 11400000, guid: a0e8d1fda5a6f41be955d2b30479c2a1, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: 3DBall
--- !u!114 &114715123104194396
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}

m_Script: {fileID: 11500000, guid: aaba48bf82bee4751aa7b89569e57f73, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 383c589e8bb76464eadc2525b5b0f2c1, type: 2}
agentCameras: []
agentRenderTextures: []
maxStep: 5000
resetOnDone: 1
onDemandDecision: 0

24
UnitySDK/Assets/ML-Agents/Examples/3DBall/Prefabs/3DBallHardNew.prefab


m_Component:
- component: {fileID: 4895942152145390}
- component: {fileID: 65170961617201804}
- component: {fileID: 114284317994838100}
- component: {fileID: 114466000339026140}
m_Layer: 0
m_Name: Agent

serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &114284317994838100
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1829721031899636}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 5
numStackedVectorObservations: 9
vectorActionSize: 02000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 1
m_Model: {fileID: 11400000, guid: cee7d20369b814d549573de7e76c4a81, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: 3DBallHard
--- !u!114 &114466000339026140
MonoBehaviour:
m_ObjectHideFlags: 1

m_Script: {fileID: 11500000, guid: edf26e11cf4ed42eaa3ffb7b91bb4676, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 4f74e089fbb75455ebf6f0495e30be6e, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

47
UnitySDK/Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity


propertyPath: m_Name
value: 3DBall (7)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

propertyPath: m_Name
value: 3DBall (5)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_Name
value: 3DBall (6)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}

propertyPath: m_Name
value: 3DBall (3)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

propertyPath: m_Name
value: 3DBall (8)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_Name
value: 3DBall (9)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}

propertyPath: m_Name
value: 3DBall (10)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

propertyPath: m_Name
value: 3DBall (1)
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_BrainParameters.numStackedVectorObservations
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_Name
value: 3DBall (11)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}

propertyPath: m_Name
value: 3DBall (4)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
m_IsPrefabParent: 0

m_Script: {fileID: 11500000, guid: eb15e3c3d55e54abaafb74c635b6a458, type: 3}
m_Name:
m_EditorClassIdentifier:
broadcastHub:
brainsToControl:
- {fileID: 11400000, guid: 383c589e8bb76464eadc2525b5b0f2c1, type: 2}
m_TrainingConfiguration:
width: 300
height: 200

- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_Name
value: 3DBall (2)
objectReference: {fileID: 0}
- target: {fileID: 1321468028730240, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cfa81c019162c4e3caf6e2999c6fdf48, type: 2}

34
UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs


public override void AgentAction(float[] vectorAction, string textAction)
{
if (brain.brainParameters.vectorActionSpaceType == SpaceType.Continuous)
var actionZ = 2f * Mathf.Clamp(vectorAction[0], -1f, 1f);
var actionX = 2f * Mathf.Clamp(vectorAction[1], -1f, 1f);
if ((gameObject.transform.rotation.z < 0.25f && actionZ > 0f) ||
(gameObject.transform.rotation.z > -0.25f && actionZ < 0f))
var actionZ = 2f * Mathf.Clamp(vectorAction[0], -1f, 1f);
var actionX = 2f * Mathf.Clamp(vectorAction[1], -1f, 1f);
gameObject.transform.Rotate(new Vector3(0, 0, 1), actionZ);
}
if ((gameObject.transform.rotation.z < 0.25f && actionZ > 0f) ||
(gameObject.transform.rotation.z > -0.25f && actionZ < 0f))
{
gameObject.transform.Rotate(new Vector3(0, 0, 1), actionZ);
}
if ((gameObject.transform.rotation.x < 0.25f && actionX > 0f) ||
(gameObject.transform.rotation.x > -0.25f && actionX < 0f))
{
gameObject.transform.Rotate(new Vector3(1, 0, 0), actionX);
}
if ((gameObject.transform.rotation.x < 0.25f && actionX > 0f) ||
(gameObject.transform.rotation.x > -0.25f && actionX < 0f))
{
gameObject.transform.Rotate(new Vector3(1, 0, 0), actionX);
}
if ((ball.transform.position.y - gameObject.transform.position.y) < -2f ||
Mathf.Abs(ball.transform.position.x - gameObject.transform.position.x) > 3f ||

+ gameObject.transform.position;
//Reset the parameters when the Agent is reset.
SetResetParameters();
}
public override float[] Heuristic()
{
var action = new float[2];
action[0] = -Input.GetAxis("Horizontal");
action[1] = Input.GetAxis("Vertical");
return action;
}
public void SetBall()

25
UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs


public override void AgentAction(float[] vectorAction, string textAction)
{
if (brain.brainParameters.vectorActionSpaceType == SpaceType.Continuous)
var actionZ = 2f * Mathf.Clamp(vectorAction[0], -1f, 1f);
var actionX = 2f * Mathf.Clamp(vectorAction[1], -1f, 1f);
if ((gameObject.transform.rotation.z < 0.25f && actionZ > 0f) ||
(gameObject.transform.rotation.z > -0.25f && actionZ < 0f))
var actionZ = 2f * Mathf.Clamp(vectorAction[0], -1f, 1f);
var actionX = 2f * Mathf.Clamp(vectorAction[1], -1f, 1f);
gameObject.transform.Rotate(new Vector3(0, 0, 1), actionZ);
}
if ((gameObject.transform.rotation.z < 0.25f && actionZ > 0f) ||
(gameObject.transform.rotation.z > -0.25f && actionZ < 0f))
{
gameObject.transform.Rotate(new Vector3(0, 0, 1), actionZ);
}
if ((gameObject.transform.rotation.x < 0.25f && actionX > 0f) ||
(gameObject.transform.rotation.x > -0.25f && actionX < 0f))
{
gameObject.transform.Rotate(new Vector3(1, 0, 0), actionX);
}
if ((gameObject.transform.rotation.x < 0.25f && actionX > 0f) ||
(gameObject.transform.rotation.x > -0.25f && actionX < 0f))
{
gameObject.transform.Rotate(new Vector3(1, 0, 0), actionX);
}
if ((ball.transform.position.y - gameObject.transform.position.y) < -2f ||
Mathf.Abs(ball.transform.position.x - gameObject.transform.position.x) > 3f ||

24
UnitySDK/Assets/ML-Agents/Examples/Basic/Prefabs/Basic.prefab


m_Component:
- component: {fileID: 4170723581433160}
- component: {fileID: 65968285873374238}
- component: {fileID: 114502619508238574}
- component: {fileID: 114827551040495112}
m_Layer: 0
m_Name: BasicAgent

serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &114502619508238574
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1263463520136984}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 20
numStackedVectorObservations: 1
vectorActionSize: 03000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: 53fa7c392ce3c492281be273668f6aaf, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: Basic
--- !u!114 &114827551040495112
MonoBehaviour:
m_ObjectHideFlags: 1

m_Script: {fileID: 11500000, guid: 624480a72e46148118ab2e2d89b537de, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: e5cf0e35e16264ea483f8863e5115c3c, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

13
UnitySDK/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs


largeGoal.transform.position = new Vector3(m_LargeGoalPosition - 10f, 0f, 0f);
}
public override float[] Heuristic()
{
if (Input.GetKey(KeyCode.D))
{
return new float[] { 2 };
}
if (Input.GetKey(KeyCode.A))
{
return new float[] { 1 };
}
return new float[] { 0 };
}
public override void AgentOnDone()
{
}

24
UnitySDK/Assets/ML-Agents/Examples/Bouncer/Prefabs/Environment.prefab


- component: {fileID: 33085749764809866}
- component: {fileID: 65800894914404220}
- component: {fileID: 54030303118153432}
- component: {fileID: 114938751572484598}
- component: {fileID: 114878620968301562}
m_Layer: 0
m_Name: Agent

m_Script: {fileID: 11500000, guid: 0f09741cbce2e44bc88d3e92917eea0e, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 573920e3a672d40038169c7ffdbdca05, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

target: {fileID: 1160631129428284}
bodyObject: {fileID: 1680588139522898}
strength: 500
--- !u!114 &114938751572484598
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1604827395706042}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 6
numStackedVectorObservations: 3
vectorActionSize: 03000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 1
m_Model: {fileID: 11400000, guid: f5250a39cb2134db49b833e3c92527a1, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: Bouncer

10
UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs


}
}
public override float[] Heuristic()
{
var action = new float[3];
action[0] = Input.GetAxis("Horizontal");
action[1] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
action[2] = Input.GetAxis("Vertical");
return action;
}
private void Update()
{
if (m_LookDir.magnitude > float.Epsilon)

25
UnitySDK/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab


serializedVersion: 5
m_Component:
- component: {fileID: 4313455366547514}
- component: {fileID: 114060650647145362}
- component: {fileID: 114590693924030052}
- component: {fileID: 114423363226357902}
m_Layer: 0

m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!114 &114060650647145362
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1515093357607024}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 126
numStackedVectorObservations: 1
vectorActionSize: 14000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 1
m_Model: {fileID: 11400000, guid: abc9c8f2180154ed7ba3f116ab0beb90, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: CrawlerDynamic
--- !u!114 &114157055237627828
MonoBehaviour:
m_ObjectHideFlags: 1

m_Script: {fileID: 11500000, guid: 2f37c30a5e8d04117947188818902ef3, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 0e3b44d36c7a047c4addb92457b12be5, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

target: {fileID: 4490950947783742}
ground: {fileID: 4684408634944056}
detectTargets: 1
targetIsStatic: 0
respawnTargetWhenTouched: 1
targetSpawnRadius: 40
body: {fileID: 4331762859142564}

24
UnitySDK/Assets/ML-Agents/Examples/Crawler/Prefabs/FixedPlatform.prefab


serializedVersion: 5
m_Component:
- component: {fileID: 4743084330461368}
- component: {fileID: 114727679958902886}
- component: {fileID: 114230237520033992}
- component: {fileID: 114375802757824636}
m_Layer: 0

m_Script: {fileID: 11500000, guid: 2f37c30a5e8d04117947188818902ef3, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 0505e961608004377974940ed17e03d5, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

penalizeGroundContact: 0
groundContactPenalty: 0
touchingGround: 0
--- !u!114 &114727679958902886
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1492298671135358}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 126
numStackedVectorObservations: 1
vectorActionSize: 14000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 1
m_Model: {fileID: 11400000, guid: 48982d8fa360a4ed0bb265495e4f378b, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: CrawlerStatic
--- !u!114 &114954029223843696
MonoBehaviour:
m_ObjectHideFlags: 1

128
UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/FoodCollectorArea.prefab


- component: {fileID: 4419274671784554}
- component: {fileID: 65550728419070768}
- component: {fileID: 54936164982484646}
- component: {fileID: 114374774605792098}
- component: {fileID: 114762047763154270}
- component: {fileID: 114176228333253036}
m_Layer: 0

- component: {fileID: 4756368533889646}
- component: {fileID: 65905012397919158}
- component: {fileID: 54504078365531932}
- component: {fileID: 114522573150607728}
- component: {fileID: 114416645532260476}
- component: {fileID: 114711827726849508}
m_Layer: 0

- component: {fileID: 4426245476092464}
- component: {fileID: 65152194455140476}
- component: {fileID: 54961653455021136}
- component: {fileID: 114980787530065684}
- component: {fileID: 114192565006091356}
- component: {fileID: 114542632553128056}
m_Layer: 0

- component: {fileID: 4259834826122778}
- component: {fileID: 65761952312736034}
- component: {fileID: 54819001862035794}
- component: {fileID: 114878550018296316}
- component: {fileID: 114661830999747712}
- component: {fileID: 114189751434580810}
m_Layer: 0

- component: {fileID: 4137908820211030}
- component: {fileID: 65367560123033576}
- component: {fileID: 54895479068989492}
- component: {fileID: 114035338027591536}
- component: {fileID: 114821937036444478}
- component: {fileID: 114235147148547996}
m_Layer: 0

serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &114035338027591536
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1706274796045088}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 53
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: d32fca21cf4c04536ab7f88eb9de83e0, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: FoodCollector
--- !u!114 &114176228333253036
MonoBehaviour:
m_ObjectHideFlags: 1

m_Script: {fileID: 11500000, guid: c66e6845309d241c78a6d77ee2567928, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 9e7865ec29c894c2d8c1617b0fa392f9, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

m_Script: {fileID: 11500000, guid: c66e6845309d241c78a6d77ee2567928, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 9e7865ec29c894c2d8c1617b0fa392f9, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

badMaterial: {fileID: 2100000, guid: 88b9ae7af2c1748a0a1f63407587a601, type: 2}
goodMaterial: {fileID: 2100000, guid: c67450f290f3e4897bc40276a619e78d, type: 2}
frozenMaterial: {fileID: 2100000, guid: 66163cf35956a4be08e801b750c26f33, type: 2}
myLaser: {fileID: 1617924810425504}
myLaser: {fileID: 1081721624670010}
contribute: 0
useVectorObs: 1
--- !u!114 &114192565006091356

m_Script: {fileID: 11500000, guid: c66e6845309d241c78a6d77ee2567928, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 9e7865ec29c894c2d8c1617b0fa392f9, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

badMaterial: {fileID: 2100000, guid: 88b9ae7af2c1748a0a1f63407587a601, type: 2}
goodMaterial: {fileID: 2100000, guid: c67450f290f3e4897bc40276a619e78d, type: 2}
frozenMaterial: {fileID: 2100000, guid: 66163cf35956a4be08e801b750c26f33, type: 2}
myLaser: {fileID: 1045923826166930}
myLaser: {fileID: 1081721624670010}
--- !u!114 &114374774605792098
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1464820575638702}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 53
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: d32fca21cf4c04536ab7f88eb9de83e0, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: FoodCollector
--- !u!114 &114416645532260476
MonoBehaviour:
m_ObjectHideFlags: 1

m_Script: {fileID: 11500000, guid: bb172294dbbcc408286b156a2c4b553c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114522573150607728
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1495617568563208}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 53
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: d32fca21cf4c04536ab7f88eb9de83e0, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: FoodCollector
--- !u!114 &114542632553128056
MonoBehaviour:
m_ObjectHideFlags: 1

m_Script: {fileID: 11500000, guid: c66e6845309d241c78a6d77ee2567928, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 9e7865ec29c894c2d8c1617b0fa392f9, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

badMaterial: {fileID: 2100000, guid: 88b9ae7af2c1748a0a1f63407587a601, type: 2}
goodMaterial: {fileID: 2100000, guid: c67450f290f3e4897bc40276a619e78d, type: 2}
frozenMaterial: {fileID: 2100000, guid: 66163cf35956a4be08e801b750c26f33, type: 2}
myLaser: {fileID: 1421240237750412}
myLaser: {fileID: 1081721624670010}
contribute: 0
useVectorObs: 1
--- !u!114 &114661830999747712

m_Script: {fileID: 11500000, guid: c66e6845309d241c78a6d77ee2567928, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 9e7865ec29c894c2d8c1617b0fa392f9, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures: []

badMaterial: {fileID: 2100000, guid: 88b9ae7af2c1748a0a1f63407587a601, type: 2}
goodMaterial: {fileID: 2100000, guid: c67450f290f3e4897bc40276a619e78d, type: 2}
frozenMaterial: {fileID: 2100000, guid: 66163cf35956a4be08e801b750c26f33, type: 2}
myLaser: {fileID: 1941433838307300}
myLaser: {fileID: 1081721624670010}
contribute: 0
useVectorObs: 1
--- !u!114 &114762047763154270

m_Script: {fileID: 11500000, guid: bb172294dbbcc408286b156a2c4b553c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114878550018296316
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1672905243433088}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 53
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: d32fca21cf4c04536ab7f88eb9de83e0, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: FoodCollector
--- !u!114 &114980787530065684
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1601500200010266}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 53
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
cameraResolutions: []
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: d32fca21cf4c04536ab7f88eb9de83e0, type: 3}
m_InferenceDevice: 0
m_UseHeuristic: 0
m_BehaviorName: FoodCollector

868
UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab
文件差异内容过多而无法显示
查看文件

129
UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scenes/VisualFoodCollector.unity


m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 3ce107b4a79bc4eef83afde434932a68, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &868060419
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4307641258646068, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1009000883
GameObject:
m_ObjectHideFlags: 0

m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1001 &1081822017
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4612263362188236, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 23446453883495642, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 580f2003972f64189826f085e2498080, type: 3}
- target: {fileID: 114708558732651708, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
propertyPath: camera
value:
objectReference: {fileID: 1081822021}
- target: {fileID: 114401766178763868, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
propertyPath: camera
value:
objectReference: {fileID: 1081822020}
- target: {fileID: 114778458791730518, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
propertyPath: camera
value:
objectReference: {fileID: 1081822019}
- target: {fileID: 114741414993459624, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
propertyPath: camera
value:
objectReference: {fileID: 1081822018}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c85b585836e104587b4efdc4d8b9d62b, type: 2}
m_IsPrefabParent: 0
--- !u!20 &1081822018 stripped
Camera:
m_PrefabParentObject: {fileID: 20825339371991526, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
m_PrefabInternal: {fileID: 1081822017}
--- !u!20 &1081822019 stripped
Camera:
m_PrefabParentObject: {fileID: 20416796192002010, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
m_PrefabInternal: {fileID: 1081822017}
--- !u!20 &1081822020 stripped
Camera:
m_PrefabParentObject: {fileID: 20184829288622090, guid: c85b585836e104587b4efdc4d8b9d62b,
type: 2}
m_PrefabInternal: {fileID: 1081822017}
--- !u