浏览代码

Revert C# env changes

/develop/coma2/samenet
Ervin Teng 4 年前
当前提交
08bcab2b
共有 6 个文件被更改,包括 65 次插入1067 次删除
  1. 932
      Project/Assets/ML-Agents/Examples/Hallway/Prefabs/SymbolFinderArea.prefab
  2. 2
      Project/Assets/ML-Agents/Examples/Hallway/Scenes/Hallway.unity.meta
  3. 22
      Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs
  4. 8
      Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab
  5. 146
      Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity
  6. 22
      Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs

932
Project/Assets/ML-Agents/Examples/Hallway/Prefabs/SymbolFinderArea.prefab
文件差异内容过多而无法显示
查看文件

2
Project/Assets/ML-Agents/Examples/Hallway/Scenes/Hallway.unity.meta


fileFormatVersion: 2
guid: 71d1487c63f604ff6985cc2f23c7afbf
guid: d6d6a33ed0e18459a8d61817d600978a
DefaultImporter:
externalObjects: {}
userData:

22
Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs


public GameObject symbolO;
public GameObject symbolX;
public bool useVectorObs;
protected Rigidbody m_AgentRb;
protected Material m_GroundMaterial;
protected Renderer m_GroundRenderer;
protected HallwaySettings m_HallwaySettings;
protected int m_Selection;
Rigidbody m_AgentRb;
Material m_GroundMaterial;
Renderer m_GroundRenderer;
HallwaySettings m_HallwaySettings;
int m_Selection;
StatsRecorder m_statsRecorder;
public override void Initialize()

m_GroundRenderer = ground.GetComponent<Renderer>();
m_GroundMaterial = m_GroundRenderer.material;
//m_statsRecorder = Academy.Instance.StatsRecorder;
m_statsRecorder = Academy.Instance.StatsRecorder;
}
public override void CollectObservations(VectorSensor sensor)

}
}
protected IEnumerator GoalScoredSwapGroundMaterial(Material mat, float time)
IEnumerator GoalScoredSwapGroundMaterial(Material mat, float time)
{
m_GroundRenderer.material = mat;
yield return new WaitForSeconds(time);

{
SetReward(1f);
StartCoroutine(GoalScoredSwapGroundMaterial(m_HallwaySettings.goalScoredMaterial, 0.5f));
// m_statsRecorder.Add("Goal/Correct", 1, StatAggregationMethod.Sum);
m_statsRecorder.Add("Goal/Correct", 1, StatAggregationMethod.Sum);
// m_statsRecorder.Add("Goal/Wrong", 1, StatAggregationMethod.Sum);
m_statsRecorder.Add("Goal/Wrong", 1, StatAggregationMethod.Sum);
}
EndEpisode();
}

symbolXGoal.transform.position = new Vector3(7f, 0.5f, 22.29f) + area.transform.position;
symbolOGoal.transform.position = new Vector3(-7f, 0.5f, 22.29f) + area.transform.position;
}
// m_statsRecorder.Add("Goal/Correct", 0, StatAggregationMethod.Sum);
// m_statsRecorder.Add("Goal/Wrong", 0, StatAggregationMethod.Sum);
m_statsRecorder.Add("Goal/Correct", 0, StatAggregationMethod.Sum);
m_statsRecorder.Add("Goal/Wrong", 0, StatAggregationMethod.Sum);
}
}

8
Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab


m_BehaviorType: 0
m_BehaviorName: SoccerTwos
TeamId: 1
GroupId: 0
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &114492261207303438
MonoBehaviour:

m_BehaviorType: 0
m_BehaviorName: SoccerTwos
TeamId: 0
GroupId: 0
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &114850431417842684
MonoBehaviour:

m_BehaviorType: 0
m_BehaviorName: SoccerTwos
TeamId: 1
GroupId: 0
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &5320024511406682322
MonoBehaviour:

m_BehaviorType: 0
m_BehaviorName: SoccerTwos
TeamId: 0
GroupId: 0
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &5379409612883756837
MonoBehaviour:

146
Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity


propertyPath: m_RootOrder
value: 8
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 4
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 4
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 4
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
--- !u!1001 &774084574

propertyPath: m_RootOrder
value: 11
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 7
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 7
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 7
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
--- !u!1001 &1177695920

propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 1
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
--- !u!1001 &1325062279

propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 3
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
--- !u!1001 &1348885204

m_Name:
m_EditorClassIdentifier:
gravityMultiplier: 1
monitorVerticalOffset: 0
reuseCollisionCallbacks: 1
--- !u!114 &1574236051
MonoBehaviour:
m_ObjectHideFlags: 0

blueMaterial: {fileID: 2100000, guid: c9fa44c2c3f8ce74ca39a3355ea42631, type: 2}
randomizePlayersTeamForTraining: 0
agentRunSpeed: 2
strikerPunish: -0.1
strikerReward: 1
goaliePunish: -1
goalieReward: 0.1
--- !u!1001 &1606160104
PrefabInstance:
m_ObjectHideFlags: 0

propertyPath: m_RootOrder
value: 9
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 5
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 5
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
--- !u!1001 &1748755984

propertyPath: m_RootOrder
value: 10
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 6
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 6
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 6
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 6
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
--- !u!1001 &2043067438

- target: {fileID: 4558743310993102, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 114387866097048300, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114734187185382186, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3316085536305919483, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8577361778124631730, guid: 54f3340298537426e96a6cc530e2d5d8,
type: 3}
propertyPath: GroupId
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 54f3340298537426e96a6cc530e2d5d8, type: 3}

22
Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs


public class WallJumpAgent : Agent
{
// Depending on this value, the wall will have different height
protected int m_Configuration;
int m_Configuration;
// Brain to use when no wall is present
public NNModel noWallBrain;
// Brain to use when a jumpable wall is present

public GameObject ground;
public GameObject spawnArea;
protected Bounds m_SpawnAreaBounds;
Bounds m_SpawnAreaBounds;
protected Rigidbody m_ShortBlockRb;
protected Rigidbody m_AgentRb;
protected Material m_GroundMaterial;
protected Renderer m_GroundRenderer;
protected WallJumpSettings m_WallJumpSettings;
Rigidbody m_ShortBlockRb;
Rigidbody m_AgentRb;
Material m_GroundMaterial;
Renderer m_GroundRenderer;
WallJumpSettings m_WallJumpSettings;
public float jumpingTime;
public float jumpTime;

string m_SmallWallBehaviorName = "SmallWallJump";
string m_BigWallBehaviorName = "BigWallJump";
protected EnvironmentParameters m_ResetParams;
EnvironmentParameters m_ResetParams;
public override void Initialize()
{

/// <returns>The Enumerator to be used in a Coroutine.</returns>
/// <param name="mat">The material to be swapped.</param>
/// <param name="time">The time the material will remain.</param>
protected IEnumerator GoalScoredSwapGroundMaterial(Material mat, float time)
IEnumerator GoalScoredSwapGroundMaterial(Material mat, float time)
{
m_GroundRenderer.material = mat;
yield return new WaitForSeconds(time); //wait for 2 sec

}
// Detect when the agent hits the goal
protected virtual void OnTriggerStay(Collider col)
void OnTriggerStay(Collider col)
{
if (col.gameObject.CompareTag("goal") && DoGroundCheck(true))
{

/// If 1: Small wall and smallWallBrain.
/// Other : Tall wall and BigWallBrain.
/// </param>
protected virtual void ConfigureAgent(int config)
void ConfigureAgent(int config)
{
var localScale = wall.transform.localScale;
if (config == 0)

正在加载...
取消
保存