浏览代码

Merge pull request #384 from Unity-Technologies/hotfix/issue#333

hotfix on issue#333, and a few comments fixes
/develop-generalizationTraining-TrainerController
GitHub 7 年前
当前提交
8d6bf190
共有 44 个文件被更改,包括 531 次插入532 次删除
  1. 22
      unity-environment/Assets/ML-Agents/Editor/AgentEditor.cs
  2. 50
      unity-environment/Assets/ML-Agents/Editor/BrainEditor.cs
  3. 2
      unity-environment/Assets/ML-Agents/Editor/MLAgentsEditModeTest.cs
  4. 34
      unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs
  5. 18
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Area.cs
  6. 34
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/AreaAgent.cs
  7. 14
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/AreaDecision.cs
  8. 2
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/GoalInteract.cs
  9. 12
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Push/PushAcademy.cs
  10. 42
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Push/PushAgent.cs
  11. 24
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Push/PushArea.cs
  12. 10
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Wall/WallAcademy.cs
  13. 46
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Wall/WallAgent.cs
  14. 24
      unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Wall/WallArea.cs
  15. 4
      unity-environment/Assets/ML-Agents/Examples/Banana/Scripts/BananaAgent.cs
  16. 18
      unity-environment/Assets/ML-Agents/Examples/Banana/Scripts/BananaLogic.cs
  17. 12
      unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAcademy.cs
  18. 70
      unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs
  19. 12
      unity-environment/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAcademy.cs
  20. 22
      unity-environment/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs
  21. 8
      unity-environment/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerBanana.cs
  22. 22
      unity-environment/Assets/ML-Agents/Examples/Crawler/Scripts/CameraFollow.cs
  23. 14
      unity-environment/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAcademy.cs
  24. 51
      unity-environment/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs
  25. 22
      unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/FlyCamera.cs
  26. 12
      unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAcademy.cs
  27. 5
      unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs
  28. 12
      unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherDecision.cs
  29. 18
      unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherGoal.cs
  30. 16
      unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/TennisArea.cs
  31. 216
      unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/hitWall.cs
  32. 20
      unity-environment/Assets/ML-Agents/Scripts/Academy.cs
  33. 18
      unity-environment/Assets/ML-Agents/Scripts/Agent.cs
  34. 14
      unity-environment/Assets/ML-Agents/Scripts/BCTeacherHelper.cs
  35. 8
      unity-environment/Assets/ML-Agents/Scripts/Brain.cs
  36. 2
      unity-environment/Assets/ML-Agents/Scripts/Communicator.cs
  37. 39
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs
  38. 22
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs
  39. 2
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs
  40. 28
      unity-environment/Assets/ML-Agents/Scripts/Decision.cs
  41. 8
      unity-environment/Assets/ML-Agents/Scripts/ExternalCommunicator.cs
  42. 12
      unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAcademy.cs
  43. 20
      unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAgent.cs
  44. 2
      unity-environment/Assets/ML-Agents/Template/Scripts/TemplateDecision.cs

22
unity-environment/Assets/ML-Agents/Editor/AgentEditor.cs


EditorGUILayout.PropertyField(brain);
EditorGUILayout.LabelField("Agent Cameras");
for (int i = 0; i < cameras.arraySize; i++)
{
EditorGUILayout.PropertyField(cameras.GetArrayElementAtIndex(i), new GUIContent("Camera " + (i + 1).ToString() + ": "));
}
for (int i = 0; i < cameras.arraySize; i++)
{
EditorGUILayout.PropertyField(cameras.GetArrayElementAtIndex(i), new GUIContent("Camera " + (i + 1).ToString() + ": "));
}
if (GUILayout.Button("Remove Camera", EditorStyles.miniButton))
{
cameras.arraySize--;
}
if (GUILayout.Button("Remove Camera", EditorStyles.miniButton))
{
cameras.arraySize--;
}
"The per-agent maximum number of steps."));
"The per-agent maximum number of steps."));
EditorGUILayout.PropertyField(isResetOnDone, new GUIContent("Reset On Done",
"If checked, the agent will reset on done. Else, AgentOnDone() will be called."));
EditorGUILayout.PropertyField(isEBS, new GUIContent("On Demand Decision", "If checked, you must manually request decisions."));

actionsPerDecision.intValue = Mathf.Max(1, actionsPerDecision.intValue);
}
serializedAgent.ApplyModifiedProperties();
serializedAgent.ApplyModifiedProperties();
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
base.OnInspectorGUI();

50
unity-environment/Assets/ML-Agents/Editor/BrainEditor.cs


