浏览代码

cubewars fixes

/asymm-envs
Andrew Cohen 5 年前
当前提交
2988727e
共有 3 个文件被更改,包括 14 次插入11 次删除
  1. 10
      Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/CubeWarArea.prefab
  2. 5
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs
  3. 10
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

10
Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/CubeWarArea.prefab


vectorActionSize: 03000000030000000300000002000000
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: f0cde68512f074e09a9a10fe34c5a256, type: 3}
m_Model: {fileID: 11400000, guid: 79b02a5ad0fe744069fa2d0430339d97, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: SmallCubeSoldier

vectorActionSize: 03000000030000000300000002000000
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: f0cde68512f074e09a9a10fe34c5a256, type: 3}
m_Model: {fileID: 11400000, guid: 79b02a5ad0fe744069fa2d0430339d97, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: SmallCubeSoldier

vectorActionSize: 03000000030000000300000002000000
vectorActionDescriptions: []
vectorActionSpaceType: 0
m_Model: {fileID: 11400000, guid: f0cde68512f074e09a9a10fe34c5a256, type: 3}
m_Model: {fileID: 11400000, guid: 79b02a5ad0fe744069fa2d0430339d97, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: SmallCubeSoldier

m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
vectorObservationSize: 2
vectorObservationSize: 3
m_Model: {fileID: 11400000, guid: b0f600e95eb414841ac5934a0034b1e9, type: 3}
m_Model: {fileID: 11400000, guid: b61594727f10a4be59cc51336e8e1cea, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: LargeCubeSoldier

5
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs


public override void CollectObservations(VectorSensor sensor)
{
sensor.AddObservation(System.Convert.ToInt32(m_Shoot));
sensor.AddObservation(System.Convert.ToInt32(m_Shockwave));
sensor.AddObservation(m_HitPoints);
}

{
if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(.35f);
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(.5f);
AddReward(.1f);
}
else if (hit.collider.gameObject.CompareTag("StrongLargeAgent") || hit.collider.gameObject.CompareTag("WeakLargeAgent"))
{

if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(1f);
AddReward(.1f);
}
}
}

10
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs


}
else if (hit.collider.gameObject.CompareTag("StrongLargeAgent") || hit.collider.gameObject.CompareTag("WeakLargeAgent"))
{
hit.collider.gameObject.GetComponent<LargeCubeAgent>().HitAgent(.05f);
hit.collider.gameObject.GetComponent<LargeCubeAgent>().HitAgent(.02f);
AddReward(.5f * m_Bonus);
AddReward(.1f + .4f * m_Bonus);
}
}
}

{
if (m_HitPoints < 1f)
{
m_HitPoints = Mathf.Min(m_HitPoints + .1f, 1f);
m_HitPoints = Mathf.Min(m_HitPoints + .2f, 1f);
HealthStatus();
}
}

if (m_HitPoints <= 1f && m_HitPoints > .65f)
if (m_HitPoints <= 1f && m_HitPoints > .5f)
else if (m_HitPoints <= .65f && m_HitPoints > .3f)
else if (m_HitPoints <= .5f && m_HitPoints > 0.0f)
{
gameObject.tag = "WeakSmallAgent";
gameObject.GetComponentInChildren<Renderer>().material = weakMaterial;

正在加载...
取消
保存