bensons gets mental pain from existing

This commit is contained in:
2024-04-12 12:10:24 +02:00
parent b2599fe28f
commit 0b9d3b4950

View File

@@ -126,11 +126,16 @@ public class AgentController : Agent
if (actions.DiscreteActions[1] == 1)
hInput = 1f;
// reward for going forward
if (vInput == 1f)
{
AddReward(0.001f);
}
// give benson mental pain for existing (punishment for maximizing first checkpoint by standing still)
AddReward(-0.002f);
float forwardSpeed = Vector3.Dot(transform.forward, rigidBody.velocity);
@@ -269,10 +274,19 @@ public class AgentController : Agent
return distanceToCheckpoint;
}
// punishment for hitting a wall
private void OnCollisionEnter(Collision other) {
if (other.gameObject.tag == "Wall")
{
AddReward(-0.05f);
}
}
// punishment for staying at a wall
private void OnCollisionStay(Collision other) {
if (other.gameObject.tag == "Wall")
{
AddReward(-0.01f);
AddReward(-0.005f);
}
}
}