[SerializeField]
bool _Foldout = true;
public override void OnInspectorGUI ()
{
Brain myBrain = (Brain)target;
SerializedObject serializedBrain = serializedObject;
public override void OnInspectorGUI ()
{
Brain myBrain = (Brain)target;
SerializedObject serializedBrain = serializedObject;
if (myBrain.transform.parent == null) {
EditorGUILayout.HelpBox ("A Brain GameObject must be a child of an Academy GameObject!", MessageType.Error);
} else if (myBrain.transform.parent.GetComponent<Academy> () == null) {
EditorGUILayout.HelpBox ("The Parent of a Brain must have an Academy Component attached to it!", MessageType.Error);
}
if (myBrain.transform.parent == null) {
EditorGUILayout.HelpBox ("A Brain GameObject must be a child of an Academy GameObject!", MessageType.Error);
} else if (myBrain.transform.parent.GetComponent<Academy> () == null) {
EditorGUILayout.HelpBox ("The Parent of a Brain must have an Academy Component attached to it!", MessageType.Error);
}
BrainParameters parameters = myBrain.brainParameters;
BrainParameters parameters = myBrain.brainParameters;
serializedBrain.Update();
serializedBrain.Update();
_Foldout = EditorGUILayout.Foldout(_Foldout, "Brain Parameters");
int indentLevel = EditorGUI.indentLevel;

}
EditorGUI.indentLevel = indentLevel;
SerializedProperty bt = serializedBrain.FindProperty("brainType");
EditorGUILayout.PropertyField(bt);
SerializedProperty bt = serializedBrain.FindProperty("brainType");
EditorGUILayout.PropertyField(bt);
if (bt.enumValueIndex < 0) {
bt.enumValueIndex = (int)BrainType.Player;
}
if (bt.enumValueIndex < 0) {
bt.enumValueIndex = (int)BrainType.Player;
}
serializedBrain.ApplyModifiedProperties();
serializedBrain.ApplyModifiedProperties();
myBrain.UpdateCoreBrains ();
myBrain.coreBrain.OnInspector ();
myBrain.UpdateCoreBrains ();
myBrain.coreBrain.OnInspector ();
#if !NET_4_6 && ENABLE_TENSORFLOW
EditorGUILayout.HelpBox ("You cannot have ENABLE_TENSORFLOW without NET_4_6", MessageType.Error);
#endif
}
#if !NET_4_6 && ENABLE_TENSORFLOW
EditorGUILayout.HelpBox ("You cannot have ENABLE_TENSORFLOW without NET_4_6", MessageType.Error);
#endif
}
}

2
unity-environment/Assets/ML-Agents/Editor/MLAgentsEditModeTest.cs


Assert.AreEqual(0, aca.stepsSinceReset);
Assert.AreEqual(0, aca.episodeCount);
Assert.AreEqual(false, aca.IsDone());
//This will call the method even though it is private
// This will call the method even though it is private
MethodInfo AcademyInitializeMethod = typeof(Academy).GetMethod("_InitializeAcademy",
BindingFlags.Instance | BindingFlags.NonPublic);
AcademyInitializeMethod.Invoke(aca, new object[] { });

34
unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs


public class Ball3DDecision : MonoBehaviour, Decision
{
public float rotationSpeed = 2f;
List<float> ret = new List<float>();
if (state[2] < 0 || state[5] < 0)
{
ret.Add(state[5]);
}
else
{
ret.Add(state[5]);
}
if (state[3] < 0 || state[7] < 0)
{
ret.Add(-state[7]);
}
else
{
ret.Add(-state[7]);
}
return ret.ToArray();
List<float> act = new List<float>();
// state[5] is the velocity of the ball in the x orientation.
// We use this number to control the Platform's z axis rotation speed,
// so that the Platform is tilted in the x orientation correspondingly.
act.Add(state[5] * rotationSpeed);
// state[7] is the velocity of the ball in the z orientation.
// We use this number to control the Platform's x axis rotation speed,
// so that the Platform is tilted in the z orientation correspondingly.
act.Add(-state[7] * rotationSpeed);
return act.ToArray();
// If the vector action space type is discrete, then we don't do anything.
else
{
return new float[1]{ 1f };

18
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Area.cs


public class Area : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public virtual void ResetArea() {

34
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/AreaAgent.cs


public override void CollectObservations()
{
Vector3 velocity = GetComponent<Rigidbody>().velocity;
AddVectorObs((transform.position.x - area.transform.position.x));
AddVectorObs((transform.position.y - area.transform.position.y));
AddVectorObs((transform.position.z + 5 - area.transform.position.z));
AddVectorObs(velocity.x);
AddVectorObs(velocity.y);
AddVectorObs(velocity.z);
}
AddVectorObs((transform.position.x - area.transform.position.x));
AddVectorObs((transform.position.y - area.transform.position.y));
AddVectorObs((transform.position.z + 5 - area.transform.position.z));
AddVectorObs(velocity.x);
AddVectorObs(velocity.y);
AddVectorObs(velocity.z);
}
public void MoveAgent(float[] act) {
float directionX = 0;

AddReward(-0.005f);
MoveAgent(vectorAction);
if (gameObject.transform.position.y < 0.0f || Mathf.Abs(gameObject.transform.position.x - area.transform.position.x) > 8f ||
if (gameObject.transform.position.y < 0.0f || Mathf.Abs(gameObject.transform.position.x - area.transform.position.x) > 8f ||
{
{
}
}
}
}
public override void AgentReset()
{
transform.position = new Vector3(Random.Range(-3.5f, 3.5f), 1.1f, -8f) + area.transform.position;
GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
public override void AgentReset()
{
transform.position = new Vector3(Random.Range(-3.5f, 3.5f), 1.1f, -8f) + area.transform.position;
GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
area.GetComponent<Area>().ResetArea();
}
area.GetComponent<Area>().ResetArea();
}
}

14
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/AreaDecision.cs


public class AreaDecision : MonoBehaviour, Decision {
public float[] Decide (List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory)
{
{
}
}
public List<float> MakeMemory (List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory)
{
return new List<float>();
}
public List<float> MakeMemory (List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory)
{
return new List<float>();
}
}

2
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/GoalInteract.cs


agent.Done();
agent.AddReward(1f);
}
}
}
}

12
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Push/PushAcademy.cs


public float blockSize;
public float xVariation;
public override void AcademyReset()
{
public override void AcademyReset()
{
}
}
public override void AcademyStep()
{
public override void AcademyStep()
{
}
}
}

42
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Push/PushAgent.cs


