浏览代码

Simplify small agent reward fn

/develop/cubewars/splashdamage
Ervin Teng 4 年前
当前提交
fb5c6554
共有 1 个文件被更改,包括 11 次插入15 次删除
  1. 26
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

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


m_CubeWarSettings = FindObjectOfType<CubeWarSettings>();
SetResetParameters();
myLaser.maxLength = m_Range;
myLaser.width = m_Splash / 2f;
myLaser.width = m_Splash;
}
public override void CollectObservations(VectorSensor sensor)

if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HealAgent(m_Heal);
if (role == Role.Healer)
{
AddReward(.05f);
}
// if (role == Role.Healer)
// {
// AddReward(.01f);
// }
if (role == Role.DPS)
{
AddReward(.05f);
}
// Give reward proportional to damage
AddReward(m_Damage);
}
}
}

{
if (!m_Dead)
{
if (role == Role.Tank)
{
AddReward(.05f);
}
// if (role == Role.Tank)
// {
// AddReward(.05f);
// }
m_HitPoints -= damage;
HealthStatus();
return m_HitPoints <= 0;

正在加载...
取消
保存