浏览代码

add role observation one hots

/develop/cubewars/splashdamage
Andrew Cohen 4 年前
当前提交
49bc813e
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 5
      Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/SmallAgent.prefab
  2. 6
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

5
Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/SmallAgent.prefab


m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
VectorObservationSize: 4
VectorObservationSize: 7
NumStackedVectorObservations: 2
m_ActionSpec:
m_NumContinuousActions: 3

MaxStep: 3000
area: {fileID: 0}
largeAgent: {fileID: 0}
turnSpeed: 300
moveSpeed: 6
role: 0
--- !u!1 &8083875348725975067
GameObject:
m_ObjectHideFlags: 0

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


}
public Role role;
float[] m_RoleObs;
m_RoleObs = new float[3];
m_RoleObs[0] = 1f;
m_HitPoints = .7f;
m_Damage = 0f;
m_Heal = .7f;

}
else if (role == Role.DPS)
{
m_RoleObs[1] = 1f;
m_HitPoints = .6f;
m_Damage = .05f;
m_Heal = 0f;

}
else if (role == Role.Tank)
{
m_RoleObs[2] = 1f;
m_HitPoints = 1f;
m_Damage = .02f;
m_Heal = .2f;

Vector3 dirToSelf = transform.position - m_LargeAgent.transform.position;
float angle = Vector3.Dot(m_LargeAgent.transform.forward.normalized, dirToSelf.normalized);
sensor.AddObservation(angle);
sensor.AddObservation(m_RoleObs);
}
public Color32 ToColor(int hexVal)

正在加载...
取消
保存