public class PushAgent : AreaAgent
{
public GameObject goalHolder;
public GameObject goalHolder;
public GameObject block;
Rigidbody rb;

public override void InitializeAgent()
{
base.InitializeAgent();
base.InitializeAgent();
public override void CollectObservations()
{
public override void CollectObservations()
{
velocity = rb.velocity;
blockVelocity = block.GetComponent<Rigidbody>().velocity;
AddVectorObs((transform.position.x - area.transform.position.x));

AddVectorObs((block.transform.position.y - area.transform.position.y));
AddVectorObs((block.transform.position.z + 5 - area.transform.position.z));
AddVectorObs(velocity.x);
AddVectorObs(velocity.y);
AddVectorObs(velocity.z);
AddVectorObs(velocity.x);
AddVectorObs(velocity.y);
AddVectorObs(velocity.z);
AddVectorObs(blockVelocity.x);
AddVectorObs(blockVelocity.y);
AddVectorObs(blockVelocity.z);
AddVectorObs(blockVelocity.x);
AddVectorObs(blockVelocity.y);
AddVectorObs(blockVelocity.z);
}
}
public override void AgentAction(float[] vectorAction, string textAction)
{

if (gameObject.transform.position.y < 0.0f || Mathf.Abs(gameObject.transform.position.x - area.transform.position.x) > 8f ||
Mathf.Abs(gameObject.transform.position.z + 5 - area.transform.position.z) > 8)
{
{
}
}
}
}
public override void AgentReset()
{
public override void AgentReset()
{
rb.velocity = new Vector3(0f, 0f, 0f);
rb.velocity = new Vector3(0f, 0f, 0f);
}
}
public override void AgentOnDone()
{
public override void AgentOnDone()
{
}
}
}

24
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Push/PushArea.cs


public GameObject goalHolder;
public GameObject academy;
// Use this for initialization
void Start () {
academy = GameObject.Find("Academy");
}
// Update is called once per frame
void Update () {
}
// Use this for initialization
void Start () {
academy = GameObject.Find("Academy");
}
// Update is called once per frame
void Update () {
}
public override void ResetArea()
{
public override void ResetArea()
{
float goalSize = academy.GetComponent<PushAcademy>().goalSize;
float blockSize = academy.GetComponent<PushAcademy>().blockSize;
float xVariation = academy.GetComponent<PushAcademy>().xVariation;

blockSize = Random.Range(blockSize * 0.9f, blockSize * 1.1f);
block.transform.localScale = new Vector3(blockSize, 1f, blockSize);
goalHolder.transform.localScale = new Vector3(goalSize, 1f, goalSize);
}
}
}

10
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Wall/WallAcademy.cs


public float minWallHeight;
public float maxWallHeight;
public override void AcademyReset()
{
public override void AcademyReset()
{
}
}
public override void AcademyStep()
{
public override void AcademyStep()
{
}

46
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Wall/WallAgent.cs


public class WallAgent : AreaAgent
{
public GameObject goalHolder;
public GameObject goalHolder;
base.InitializeAgent();
base.InitializeAgent();
public override void CollectObservations()
{
public override void CollectObservations()
{
Vector3 velocity = GetComponent<Rigidbody>().velocity;
AddVectorObs((transform.position.x - area.transform.position.x));
AddVectorObs((transform.position.y - area.transform.position.y));

AddVectorObs((block.transform.position.y - area.transform.position.y));
AddVectorObs((block.transform.position.z + 5 - area.transform.position.z));
AddVectorObs(wall.transform.localScale.y);
AddVectorObs(wall.transform.localScale.y);
AddVectorObs(velocity.x);
AddVectorObs(velocity.y);
AddVectorObs(velocity.z);
AddVectorObs(velocity.x);
AddVectorObs(velocity.y);
AddVectorObs(velocity.z);
AddVectorObs(blockVelocity.x);
AddVectorObs(blockVelocity.y);
AddVectorObs(blockVelocity.z);
}
AddVectorObs(blockVelocity.x);
AddVectorObs(blockVelocity.y);
AddVectorObs(blockVelocity.z);
}
public override void AgentAction(float[] vectorAction, string textAction)
{

if (gameObject.transform.position.y < 0.0f ||
Mathf.Abs(gameObject.transform.position.x - area.transform.position.x) > 8f ||
Mathf.Abs(gameObject.transform.position.z + 5 - area.transform.position.z) > 8)
{
{
}
}
}
}
public override void AgentReset()
{
transform.position = new Vector3(Random.Range(-3.5f, 3.5f), 1.1f, -8f) + area.transform.position;
GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
public override void AgentReset()
{
transform.position = new Vector3(Random.Range(-3.5f, 3.5f), 1.1f, -8f) + area.transform.position;
GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
}
}
public override void AgentOnDone()
{
public override void AgentOnDone()
{
}
}
}

24
unity-environment/Assets/ML-Agents/Examples/Area/Scripts/Wall/WallArea.cs


public GameObject block;
public GameObject goalHolder;
// Use this for initialization
void Start () {
academy = GameObject.Find("Academy");
}
// Update is called once per frame
void Update () {
}
// Use this for initialization
void Start () {
academy = GameObject.Find("Academy");
}
// Update is called once per frame
void Update () {
}
wall.transform.localScale = new Vector3(12f, Random.Range(wallHeightMin, wallHeightMax) - 0.1f, 1f);
wall.transform.localScale = new Vector3(12f, Random.Range(wallHeightMin, wallHeightMax) - 0.1f, 1f);
goalHolder.transform.position = new Vector3(Random.Range(-3.5f, 3.5f), -0.1f, 0f) + gameObject.transform.position;
}
goalHolder.transform.position = new Vector3(Random.Range(-3.5f, 3.5f), -0.1f, 0f) + gameObject.transform.position;
}
}

4
unity-environment/Assets/ML-Agents/Examples/Banana/Scripts/BananaAgent.cs


