Skip to content

Commit 5b0bdd2

Browse files
author
Chris Elion
committed
fix reward calculations (#5418)
1 parent 96e5101 commit 5b0bdd2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ public enum Position
5050

5151
public override void Initialize()
5252
{
53-
m_Existential = 1f / MaxStep;
53+
SoccerEnvController envController = GetComponentInParent<SoccerEnvController>();
54+
if (envController != null)
55+
{
56+
m_Existential = 1f / envController.MaxEnvironmentSteps;
57+
}
58+
else
59+
{
60+
m_Existential = 1f / MaxStep;
61+
}
62+
5463
m_BehaviorParameters = gameObject.GetComponent<BehaviorParameters>();
5564
if (m_BehaviorParameters.TeamId == (int)Team.Blue)
5665
{

Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class PlayerInfo
2121
/// Max Academy steps before this platform resets
2222
/// </summary>
2323
/// <returns></returns>
24-
[Header("Max Environment Steps")] public int MaxEnvironmentSteps = 25000;
24+
[Tooltip("Max Environment Steps")] public int MaxEnvironmentSteps = 25000;
2525

2626
/// <summary>
2727
/// The area bounds.

0 commit comments

Comments
 (0)