public override void InitializeAgent()
{
base.InitializeAgent();
agentRB = GetComponent<Rigidbody>(); //cache the RB
agentRB = GetComponent<Rigidbody>(); // cache the RB
Monitor.verticalOffset = 1f;
myArea = area.GetComponent<BananaArea>();
myAcademy = myAcademyObj.GetComponent<BananaAcademy>();

transform.Rotate(rotateDir, Time.deltaTime * turnSpeed);
}
if (agentRB.velocity.sqrMagnitude > 25f) //slow it down
if (agentRB.velocity.sqrMagnitude > 25f) // slow it down
{
agentRB.velocity *= 0.95f;
}

18
unity-environment/Assets/ML-Agents/Examples/Banana/Scripts/BananaLogic.cs


public bool respawn;
public BananaArea myArea;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void OnEaten() {
if (respawn)

12
unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAcademy.cs


public class BasicAcademy : Academy {
public override void AcademyReset()
{
public override void AcademyReset()
{
}
}
public override void AcademyStep()
{
public override void AcademyStep()
{
}
}
}

70
unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs


private BasicAcademy academy;
public float timeBetweenDecisionsAtInference;
private float timeSinceDecision;
public int position;
public int smallGoalPosition;
public int largeGoalPosition;
public GameObject largeGoal;
public GameObject smallGoal;
public int minPosition;
public int maxPosition;
public int position;
public int smallGoalPosition;
public int largeGoalPosition;
public GameObject largeGoal;
public GameObject smallGoal;
public int minPosition;
public int maxPosition;
public override void InitializeAgent()
{

public override void CollectObservations()
{
AddVectorObs(position);
}
public override void CollectObservations()
{
AddVectorObs(position);
}
public override void AgentAction(float[] vectorAction, string textAction)
{

if (movement == 1) { direction = 1; }
position += direction;
if (position < minPosition) { position = minPosition; }
if (position > maxPosition) { position = maxPosition; }
position += direction;
if (position < minPosition) { position = minPosition; }
if (position > maxPosition) { position = maxPosition; }
gameObject.transform.position = new Vector3(position, 0f, 0f);
gameObject.transform.position = new Vector3(position, 0f, 0f);
if (position == smallGoalPosition)
{
if (position == smallGoalPosition)
{
}
}
if (position == largeGoalPosition)
{
if (position == largeGoalPosition)
{
}
}
}
}
public override void AgentReset()
{
position = 0;
minPosition = -10;
maxPosition = 10;
smallGoalPosition = -3;
largeGoalPosition = 7;
smallGoal.transform.position = new Vector3(smallGoalPosition, 0f, 0f);
largeGoal.transform.position = new Vector3(largeGoalPosition, 0f, 0f);
}
public override void AgentReset()
{
position = 0;
minPosition = -10;
maxPosition = 10;
smallGoalPosition = -3;
largeGoalPosition = 7;
smallGoal.transform.position = new Vector3(smallGoalPosition, 0f, 0f);
largeGoal.transform.position = new Vector3(largeGoalPosition, 0f, 0f);
}
public override void AgentOnDone()
{
public override void AgentOnDone()
{
}
}
public void FixedUpdate()
{

12
unity-environment/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAcademy.cs


public class BouncerAcademy : Academy {
public override void AcademyReset()
{
public override void AcademyReset()
{
}
}
public override void AcademyStep()
{
public override void AcademyStep()
{
}
}
}

22
unity-environment/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs


rb.velocity = rb.velocity.normalized * speed;
}
public override void CollectObservations()
{
public override void CollectObservations()
{
}
}
public override void AgentAction(float[] vectorAction, string textAction)
{

}
else
{
//AddReward(0.05f);
// AddReward(0.05f);
}
}
public override void AgentReset()
{
public override void AgentReset()
{
}
}
public override void AgentOnDone()
{
public override void AgentOnDone()
{
}
}
private void OnTriggerEnter(Collider collision)
{

8
unity-environment/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerBanana.cs


void Start(){
}
// Update is called once per frame
void FixedUpdate () {
// Update is called once per frame
void FixedUpdate () {
}
}
private void OnTriggerEnter(Collider collision)
{

22
unity-environment/Assets/ML-Agents/Examples/Crawler/Scripts/CameraFollow.cs


public class CameraFollow : MonoBehaviour {
public Transform target;
Vector3 offset;
public Transform target;
Vector3 offset;
// Use this for initialization
void Start () {
offset = gameObject.transform.position - target.position;
}
// Update is called once per frame
void Update () {
//gameObject.transform.position = target.position + offset;
// Use this for initialization
void Start () {
offset = gameObject.transform.position - target.position;
}
// Update is called once per frame
void Update () {
// gameObject.transform.position = target.position + offset;
}
}
}

14
unity-environment/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAcademy.cs


public class HallwayAcademy : Academy {
public float agentRunSpeed;
public float agentRotationSpeed;
public Material goalScoredMaterial; //when a goal is scored the ground will use this material for a few seconds.
public Material failMaterial; //when fail, the ground will use this material for a few seconds.
public float gravityMultiplier; //use ~3 to make things less floaty
public float agentRunSpeed;
public float agentRotationSpeed;
public Material goalScoredMaterial; // when a goal is scored the ground will use this material for a few seconds.
public Material failMaterial; // when fail, the ground will use this material for a few seconds.
public float gravityMultiplier; // use ~3 to make things less floaty
public override void InitializeAcademy()
{

public override void AcademyReset()
{
public override void AcademyReset()
{
}
}

51
unity-environment/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs


//Put this script on your blue cube.
// Put this script on your blue cube.
using System.Collections;
using System.Collections.Generic;

{
public GameObject ground; //ground game object. we will use the area bounds to spawn the blocks
public GameObject ground; // ground game object. we will use the area bounds to spawn the blocks
public GameObject orangeBlock; //the orange block we are going to be pushing
public GameObject orangeBlock; // the orange block we are going to be pushing
Rigidbody shortBlockRB; //cached on initialization
Rigidbody agentRB; //cached on initialization
Material groundMaterial; //cached on Awake()
Rigidbody shortBlockRB; // cached on initialization
Rigidbody agentRB; // cached on initialization
Material groundMaterial; // cached on Awake()
Renderer groundRenderer;
HallwayAcademy academy;

{
base.InitializeAgent();
academy = FindObjectOfType<HallwayAcademy>();
brain = FindObjectOfType<Brain>(); //only one brain in the scene so this should find our brain. BRAAAINS.
brain = FindObjectOfType<Brain>(); // only one brain in the scene so this should find our brain. BRAAAINS.
agentRB = GetComponent<Rigidbody>(); //cache the agent rigidbody
groundRenderer = ground.GetComponent<Renderer>(); //get the ground renderer so we can change the material when a goal is scored
groundMaterial = groundRenderer.material; //starting material
agentRB = GetComponent<Rigidbody>(); // cache the agent rigidbody
groundRenderer = ground.GetComponent<Renderer>(); // get the ground renderer so we can change the material when a goal is scored
groundMaterial = groundRenderer.material; // starting material
}

RayPerception(rayDistance, rayAngles, detectableObjects, 0f);
}
//swap ground material, wait time seconds, then swap back to the regular ground material.
// swap ground material, wait time seconds, then swap back to the regular ground material.
yield return new WaitForSeconds(time); //wait for 2 sec
yield return new WaitForSeconds(time); // wait for 2 sec
groundRenderer.material = groundMaterial;
}

Vector3 dirToGo = Vector3.zero;
Vector3 rotateDir = Vector3.zero;
//If we're using Continuous control you will need to change the Action
// If we're using Continuous control you will need to change the Action
if (brain.brainParameters.vectorActionSpaceType == SpaceType.continuous)
{
dirToGo = transform.forward * Mathf.Clamp(act[0], -1f, 1f);

}
}
transform.Rotate(rotateDir, Time.deltaTime * 100f);
agentRB.AddForce(dirToGo * academy.agentRunSpeed, ForceMode.VelocityChange); //GO
agentRB.AddForce(dirToGo * academy.agentRunSpeed, ForceMode.VelocityChange); // GO
}
public override void AgentAction(float[] vectorAction, string textAction)

MoveAgent(vectorAction); //perform agent actions
bool fail = false; // did the agent or block get pushed off the edge?
if (!Physics.Raycast(agentRB.position, Vector3.down, 20)) //if the agent has gone over the edge, we done.
if (!Physics.Raycast(agentRB.position, Vector3.down, 20)) // if the agent has gone over the edge, we done.
fail = true; //fell off bro
fail = true; // fell off bro
Done(); //if we mark an agent as done it will be reset automatically. AgentReset() will be called.
Done(); // if we mark an agent as done it will be reset automatically. AgentReset() will be called.
StartCoroutine(GoalScoredSwapGroundMaterial(academy.failMaterial, .5f)); //swap ground material to indicate fail
StartCoroutine(GoalScoredSwapGroundMaterial(academy.failMaterial, .5f)); // swap ground material to indicate fail
}
}

if (col.gameObject.CompareTag("goal")) //touched goal
if (col.gameObject.CompareTag("goal")) // touched goal
AddReward(1f); //you get 5 points
StartCoroutine(GoalScoredSwapGroundMaterial(academy.goalScoredMaterial, 2)); //swap ground material for a bit to indicate we scored.
AddReward(1f); // you get 5 points
StartCoroutine(GoalScoredSwapGroundMaterial(academy.goalScoredMaterial, 2)); // swap ground material for a bit to indicate we scored.
AddReward(-0.1f); //you lose a point
StartCoroutine(GoalScoredSwapGroundMaterial(academy.failMaterial, .5f)); //swap ground material to indicate fail
AddReward(-0.1f); // you lose a point
StartCoroutine(GoalScoredSwapGroundMaterial(academy.failMaterial, .5f)); // swap ground material to indicate fail
Done(); //if we mark an agent as done it will be reset automatically. AgentReset() will be called.
Done(); // if we mark an agent as done it will be reset automatically. AgentReset() will be called.
//In the editor, if "Reset On Done" is checked then AgentReset() will be called automatically anytime we mark done = true in an agent script.
// In the editor, if "Reset On Done" is checked then AgentReset() will be called automatically anytime we mark done = true in an agent script.
public override void AgentReset()
{
selection = Random.Range(0, 2);

22
unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/FlyCamera.cs


space : Moves camera on X and Z axis only. So camera doesn't gain any height*/
public float mainSpeed = 100.0f; //regular speed
public float shiftAdd = 250.0f; //multiplied by how long shift is held. Basically running
public float maxShift = 1000.0f; //Maximum speed when holdin gshift
public float camSens = 0.25f; //How sensitive it with mouse
public float mainSpeed = 100.0f; // regular speed
public float shiftAdd = 250.0f; // multiplied by how long shift is held. Basically running
public float maxShift = 1000.0f; // Maximum speed when holdin gshift
public float camSens = 0.25f; // How sensitive it with mouse
private Vector3 lastMouse = new Vector3(255, 255, 255); //kind of in the middle of the screen, rather than at the top (play)
private Vector3 lastMouse = new Vector3(255, 255, 255); // kind of in the middle of the screen, rather than at the top (play)
private float totalRun = 1.0f;
void Awake()

//transform.position.Set(0,8,-32);
//transform.rotation.Set(15,0,0,1);
// transform.position.Set(0,8,-32);
// transform.rotation.Set(15,0,0,1);
transform.position = new Vector3(0, 8, -32);
transform.rotation = Quaternion.Euler(25, 0, 0);
}

lastMouse = new Vector3(transform.eulerAngles.x + lastMouse.x, transform.eulerAngles.y + lastMouse.y, 0);
transform.eulerAngles = lastMouse;
lastMouse = Input.mousePosition;
//Mouse camera angle done.
// Mouse camera angle done.
//Keyboard commands
// Keyboard commands
Vector3 p = GetBaseInput();
if (Input.GetKey(KeyCode.LeftShift))
{

Vector3 newPosition = transform.position;
if (Input.GetKey(KeyCode.Space)
|| (movementStaysFlat && !(rotateOnlyIfMousedown && Input.GetMouseButton(1))))
{ //If player wants to move on X and Z axis only
{ // If player wants to move on X and Z axis only
transform.Translate(p);
newPosition.x = transform.position.x;
newPosition.z = transform.position.z;

}
private Vector3 GetBaseInput()
{ //returns the basic values, if it's 0 than it's not active.
{ // returns the basic values, if it's 0 than it's not active.
Vector3 p_Velocity = new Vector3();
if (Input.GetKey(KeyCode.W))
{

12
unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAcademy.cs


public float goalSpeed;
public override void AcademyReset()
{
public override void AcademyReset()
{
}
}
public override void AcademyStep()
{
public override void AcademyStep()
{
}
}
}

5
unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs


/// We collect the normalized rotations, angularal velocities, and velocities of both
/// limbs of the reacher as well as the relative position of the target and hand.
/// </summary>
public override void CollectObservations()
{
public override void CollectObservations()
{
AddVectorObs(pendulumA.transform.rotation.eulerAngles.x / 180.0f - 1.0f);
AddVectorObs(pendulumA.transform.rotation.eulerAngles.y / 180.0f - 1.0f);
AddVectorObs(pendulumA.transform.rotation.eulerAngles.z / 180.0f - 1.0f);

goal.transform.localScale = new Vector3(goalSize, goalSize, goalSize);
}
}

12
unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherDecision.cs


public class ReacherDecision : MonoBehaviour, Decision {
public float[] Decide (List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory)
{
{
float[] action = new float[4];
for (int i = 0; i < 4; i++) {
action[i] = Random.Range(-1f, 1f);

}
}
{
return new List<float>();
}
{
return new List<float>();
}
}

18
unity-environment/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherGoal.cs


public GameObject hand;
public GameObject goalOn;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
private void OnTriggerEnter(Collider other)
{

16
unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/TennisArea.cs


public GameObject agentA;
public GameObject agentB;
// Use this for initialization
void Start () {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
// Update is called once per frame
void Update () {
}
public void MatchReset() {
float ballOut = Random.Range(6f, 8f);

216
unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/hitWall.cs


public class hitWall : MonoBehaviour
{
public GameObject areaObject;
public int lastAgentHit;
public GameObject areaObject;
public int lastAgentHit;
// Use this for initialization
void Start()
{
lastAgentHit = -1;
}
// Use this for initialization
void Start()
{
lastAgentHit = -1;
}
private void OnTriggerExit(Collider other)
{
TennisArea area = areaObject.GetComponent<TennisArea>();
TennisAgent agentA = area.agentA.GetComponent<TennisAgent>();
TennisAgent agentB = area.agentB.GetComponent<TennisAgent>();
private void OnTriggerExit(Collider other)
{
TennisArea area = areaObject.GetComponent<TennisArea>();
TennisAgent agentA = area.agentA.GetComponent<TennisAgent>();
TennisAgent agentB = area.agentB.GetComponent<TennisAgent>();
if (other.name == "over")
{
if (lastAgentHit == 0)
{
if (other.name == "over")
{
if (lastAgentHit == 0)
{
}
else
{
}
else
{
}
lastAgentHit = 0;
}
lastAgentHit = 0;
}
}
}
}
private void OnCollisionEnter(Collision collision)
{
TennisArea area = areaObject.GetComponent<TennisArea>();
TennisAgent agentA = area.agentA.GetComponent<TennisAgent>();
TennisAgent agentB = area.agentB.GetComponent<TennisAgent>();
private void OnCollisionEnter(Collision collision)
{
TennisArea area = areaObject.GetComponent<TennisArea>();
TennisAgent agentA = area.agentA.GetComponent<TennisAgent>();
TennisAgent agentB = area.agentB.GetComponent<TennisAgent>();
if (collision.gameObject.tag == "iWall")
{
if (collision.gameObject.name == "wallA")
{
if (lastAgentHit == 0)
{
if (collision.gameObject.tag == "iWall")
{
if (collision.gameObject.name == "wallA")
{
if (lastAgentHit == 0)
{
agentB.score += 1;
}
else
{
agentA.SetReward(0);
agentB.score += 1;
}
else
{
agentA.SetReward(0);
agentA.score += 1;
}
}
else if (collision.gameObject.name == "wallB")
{
if (lastAgentHit == 0)
{
agentA.score += 1;
}
}
else if (collision.gameObject.name == "wallB")
{
if (lastAgentHit == 0)
{
agentB.score += 1;
}
else
{
agentA.SetReward(0);
agentB.score += 1;
}
else
{
agentA.SetReward(0);
agentA.score += 1;
}
}
else if (collision.gameObject.name == "floorA")
{
if (lastAgentHit == 0 || lastAgentHit == -1)
{
agentA.score += 1;
}
}
else if (collision.gameObject.name == "floorA")
{
if (lastAgentHit == 0 || lastAgentHit == -1)
{
agentB.SetReward(0);
agentB.score += 1;
}
else
{
agentB.SetReward(0);
agentB.score += 1;
}
else
{
agentB.SetReward(0);
agentB.score += 1;
agentB.SetReward(0);
agentB.score += 1;
}
}
else if (collision.gameObject.name == "floorB")
{
if (lastAgentHit == 1 || lastAgentHit == -1)
{
agentA.SetReward(0);
}
}
else if (collision.gameObject.name == "floorB")
{
if (lastAgentHit == 1 || lastAgentHit == -1)
{
agentA.SetReward(0);
agentA.score += 1;
}
else
{
agentA.SetReward(0);
agentA.score += 1;
}
else
{
agentA.SetReward(0);
agentA.score += 1;
}
}
else if (collision.gameObject.name == "net")
{
if (lastAgentHit == 0)
{
agentA.score += 1;
}
}
else if (collision.gameObject.name == "net")
{
if (lastAgentHit == 0)
{
agentB.SetReward(0);
agentB.score += 1;
}
else
{
agentA.SetReward(0);
agentB.SetReward(0);
agentB.score += 1;
}
else
{
agentA.SetReward(0);
agentA.score += 1;
}
}
agentA.score += 1;
}
}
agentB.Done();
area.MatchReset();
}
agentB.Done();
area.MatchReset();
}
if (collision.gameObject.tag == "agent")
{
if (collision.gameObject.name == "AgentA")
{
lastAgentHit = 0;
}
else
{
lastAgentHit = 1;
}
}
}
if (collision.gameObject.tag == "agent")
{
if (collision.gameObject.name == "AgentA")
{
lastAgentHit = 0;
}
else
{
lastAgentHit = 1;
}
}
}
}

20
unity-environment/Assets/ML-Agents/Scripts/Academy.cs


/// Environment specific initialization.
/**
* Implemented in environment-specific child class.
* This method is called once when the environment is loaded.
*/
* Implemented in environment-specific child class.
* This method is called once when the environment is loaded.
*/
public virtual void InitializeAcademy()
{

/// Environment specific step logic.
/**
* Implemented in environment-specific child class.
* This method is called at every step.
*/
* Implemented in environment-specific child class.
* This method is called at every step.
*/
public virtual void AcademyStep()
{

/**
* Implemented in environment-specific child class.
* This method is called everytime the Academy resets (when the global done
* flag is set to true).
*/
* Implemented in environment-specific child class.
* This method is called everytime the Academy resets (when the global done
* flag is set to true).
*/
public virtual void AcademyReset()
{

18
unity-environment/Assets/ML-Agents/Scripts/Agent.cs


/// <summary>
/// The brain that will control this agent.
/// Use the inspector to drag the desired brain gameObject into
/// the Brain field.
/// the Brain field.
///</summary>
[HideInInspector]
public Brain brain;

///</summary>
private float reward;
/// Whether or not the agent is requests an action
/// Whether or not the agent requests an action.
/// Whether or not the agent is requests a decision
/// Whether or not the agent requests a decision.
private bool requestDecision;
/// <summary>

private int id;
/// <summary>
/// Unity method called when the agent is istanciated or set to active.
/// Unity method called when the agent is instantiated or set to active.
/// </summary>
private void OnEnable()
{

/// When GiveBrain is called, the agent unsubscribes from its
/// previous brain and subscribes to the one passed in argument.
/// Use this method to provide a brain to the agent via script.
///<param name= "b" >The Brain the agent will subscribe to.</param>
///<param name= "b" >The Brain the agent will subscribe to.</param>
/// <summary>
public void GiveBrain(Brain b)
{

/// <summary>
/// Is called when the agent must request the brain for a new decision.
/// </summary>
public void RequestDecision()
public void RequestDecision()
{
requestDecision = true;
RequestAction();

/// </summary>
public void RequestAction()
public void RequestAction()
{
requestAction = true;
}

/// <summary>
/// Initialize the agent with this method
/// Must be implemented in agent-specific child class.
/// This method called only once when the agent is enabled.
/// This method called only once when the agent is enabled.
/// </summary>
public virtual void InitializeAgent()
{

{
if (!hasAlreadyReset)
{
//If event based, the agent can reset as soon
// If event based, the agent can reset as soon
// as it is done
_AgentReset();
hasAlreadyReset = true;

14
unity-environment/Assets/ML-Agents/Scripts/BCTeacherHelper.cs


public KeyCode recordKey = KeyCode.R;
public KeyCode resetKey = KeyCode.C;
// Use this for initialization
void Start () {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(recordKey))
{
recordExperiences = !recordExperiences;

Monitor.Log("Recording experiences " + recordKey.ToString(), recordExperiences.ToString());
float timeSinceBufferReset = Time.time - bufferResetTime;
Monitor.Log("Seconds since buffer reset " + resetKey.ToString(), Mathf.FloorToInt(timeSinceBufferReset));
}
}
void FixedUpdate()
{

8
unity-environment/Assets/ML-Agents/Scripts/Brain.cs


//[HideInInspector]
///**< \brief Keeps track of the agents which subscribe to this brain*/
//public Dictionary<int, Agent> agents = new Dictionary<int, Agent>();
// public Dictionary<int, Agent> agents = new Dictionary<int, Agent>();
[SerializeField]
ScriptableObject[] CoreBrains;

//Ensures the coreBrains are not dupplicated with the brains
// Ensures the coreBrains are not dupplicated with the brains
* If the brain gameObject was just created, it generates a list of
* coreBrains (one for each brainType) */
* If the brain gameObject was just created, it generates a list of
* coreBrains (one for each brainType) */
public void UpdateCoreBrains()
{

2
unity-environment/Assets/ML-Agents/Scripts/Communicator.cs


public string logPath;
/**< \brief The default reset parameters are sent via socket*/
public Dictionary<string, float> resetParameters;
public Dictionary<string, float> resetParameters;
/**< \brief A list of the all the brains names sent via socket*/
public List<string> brainNames;

39
unity-environment/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs


/// Uses the Decision Component to decide that action to take
public void DecideAction(Dictionary<Agent, AgentInfo> agentInfo)
{
if (coord!=null)
{
if (coord!=null)
{
}
if (decision == null)
}
if (decision == null)
agent.UpdateVectorAction(decision.Decide(
agent.UpdateVectorAction(decision.Decide(
agentInfo[agent].stackedVectorObservation,
agentInfo[agent].visualObservations,
agentInfo[agent].reward,

}
agentInfo[agent].stackedVectorObservation,
agentInfo[agent].visualObservations,
agentInfo[agent].reward,
agentInfo[agent].done,
agentInfo[agent].memories));
agentInfo[agent].stackedVectorObservation,
agentInfo[agent].visualObservations,
agentInfo[agent].reward,
agentInfo[agent].done,
agentInfo[agent].memories));
}
}

#if UNITY_EDITOR
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
broadcast = EditorGUILayout.Toggle(new GUIContent("Broadcast",
"If checked, the brain will broadcast states and actions to Python."), broadcast);
if (brain.gameObject.GetComponent<Decision>() == null)
{
#if UNITY_EDITOR
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
broadcast = EditorGUILayout.Toggle(new GUIContent("Broadcast",
"If checked, the brain will broadcast states and actions to Python."), broadcast);
if (brain.gameObject.GetComponent<Decision>() == null)
{
}
#endif
}
#endif
}
}

22
unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs


{
#if ENABLE_TENSORFLOW
#if UNITY_ANDROID
// This needs to ba called only once and will raise an exception if
// This needs to ba called only once and will raise an exception if
try{
TensorFlowSharp.Android.NativeBinding.Init();
}
catch{
}
try{
TensorFlowSharp.Android.NativeBinding.Init();
}
catch{
}
#endif
if ((communicator == null)
|| (!broadcast))

public void DecideAction(Dictionary<Agent, AgentInfo> agentInfo)
{
#if ENABLE_TENSORFLOW
if (coord != null)
{
coord.GiveBrainInfo(brain, agentInfo);
}
if (coord != null)
{
coord.GiveBrainInfo(brain, agentInfo);
}
int currentBatchSize = agentInfo.Count();
List<Agent> agentList = agentInfo.Keys.ToList();
if (currentBatchSize == 0)

2
unity-environment/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs


else
{
foreach (Agent agent in agentInfo.Keys)
{
{
var action = new float[1] { defaultAction };
foreach (DiscretePlayerAction dha in discretePlayerActions)
{

28
unity-environment/Assets/ML-Agents/Scripts/Decision.cs


/// \brief Implement this method to define the logic of decision making
/// for the CoreBrainHeuristic
/** Given the information about the agent, return a vector of actions.
* @param state The state of the agent
* @param observation The cameras the agent uses
* @param reward The reward the agent had at the previous step
* @param done Weather or not the agent is done
* @param memory The memories stored from the previous step with MakeMemory()
* @return The vector of actions the agent will take at the next step
*/
* @param state The state of the agent
* @param observation The cameras the agent uses
* @param reward The reward the agent had at the previous step
* @param done Whether or not the agent is done
* @param memory The memories stored from the previous step with MakeMemory()
* @return The vector of actions the agent will take at the next step
*/
* @param state The state of the agent
* @param observation The cameras the agent uses
* @param reward The reward the agent had at the previous step
* @param done Weather or not the agent is done
* @param memory The memories stored from the previous step with MakeMemory()
* @return The vector of memories the agent will use at the next step
*/
* @param state The state of the agent
* @param observation The cameras the agent uses
* @param reward The reward the agent had at the previous step
* @param done Weather or not the agent is done
* @param memory The memories stored from the previous step with MakeMemory()
* @return The vector of memories the agent will use at the next step
*/
List<float> MakeMemory(List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory);
}

8
unity-environment/Assets/ML-Agents/Scripts/ExternalCommunicator.cs


sMessage.maxes= new List<bool>(defaultNumAgents);
sMessage.textObservations = new List<string>(defaultNumAgents);
//Initialize the list of brains the Communicator must listen to
// Initialize the list of brains the Communicator must listen to
// Issue : This assumes all brains are broadcasting.
foreach(string k in accParamerters.brainNames){
current_agents[k] = new List<Agent>(defaultNumAgents);

return triedSendState;
}
public Dictionary<string, bool> GetSent()
{
public Dictionary<string, bool> GetSent()
{
}
}
/// Listens for actions, memories, and values and sends them
/// to the corrensponding brains.

12
unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAcademy.cs


public class TemplateAcademy : Academy {
public override void AcademyReset()
{
public override void AcademyReset()
{
}
}
public override void AcademyStep()
{
public override void AcademyStep()
{
}
}
}

20
unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAgent.cs


public override void CollectObservations()
{
public override void CollectObservations()
{
}
}
}
}
public override void AgentReset()
{
public override void AgentReset()
{
}
}
public override void AgentOnDone()
{
public override void AgentOnDone()
{
}
}
}

2
unity-environment/Assets/ML-Agents/Template/Scripts/TemplateDecision.cs


public List<float> MakeMemory(List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory)
{
return new List<float>();
}
}
正在加载...
取消
保存